:root {
  --primary-color: #0751a3;
  --primary-hover: #0a62c4;
  --primary-dark: #06346b;
  --primary-light: #e8f1fb;
  --gold-color: #ffd200;
  --gold-dark: #d9a404;
  --bg-color: #f1f5f9;
  --card-bg: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: #cbd5e1;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --info-color: #0284c7;
  --sidebar-width: 270px;
  --sidebar-collapsed-width: 72px;
  --header-height: 50px;
  --footer-height: 36px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.12);
  --transition: all 0.25s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ==========================================================================
   APP CONTAINER & LAYOUT
   ========================================================================== */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* ==========================================================================
   SIDEBAR & SLIDE COLLAPSIBLE MENU (CHUẨN TỪ kSTFAST)
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  /* Kính xanh đậm: ảnh nền toàn trang hiện mờ xuyên qua */
  background: linear-gradient(180deg, rgba(7, 43, 92, 0.86) 0%, rgba(5, 29, 62, 0.92) 100%);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  box-shadow: 2px 0 12px rgba(0,0,0,0.25);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

/* Trạng thái thu gọn (Collapsed Sidebar) */
.sidebar.collapsed {
  width: 70px;
}

.sidebar.collapsed ~ .main-wrapper {
  margin-left: 70px;
  width: calc(100% - 70px);
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  gap: 10px;
  flex-shrink: 0;
  transition: all 0.25s ease;
}

.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 0 6px;
  gap: 0;
}

.sidebar.collapsed .sidebar-brand {
  display: none !important;
}

.sidebar-header .app-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.sidebar-header .app-logo:hover {
  transform: scale(1.08);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-brand h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffffff;
  line-height: 1.2;
  white-space: nowrap;
}

.sidebar-brand small {
  font-size: 11px;
  color: var(--gold-color);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* Badge phiên bản cạnh "KHO DỮ LIỆU SỐ" */
.version-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.5;
  color: #0b2a55;
  background: linear-gradient(135deg, #fde68a, #fbbf24);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

/* Navigation items */
.sidebar-nav {
  list-style: none;
  padding: 10px 8px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
  transition: all 0.25s ease;
}

.sidebar.collapsed .sidebar-nav {
  padding: 12px 6px;
  align-items: center;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
.sidebar-nav:hover::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
}

.nav-section-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.45);
  padding: 12px 10px 4px;
  user-select: none;
  white-space: nowrap;
}

.sidebar.collapsed .nav-section-title {
  width: 32px;
  height: 1px;
  margin: 8px auto;
  padding: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0;
  line-height: 0;
  overflow: hidden;
  color: transparent;
}

.nav-item {
  width: 100%;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-item a:hover {
  background: rgba(255,255,255,0.1);
  color: #ffffff;
}

.nav-item a.active {
  background: linear-gradient(90deg, #0751a3, #0284c7);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.sidebar.collapsed .nav-item a {
  justify-content: center;
  padding: 10px 0;
  width: 100%;
}

.sidebar.collapsed .nav-text {
  display: none !important;
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar.collapsed .nav-icon {
  margin: 0;
  font-size: 18px;
}

/* Sidebar Footer (Hồ sơ người dùng & Đăng xuất) */
.sidebar-footer {
  height: var(--footer-height);
  padding: 0 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(5, 29, 62, 0.6);
  display: flex;
  align-items: center;
  overflow: hidden;
  flex-shrink: 0;
  margin-top: auto;
}

.user-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
}

.user-greeting {
  font-size: 12px;
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  min-width: 0;
}

.user-greeting .fa-circle-user {
  font-size: 18px;
  color: #38bdf8;
  flex-shrink: 0;
}

.greeting-text {
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.greeting-text strong {
  color: #ffffff;
  font-weight: 700;
}

.user-role-badge {
  flex-shrink: 0;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid transparent;
}

.user-role-badge.role-super  { color: #fbbf24; background: rgba(245, 158, 11, 0.18); border-color: rgba(245, 158, 11, 0.5); }
.user-role-badge.role-admin  { color: #fca5a5; background: rgba(239, 68, 68, 0.18);  border-color: rgba(239, 68, 68, 0.5); }
.user-role-badge.role-editor { color: #93c5fd; background: rgba(59, 130, 246, 0.18); border-color: rgba(59, 130, 246, 0.5); }
.user-role-badge.role-user   { color: #86efac; background: rgba(34, 197, 94, 0.18);  border-color: rgba(34, 197, 94, 0.5); }

/* Nút Đăng xuất dạng nút nguồn (Power) */
.sidebar-logout-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.12);
  border: 1.5px solid rgba(239, 68, 68, 0.55);
  color: #f87171;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.25);
  transition: all 0.2s ease;
}

.sidebar-logout-btn:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.65);
  transform: scale(1.06);
}

.sidebar-logout-btn:active {
  transform: scale(0.95);
}

.sidebar.collapsed .user-greeting {
  display: none !important;
}

.sidebar.collapsed .user-info-row {
  justify-content: center;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
/* Hình nền ứng dụng: phủ toàn bộ cửa sổ (cả sau sidebar) */
.app-container::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url('/static/images/kBackground.jpg?v=2.0') center / cover no-repeat;
  z-index: -1;
  pointer-events: none;
}

/* Khung 1 màn hình: header & footer cố định, chỉ phần thân cuộn */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0; /* Không cho bảng rộng đẩy vùng nội dung tràn ra ngoài màn hình */
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  transition: margin-left var(--transition);
}

/* Header & Footer vùng nội dung: kính xanh đậm nối liền với sidebar */
.top-header,
.main-footer {
  flex-shrink: 0;
  background: linear-gradient(90deg, rgba(7, 43, 92, 0.78) 0%, rgba(7, 81, 163, 0.55) 100%);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  color: #e2e8f0;
}

.main-footer {
  height: var(--footer-height);
  padding: 0 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: 12px;
}

/* Header */
.top-header {
  height: var(--header-height);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: relative;
  z-index: 90;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-title-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.page-title-badge i {
  color: #fbbf24;
}

/* Page Content Body */
.content-body {
  padding: 16px;
  flex: 1;
  min-height: 0;
  overflow: auto; /* Trang nhiều khối (Trang Chủ, Hướng Dẫn): chỉ phần thân cuộn */
}

/* Trang danh sách: vừa 1 màn hình, chỉ bảng cuộn (tiêu đề cột luôn hiện) */
.content-body.content-fit {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.content-fit > * {
  flex-shrink: 0;
}

.content-fit > .table-container {
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

.content-fit > .table-container > * {
  flex-shrink: 0;
}

.content-fit > .table-container > .table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* Bảng rộng hơn khung: cuộn ngang bên trong thẻ, không đẩy trang */
.table-scroll {
  overflow-x: auto;
}

.content-fit .table-scroll .k-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: inset 0 -1px 0 var(--border-color);
}

/* ==========================================================================
   CARDS & METRICS
   ========================================================================== */
.card-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

/* Thẻ số liệu Trang Chủ: tất cả trên 1 hàng, ô gọn */
.card-grid-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.card-grid-row .metric-card {
  padding: 12px 14px;
  gap: 12px;
  min-width: 0;
}

.card-grid-row .metric-icon {
  width: 40px;
  height: 40px;
  font-size: 17px;
  flex-shrink: 0;
}

.card-grid-row .metric-info {
  min-width: 0;
}

.card-grid-row .metric-info h3 {
  font-size: 20px;
}

.card-grid-row .metric-info p {
  font-size: 11.5px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.k-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.k-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.metric-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.metric-icon.blue { background: #e0f2fe; color: #0284c7; }
.metric-icon.green { background: #dcfce7; color: #16a34a; }
.metric-icon.purple { background: #f3e8ff; color: #9333ea; }
.metric-icon.amber { background: #fef3c7; color: #d97706; }

.metric-info h3 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.metric-info p {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ==========================================================================
   BUTTONS & CONTROLS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-color);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 10px rgba(7, 81, 163, 0.25);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn-success { background: var(--success-color); color: #fff; }
.btn-success:hover { background: #059669; }

.btn-danger { background: var(--danger-color); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-info { background: var(--info-color); color: #fff; }
.btn-info:hover { background: #0369a1; }

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* ==========================================================================
   TABLES & FILTERS
   ========================================================================== */
.table-container {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

.table-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.table-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.k-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.k-table th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.k-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-primary);
  vertical-align: middle;
}

.k-table tr:hover td {
  background: #f8fafc;
}

/* --- Thanh tiêu đề bảng 1 dòng: tiêu đề bên trái, nút thao tác căn phải --- */
.table-header.k-toolbar-row {
  flex-wrap: nowrap;
  padding: 10px 16px;
}

.k-toolbar-row .k-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
}

.k-toolbar-row .table-title {
  margin: 0;
  font-size: 14.5px;
  white-space: nowrap;
}

.table-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

.table-toolbar-actions .btn {
  white-space: nowrap;
  gap: 6px;
}

.btn-soft-info { color: #0284c7; border-color: #bae6fd; background: #f0f9ff; }
.btn-soft-success { color: #16a34a; border-color: #bbf7d0; background: #f0fdf4; }
.btn-soft-warning { color: #d97706; border-color: #fed7aa; background: #fffbeb; }
.btn-soft-danger { color: #dc2626; border-color: #fecaca; background: #fef2f2; }
.btn-soft-info:hover, .btn-soft-success:hover, .btn-soft-warning:hover, .btn-soft-danger:hover {
  filter: brightness(0.96);
}
.btn-icon-only { padding: 5px 9px; }

/* Nhãn "Đang chọn: ..." cạnh tiêu đề bảng */
.k-selected-pill {
  display: none;
  align-items: center;
  gap: 6px;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  min-width: 0;
  max-width: 260px;
  overflow: hidden;
}

.k-selected-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dòng bảng có thể bấm chọn (thao tác qua thanh công cụ phía trên) */
.k-table tr[data-item] {
  cursor: pointer;
}

/* Ô bảng chỉ 1 dòng, dài quá thì cắt "…" (rê chuột xem đầy đủ) */
.k-table .cell-1line {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.k-table tr.k-row-selected td {
  background-color: #eff6ff !important;
}

.k-table tr.k-row-selected {
  outline: 1.5px solid #93c5fd;
  outline-offset: -1.5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-pdf { background: #fee2e2; color: #dc2626; }
.badge-word { background: #eff6ff; color: #2563eb; }
.badge-excel { background: #f0fdf4; color: #16a34a; }
.badge-ppt { background: #fff7ed; color: #ea580c; }
.badge-image { background: #f0f9ff; color: #0284c7; }
.badge-zip { background: #fef3c7; color: #d97706; }
.badge-dept { background: #e0f2fe; color: #0369a1; white-space: normal; }
.badge-role-admin { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-role-editor { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-role-user { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* Filter Bar */
.filter-bar {
  background: #ffffff;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.filter-input {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.filter-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(7, 81, 163, 0.15);
}

/* Bộ lọc gọn trên 1 dòng: các ô co lại theo bề rộng, không xuống dòng */
.filter-bar.k-filter-row {
  padding: 10px 14px;
}

.k-filter-row form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  width: 100%;
  min-width: 0;
}

.k-filter-row .filter-input {
  padding: 6px 8px;
  font-size: 12.5px;
  min-width: 0;
  height: 32px;
  text-overflow: ellipsis;
}

.k-filter-row .f-search { flex: 1 1 200px; min-width: 110px; }
.k-filter-row .f-dept { flex: 0 1 165px; }
.k-filter-row .f-type { flex: 0 1 175px; }
.k-filter-row .f-year { flex: 0 0 100px; }
.k-filter-row .f-validity { flex: 0 1 125px; }

.k-filter-row .f-dates {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 1 auto;
  min-width: 0;
  height: 32px;
  padding: 0 6px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
}

.k-filter-row .f-dates .filter-input {
  border: none;
  box-shadow: none;
  padding: 2px 2px;
  height: 28px;
  width: 118px;
  font-size: 12px;
}

.k-filter-row .btn {
  flex-shrink: 0;
  height: 32px;
  white-space: nowrap;
}

/* ==========================================================================
   MODAL DIALOGS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 650px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  animation: modalFadeIn 0.2s ease-out;
}

.modal-card.wide {
  max-width: 950px;
  height: 90vh;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover {
  color: var(--danger-color);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #f8fafc;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group label span.required {
  color: var(--danger-color);
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(7, 81, 163, 0.15);
}

/* ==========================================================================
   LOGIN PAGE (THEO ĐÚNG TONE ẢNH VÀ THƯƠNG HIỆU VKS)
   ========================================================================== */
.login-wrapper {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(135deg, #0751a3 0%, #0d3d75 100%);
}

.login-left-banner {
  flex: 1.2;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  color: #ffffff;
  background: url('/static/images/vks_bg_banner.png') center/cover no-repeat;
  background-blend-mode: overlay;
  background-color: rgba(7, 81, 163, 0.75);
}

.login-left-banner::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle, rgba(13, 61, 117, 0.4) 0%, rgba(7, 81, 163, 0.85) 100%);
  pointer-events: none;
}

.login-banner-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 600px;
}

.login-emblem-large {
  width: 130px;
  height: 130px;
  margin-bottom: 24px;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.3));
}

.login-system-title {
  color: var(--gold-color);
  font-size: 22px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.login-unit-title {
  color: #ffffff;
  font-size: 24px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 30px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.login-qr-row {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 20px;
}

.login-qr-box {
  background: rgba(255, 255, 255, 0.95);
  padding: 12px;
  border-radius: var(--radius-md);
  text-align: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.login-qr-box img {
  width: 90px;
  height: 90px;
  display: block;
}

.login-qr-box span {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-top: 6px;
  display: block;
}

.login-right-card {
  flex: 0.9;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  box-shadow: -5px 0 25px rgba(0,0,0,0.15);
  position: relative;
}

.login-card-inner {
  width: 100%;
  max-width: 380px;
}

.login-card-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-card-header img {
  width: 72px;
  height: 72px;
  margin-bottom: 12px;
}

.login-card-header h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--primary-dark);
}

.login-card-header p {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.login-input-group {
  position: relative;
  margin-bottom: 16px;
}

.login-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 15px;
}

.login-input {
  width: 100%;
  padding: 11px 14px 11px 38px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  transition: var(--transition);
}

.login-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(7, 81, 163, 0.15);
  outline: none;
}

.captcha-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.captcha-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 5px;
  color: #dc2626;
  user-select: none;
  cursor: pointer;
}

.btn-login {
  width: 100%;
  padding: 12px;
  background: var(--primary-color);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 8px;
}

.btn-login:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(7, 81, 163, 0.3);
}

.btn-sso {
  width: 100%;
  padding: 10px;
  background: #0f3764;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 10px;
  transition: var(--transition);
}

.btn-sso:hover {
  background: #0a2544;
}

.sso-badge-footer {
  margin-top: 24px;
  text-align: center;
}

.sso-badge-footer img {
  height: 48px;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
}

.page-btn {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  background: #fff;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 500;
}

.page-btn.active {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

.page-btn:hover:not(.active) {
  background: #f1f5f9;
}

/* ==========================================================================
   HƯỚNG DẪN SỬ DỤNG DẠNG SÁCH MANUAL (kGuide Documentation Layout)
   ========================================================================== */
.manual-wrapper {
  --manual-head-h: 88px; /* Chiều cao chung: thanh tiêu đề nội dung = header mục lục */
  display: flex;
  gap: 24px;
  align-items: flex-start;
  position: relative;
  width: 100%;
}

/* Vừa 1 màn hình: nội dung & mục lục cuộn riêng, header của cả hai cố định */
.content-fit > .manual-wrapper {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}

.content-fit .manual-sidebar {
  position: static;
  max-height: none;
}

/* --------------------------------------------------------------------------
   CỘT PHẢI NGOÀI CÙNG: MỤC LỤC SÁCH (MANUAL SIDEBAR / TABLE OF CONTENTS)
   -------------------------------------------------------------------------- */
.manual-sidebar {
  width: 320px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  max-height: calc(100vh - var(--header-height) - var(--footer-height) - 48px);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

.manual-sidebar-header,
.manual-reader-header {
  height: var(--manual-head-h);
  flex-shrink: 0;
  padding: 0 18px;
  background: linear-gradient(135deg, #072b5c 0%, #0751a3 100%);
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}

/* Thanh tiêu đề cố định của cột nội dung: hiển thị chương đang đọc */
.manual-reader-header,
.manual-sidebar-header {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.manual-reader-header {
  padding: 0 22px;
}

.manual-reader-info,
.manual-sidebar-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.manual-reader-info .manual-sidebar-title,
.manual-sidebar-info .manual-sidebar-title {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.manual-reader-info .manual-sidebar-subtitle,
.manual-sidebar-info .manual-sidebar-subtitle {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Nút biểu tượng (In / Đến Kho) trên header mục lục */
.manual-sidebar-header .manual-header-actions {
  gap: 6px;
  align-self: flex-start;
  margin-top: 14px;
}

.manual-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: var(--transition);
}

.manual-icon-btn.primary {
  background: #ffd200;
  color: #072b5c;
}

.manual-icon-btn.primary:hover {
  background: #ffdb33;
  transform: translateY(-1px);
}

.manual-icon-btn.secondary {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

.manual-icon-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.manual-reader-info.is-changing {
  animation: readerSwap 0.25s ease;
}

@keyframes readerSwap {
  from { opacity: 0.2; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Vùng đọc nội dung: cuộn riêng bên dưới thanh tiêu đề */
.manual-reader-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scrollbar-width: thin;
}

.manual-sidebar-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.15);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffd200;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.manual-sidebar-title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.manual-sidebar-subtitle {
  font-size: 11.5px;
  color: #cbd5e1;
  margin-top: 2px;
}

/* Ô tìm kiếm nhanh trong sách */
.manual-search-box {
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.manual-search-input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  background: #ffffff;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

.manual-search-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(7, 81, 163, 0.15);
}

.manual-search-icon {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 12.5px;
  pointer-events: none;
}

/* Danh sách cây mục lục */
.manual-toc-nav {
  padding: 12px 10px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
}

.manual-toc-group {
  margin-bottom: 14px;
}

.manual-toc-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.6px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.manual-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.manual-toc-item {
  margin-bottom: 2px;
}

.manual-toc-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.18s ease;
  border-left: 3px solid transparent;
  line-height: 1.35;
}

.manual-toc-link:hover {
  background: #f1f5f9;
  color: var(--primary-color);
  padding-left: 12px;
}

.manual-toc-link.active {
  background: #e8f1fb;
  color: var(--primary-color);
  font-weight: 700;
  border-left-color: var(--primary-color);
  padding-left: 12px;
}

.manual-toc-link i {
  font-size: 13px;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  color: #94a3b8;
}

.manual-toc-link.active i {
  color: var(--primary-color);
}

/* Footer chân mục lục */
.manual-sidebar-footer {
  padding: 10px 14px;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manual-reading-progress-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #64748b;
}

.manual-reading-progress-bar {
  width: 100%;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.manual-reading-progress-fill {
  height: 100%;
  background: var(--primary-color);
  width: 0%;
  transition: width 0.15s ease;
}

.manual-print-btn {
  width: 100%;
  padding: 7px 12px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

.manual-print-btn:hover {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
}

/* --------------------------------------------------------------------------
   CỘT TRÁI (CHÍNH): NỘI DUNG SÁCH MANUAL (CONTENT PANE)
   -------------------------------------------------------------------------- */
.manual-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Khung 1 màn hình: cột nội dung là 1 thẻ gồm thanh tiêu đề + vùng đọc */
.content-fit .manual-content {
  gap: 0;
  background: rgba(241, 245, 249, 0.92);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* Header trang bìa sách (gọn, chiều cao vừa phải) */
.manual-book-header {
  background: linear-gradient(135deg, #072b5c 0%, #0751a3 75%, #0d6efd 100%);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 18px 24px;
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(7, 43, 92, 0.18);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.manual-book-header::after {
  content: "";
  position: absolute;
  top: -30px;
  right: -30px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(255, 210, 0, 0.2) 0%, rgba(255, 255, 255, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.manual-book-info {
  flex: 1;
  z-index: 1;
}

.manual-agency-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffd200;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.manual-book-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
  line-height: 1.35;
  color: #ffffff;
}

.manual-book-desc {
  font-size: 13.5px;
  color: #e2e8f0;
  line-height: 1.5;
  max-width: 650px;
}

.manual-book-meta {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 12px;
  color: #cbd5e1;
}

.manual-book-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.manual-header-actions {
  display: flex;
  gap: 10px;
  z-index: 1;
  flex-shrink: 0;
}

.manual-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.manual-header-btn.primary {
  background: #ffd200;
  color: #072b5c;
}

.manual-header-btn.primary:hover {
  background: #ffdb33;
  transform: translateY(-1px);
}

.manual-header-btn.secondary {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.manual-header-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.26);
}

/* Từng Chương Sách (Manual Chapter Card) */
.manual-chapter {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
  position: relative;
  scroll-margin-top: 18px;
  flex-shrink: 0;
}

.manual-chapter-header {
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 14px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.manual-chapter-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.manual-chapter-num {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary-color);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.manual-chapter-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0;
  line-height: 1.35;
}

.manual-chapter-badge {
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
}

.manual-chapter-body {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.manual-chapter-body p {
  margin-bottom: 12px;
}

/* Card 3 Cấp Quyền trong Sách */
.guide-role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.guide-role-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 18px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.guide-role-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.guide-role-card.role-admin { border-top: 4px solid #b91c1c; }
.guide-role-card.role-editor { border-top: 4px solid var(--primary-color); }
.guide-role-card.role-user { border-top: 4px solid #10b981; }

.guide-role-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.guide-role-icon {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.role-admin .guide-role-icon { background: #fee2e2; color: #b91c1c; }
.role-editor .guide-role-icon { background: #e0f2fe; color: var(--primary-color); }
.role-user .guide-role-icon { background: #dcfce7; color: #10b981; }

.guide-role-info h4 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.guide-role-info span {
  font-size: 11px;
  color: var(--text-muted);
}

.guide-role-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.guide-role-list li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 6px;
}

.guide-role-list li::before {
  content: "✔";
  position: absolute;
  left: 0;
  color: #10b981;
  font-weight: bold;
}

.guide-role-list li.forbidden::before {
  content: "✖";
  color: #ef4444;
}

/* Thẻ các bước thao tác (Step Flow) */
.guide-step-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 14px 0;
}

.guide-step-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 16px 14px;
  transition: var(--transition);
}

.guide-step-card:hover {
  background: #ffffff;
  border-color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.guide-step-num {
  width: 28px;
  height: 28px;
  background: var(--primary-color);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 10px;
}

.guide-step-card h4 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

.guide-step-card p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* Khung Chú Ý / Callout */
.guide-callout {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: 14px 0;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 12.5px;
  line-height: 1.5;
}

.guide-callout.info {
  background: #e0f2fe;
  border-left: 4px solid #0284c7;
  color: #0369a1;
}

.guide-callout.warning {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  color: #b45309;
}

.guide-callout.danger {
  background: #fee2e2;
  border-left: 4px solid #ef4444;
  color: #b91c1c;
}

.guide-callout i {
  font-size: 16px;
  margin-top: 2px;
  flex-shrink: 0;
}

/* FAQ Accordion */
.guide-faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.guide-faq-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #ffffff;
}

.guide-faq-question {
  padding: 12px 16px;
  background: #f8fafc;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  user-select: none;
  transition: var(--transition);
}

.guide-faq-question:hover {
  background: #f1f5f9;
  color: var(--primary-color);
}

.guide-faq-question i.faq-icon {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.25s ease;
}

.guide-faq-item.active .guide-faq-question i.faq-icon {
  transform: rotate(180deg);
  color: var(--primary-color);
}

.guide-faq-answer {
  padding: 0 16px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease;
  background: #ffffff;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.guide-faq-item.active .guide-faq-answer {
  padding: 12px 16px;
  max-height: 380px;
  border-top: 1px solid #f1f5f9;
}

/* Nút lật chương trước / sau (Book Pagination) */
.manual-chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
}

.manual-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}

.manual-nav-btn:hover {
  background: var(--primary-light);
  color: var(--primary-color);
  border-color: var(--primary-color);
}

/* --------------------------------------------------------------------------
   RESPONSIVE CHO MANUAL LAYOUT
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  .card-grid-row {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .manual-wrapper {
    flex-direction: column;
  }
  .content-fit .manual-content {
    flex: 1 1 auto;
    min-height: 0;
  }
  .manual-sidebar {
    width: 100%;
    position: static;
    max-height: none;
  }
  .manual-toc-nav {
    max-height: 260px;
  }
}

/* --------------------------------------------------------------------------
   PRINT STYLING CHO MANUAL (IN SÁCH HƯỚNG DẪN)
   -------------------------------------------------------------------------- */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .sidebar,
  .top-header,
  .manual-sidebar,
  .manual-header-actions,
  .manual-chapter-nav,
  .sidebar-footer,
  #sidebar-logout-btn,
  .main-footer,
  .manual-reader-header,
  .app-container::before {
    display: none !important;
  }
  .content-body.content-fit,
  .manual-content,
  .manual-reader-body {
    display: block !important;
    overflow: visible !important;
    height: auto !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }
  .content-body {
    padding: 0 !important;
    overflow: visible !important;
  }
  .manual-wrapper {
    display: block !important;
  }
  .manual-content {
    width: 100% !important;
  }
  .manual-book-header {
    background: none !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
    box-shadow: none !important;
    padding: 16px !important;
  }
  .manual-book-title {
    color: #000000 !important;
  }
  .manual-book-desc {
    color: #333333 !important;
  }
  .manual-chapter {
    border: 1px solid #cccccc !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-bottom: 24px !important;
  }
  .manual-faq-answer {
    max-height: none !important;
    padding: 10px 0 !important;
    display: block !important;
  }
}


/* ==========================================================================
   TOASTIFY NOTIFICATIONS & MODERN CONFIRMATION SYSTEM
   ========================================================================== */
.toastify {
  padding: 13px 20px !important;
  color: #ffffff !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 12px !important;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.45), 0 4px 12px -2px rgba(0, 0, 0, 0.25) !important;
  border-radius: 12px !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  line-height: 1.45 !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  z-index: 2147483647 !important;
  max-width: 480px !important;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toastify-icon {
  font-size: 19px !important;
  flex-shrink: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.toastify-text {
  flex: 1 !important;
  color: #ffffff !important;
}

.toast-close {
  opacity: 0.65 !important;
  padding: 0 0 0 12px !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  color: #ffffff !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  transition: opacity 0.2s ease, transform 0.2s ease !important;
}

.toast-close:hover {
  opacity: 1 !important;
  transform: scale(1.15) !important;
}

/* ==========================================================================
   TOASTIFY CONFIRM DIALOG MODAL / OVERLAY (THAY THẾ HOÀN TOÀN WINDOW.CONFIRM)
   ========================================================================== */
.k-confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(8, 21, 43, 0.68);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 99999999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 65px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
}

.k-confirm-overlay.active {
  opacity: 1;
  visibility: visible;
}

.k-confirm-box {
  background: linear-gradient(150deg, #0d2247 0%, #06152b 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  width: 90%;
  max-width: 440px;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.75),
              0 0 35px rgba(7, 81, 163, 0.35);
  padding: 24px;
  transform: translateY(-28px) scale(0.94);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.k-confirm-overlay.active .k-confirm-box {
  transform: translateY(0) scale(1);
}

/* Subtle top glow line */
.k-confirm-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.k-confirm-box.type-warning::before {
  background: linear-gradient(90deg, #f59e0b, #ffd200);
}

.k-confirm-box.type-danger::before {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.k-confirm-box.type-info::before {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
}

.k-confirm-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.k-confirm-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  flex-shrink: 0;
}

.type-warning .k-confirm-icon-wrap {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.32);
}

.type-danger .k-confirm-icon-wrap {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.32);
}

.type-info .k-confirm-icon-wrap {
  background: rgba(2, 132, 199, 0.16);
  color: #38bdf8;
  border: 1px solid rgba(2, 132, 199, 0.32);
}

.k-confirm-title {
  font-size: 17.5px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.3px;
}

.k-confirm-body {
  font-size: 14px;
  color: #cbd5e1;
  line-height: 1.55;
  margin-bottom: 22px;
  padding-left: 2px;
}

.k-confirm-body strong {
  color: #ffffff;
}

.k-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.k-confirm-btn {
  padding: 9.5px 20px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.k-confirm-btn-cancel {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.k-confirm-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  transform: translateY(-1px);
}

.k-confirm-btn-confirm {
  color: #ffffff;
}

.type-warning .k-confirm-btn-confirm {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.type-warning .k-confirm-btn-confirm:hover {
  background: linear-gradient(135deg, #b45309 0%, #d97706 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.5);
}

.type-danger .k-confirm-btn-confirm {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.type-danger .k-confirm-btn-confirm:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.5);
}

.type-info .k-confirm-btn-confirm {
  background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.type-info .k-confirm-btn-confirm:hover {
  background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.5);
}


/* ==========================================================================
   COMPATIBILITY ALIASES (SIDEBAR & TOPBAR FALLBACK)
   ========================================================================== */
.sidebar-menu {
  list-style: none;
  padding: 10px 8px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-menu .menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.sidebar-menu .menu-item:hover {
  background: rgba(255,255,255,0.1);
  color: #ffffff;
}
.sidebar-menu .menu-item.active {
  background: linear-gradient(90deg, #0751a3, #0284c7);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}
.sidebar-menu .menu-item i {
  width: 20px;
  text-align: center;
}

.topbar {
  height: var(--header-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
