html {
  font-size: 16px;
}

body.epr-shell {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--epr-font-sans);
  font-size: var(--epr-body-size);
  line-height: var(--epr-body-line-height);
  background: var(--epr-page-bg);
  color: var(--epr-text-primary);
}

.epr-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--epr-surface);
  color: var(--epr-text-primary);
  padding: 0 var(--epr-space-4);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: var(--epr-space-3);
  height: var(--epr-topbar-height);
  border-bottom: 1px solid var(--epr-border);
  box-shadow: var(--epr-shadow-sm);
}

.epr-topbar-left {
  display: flex;
  align-items: center;
  gap: var(--epr-space-3);
  min-width: 0;
  flex-shrink: 0;
}

.epr-topbar-menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--epr-radius-sm);
  background: transparent;
  color: var(--epr-text-secondary);
  cursor: pointer;
}

.epr-topbar-menu:hover {
  background: var(--epr-surface-muted);
}

.epr-topbar-menu:focus-visible {
  outline: var(--epr-focus-ring-width) solid var(--epr-focus-ring-color);
  outline-offset: var(--epr-focus-ring-offset);
}

.epr-topbar-menu-bars,
.epr-topbar-menu-bars::before,
.epr-topbar-menu-bars::after {
  display: block;
  width: 1.125rem;
  height: 2px;
  border-radius: var(--epr-radius-pill);
  background: currentColor;
}

.epr-topbar-menu-bars {
  position: relative;
}

.epr-topbar-menu-bars::before,
.epr-topbar-menu-bars::after {
  position: absolute;
  left: 0;
  content: "";
}

.epr-topbar-menu-bars::before {
  top: -0.375rem;
}

.epr-topbar-menu-bars::after {
  top: 0.375rem;
}

.epr-topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--epr-space-2);
  min-width: 0;
  color: var(--epr-brand-700);
  font-family: var(--epr-font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.epr-topbar-brand:hover {
  color: var(--epr-brand-600);
}

.epr-topbar-brand:hover .epr-topbar-brand-suffix {
  color: var(--epr-neutral-500);
}

.epr-topbar-brand-logo {
  display: block;
  height: 1.75rem;
  width: auto;
  max-width: 6.5rem;
  object-fit: contain;
  flex-shrink: 0;
}

.epr-topbar-brand-suffix {
  color: var(--epr-neutral-500);
  font-size: var(--epr-font-size-sm);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.epr-topbar-title {
  color: var(--epr-neutral-500);
  font-size: var(--epr-font-size-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Chuyển ngữ — dropdown compact (Translation:ConfiguredLanguages) */
.epr-lang-switcher {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.epr-lang-switcher-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 1.75rem;
  padding: 0.1rem 0.45rem 0.1rem 0.55rem;
  border: 1px solid var(--epr-border);
  border-radius: var(--epr-radius-sm);
  background: var(--epr-surface);
  font-size: 0.6875rem;
  font-weight: var(--epr-font-weight-semibold);
  line-height: 1.15;
  letter-spacing: 0.04em;
  color: var(--epr-neutral-700);
  box-shadow: none;
}

.epr-lang-switcher-btn:hover,
.epr-lang-switcher-btn:focus,
.epr-lang-switcher-btn.show {
  color: var(--epr-text-primary);
  background: var(--epr-neutral-100);
  border-color: var(--epr-neutral-300);
}

.epr-lang-switcher-btn.is-loading,
.epr-lang-switcher-btn:disabled {
  opacity: 0.72;
  cursor: wait;
  pointer-events: none;
}

.epr-lang-switcher-btn::after {
  margin-left: 0.1rem;
  vertical-align: middle;
  border-top-width: 0.28em;
  border-right-width: 0.28em;
  border-left-width: 0.28em;
}

.epr-lang-switcher-current {
  min-width: 1.35rem;
  text-align: center;
}

.epr-lang-switcher-menu {
  min-width: 4.75rem;
  padding: 0.2rem;
  margin-top: 0.25rem !important;
  border-color: var(--epr-border);
}

.epr-lang-switcher-item {
  padding: 0.3rem 0.55rem;
  font-size: 0.75rem;
  font-weight: var(--epr-font-weight-semibold);
  letter-spacing: 0.03em;
  border-radius: var(--epr-radius-sm);
}

.epr-lang-switcher-item.active,
.epr-lang-switcher-item:active {
  color: var(--grac-green-800);
  background: var(--grac-green-50);
}

.epr-lang-switcher--login .epr-lang-switcher-btn {
  min-height: 2rem;
  padding: 0.35rem 0.65rem 0.35rem 0.75rem;
  font-size: 0.8125rem;
  border-color: #e2e5e9;
  border-radius: 0.5rem;
  background: #fff;
}

.epr-lang-switcher--login .epr-lang-switcher-menu {
  min-width: 7rem;
}

.epr-lang-switcher--login .epr-lang-switcher-item {
  font-size: 0.8125rem;
  padding: 0.4rem 0.65rem;
}

.epr-topbar-user {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 18rem;
  min-height: 2rem;
  padding: 0.1rem 0.45rem 0.1rem 0.2rem;
  border: 1px solid var(--epr-border);
  border-radius: var(--epr-radius-pill);
  background: var(--epr-surface);
  color: var(--epr-neutral-900);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease;
}

.epr-topbar-user:hover,
.epr-notify-btn:hover {
  background: var(--epr-neutral-100);
}

.epr-topbar-user:focus-visible {
  outline: var(--epr-focus-ring-width) solid var(--epr-focus-ring-color);
  outline-offset: var(--epr-focus-ring-offset);
}

.epr-topbar-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.625rem;
  height: 1.625rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--grac-green-500), var(--grac-green-700));
  color: #fff;
  font-size: 0.6875rem;
  font-weight: var(--epr-font-weight-semibold);
  line-height: 1;
}

.epr-topbar-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--epr-text-primary);
  font-weight: 600;
}

.epr-topbar-user-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 0.1rem;
  color: var(--epr-neutral-500);
}

.epr-topbar-user-chevron .epr-nav-ic {
  width: 0.8125rem;
  height: 0.8125rem;
}

.epr-topbar-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: var(--epr-space-3);
  min-width: 0;
  margin-left: auto;
  flex: 0 1 auto;
}

/* Cụm icon + user + ngôn ngữ — khoảng cách đồng đều như mockup */
.epr-topbar-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--epr-space-3);
  flex-shrink: 0;
}

.epr-topbar-tools .epr-topbar-user-dropdown {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.epr-topbar-user-menu {
  position: relative;
  padding: 0.35rem;
  min-width: 12rem;
  margin-top: 0.35rem;
}

.epr-topbar-user-menu::before {
  content: "";
  position: absolute;
  top: -0.36rem;
  right: 1.1rem;
  width: 0.7rem;
  height: 0.7rem;
  background: var(--epr-surface);
  border-top: 1px solid var(--epr-border);
  border-left: 1px solid var(--epr-border);
  transform: rotate(45deg);
  z-index: 1;
}

.epr-topbar-user-menu .dropdown-divider {
  margin: 0.25rem 0;
}

.epr-topbar-user-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.125rem 0;
  border-radius: var(--epr-radius-md);
  padding: 0.5rem 0.65rem;
  min-height: 2rem;
  line-height: 1.25;
  transition: color 0.12s ease, background-color 0.12s ease;
}

.epr-topbar-user-menu-item:hover,
.epr-topbar-user-menu-item:focus {
  color: var(--epr-brand-700) !important;
}

.epr-topbar-user-menu-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  flex: 0 0 1rem;
  color: var(--epr-neutral-600);
}

.epr-topbar-user-menu-item:hover .epr-topbar-user-menu-item-icon,
.epr-topbar-user-menu-item:focus .epr-topbar-user-menu-item-icon {
  color: var(--epr-brand-700);
}

/* Chip bối cảnh: nền trắng, viền xám nhạt (mockup / ảnh tham chiếu) */
.epr-topbar-context-pill {
  display: inline-flex;
  align-items: center;
  max-width: min(42rem, 52vw);
  min-height: 2rem;
  padding: 0.1rem 0.65rem;
  border-radius: var(--epr-radius-pill);
  border: 1px solid var(--epr-border);
  background: var(--epr-surface);
  color: var(--epr-neutral-700);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease;
}

.epr-topbar-context-pill:hover {
  background: var(--epr-neutral-100);
  border-color: color-mix(in srgb, var(--epr-border) 70%, var(--epr-neutral-400));
  color: var(--epr-text-primary);
}

.epr-topbar-context-pill:focus-visible {
  outline: var(--epr-focus-ring-width) solid var(--epr-focus-ring-color);
  outline-offset: var(--epr-focus-ring-offset);
}

.epr-topbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--epr-radius-sm);
  background: transparent;
  color: var(--epr-text-secondary);
  cursor: pointer;
  transition: background-color 0.12s ease, opacity 0.12s ease;
}

.epr-topbar-icon-btn:hover:not(:disabled) {
  background: var(--epr-surface-muted);
  color: var(--epr-text-primary);
}

.epr-topbar-icon-btn:disabled {
  cursor: default;
  opacity: 0.9;
}

.epr-topbar-icon-btn__ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.epr-topbar-icon-btn__ic .epr-nav-ic {
  width: 1.2rem;
  height: 1.2rem;
}

.epr-topbar-icon-btn:focus-visible {
  outline: var(--epr-focus-ring-width) solid var(--epr-focus-ring-color);
  outline-offset: var(--epr-focus-ring-offset);
}

/* (legacy) liên kết context dạng viền — giữ để trang cũ không vỡ layout */
.epr-topbar-context-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0 var(--epr-space-4);
  border: 1px solid var(--grac-green-600);
  border-radius: var(--epr-radius-pill);
  color: var(--grac-green-800);
  font-weight: var(--epr-font-weight-semibold);
  font-size: var(--epr-font-size-sm);
  text-decoration: none;
  background: var(--epr-surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transition:
    color 0.12s ease,
    background-color 0.12s ease,
    border-color 0.12s ease;
}

.epr-topbar-context-link:hover {
  background: var(--grac-green-25);
  border-color: var(--grac-green-700);
  color: var(--grac-green-900);
}

.epr-topbar-context-link:focus-visible {
  outline: var(--epr-focus-ring-width) solid var(--epr-focus-ring-color);
  outline-offset: var(--epr-focus-ring-offset);
}

.epr-notify-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--epr-radius-sm);
  background: transparent;
  color: var(--epr-text-secondary);
  cursor: pointer;
}

.epr-notify-btn__ic {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  color: inherit;
}

.epr-notify-btn__ic .epr-nav-ic {
  width: 1.28rem;
  height: 1.28rem;
}

.epr-notify-badge {
  position: absolute;
  top: 0.12rem;
  right: 0.12rem;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.28rem;
  border-radius: var(--epr-radius-pill);
  background: #e53935;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1.125rem;
  text-align: center;
  box-shadow: 0 0 0 1.5px var(--epr-surface);
}

.epr-notify-badge[hidden] {
  display: none !important;
}

.epr-shell-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.epr-sidebar {
  flex: 0 0 var(--epr-sidebar-width);
  width: var(--epr-sidebar-width);
  min-width: var(--epr-sidebar-width);
  max-width: var(--epr-sidebar-width);
  min-height: calc(100vh - var(--epr-topbar-height));
  background: var(--epr-surface);
  border-right: var(--epr-border-width) solid var(--epr-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition:
    flex-basis 180ms ease,
    width 180ms ease,
    min-width 180ms ease,
    max-width 180ms ease;
}

.epr-sidebar.is-collapsed {
  flex-basis: var(--epr-sidebar-collapsed);
  width: var(--epr-sidebar-collapsed);
  min-width: var(--epr-sidebar-collapsed);
  max-width: var(--epr-sidebar-collapsed);
}

.epr-sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-left: var(--epr-space-3);
  padding-right: var(--epr-space-3);
}

.epr-nav-section {
  margin-bottom: var(--epr-space-3);
}

.epr-menu-section {
  color: var(--epr-text-muted);
  font-size: var(--epr-label-size);
  font-weight: var(--epr-label-weight);
  padding: var(--epr-space-3) var(--epr-space-2) var(--epr-space-1);
  letter-spacing: 0.04em;
}

.epr-menu-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--epr-space-2);
  width: 100%;
  margin: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  border-radius: var(--epr-radius-md);
  transition: background-color 120ms ease, color 120ms ease;
}

.epr-menu-section-toggle:hover {
  background: var(--epr-surface-muted);
  color: var(--epr-brand-600);
}

.epr-menu-section-toggle .epr-menu-section-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.epr-menu-section-chevron {
  flex: 0 0 0.75rem;
  width: 0.75rem;
  height: 0.75rem;
  position: relative;
  opacity: 0.55;
}

.epr-menu-section-chevron::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.35rem;
  height: 0.35rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translate(-50%, -65%) rotate(45deg);
  transition: transform 160ms ease;
}

.epr-nav-section.is-section-collapsed .epr-menu-section-chevron::before {
  transform: translate(-65%, -50%) rotate(-45deg);
}

.epr-nav-section-items {
  overflow: hidden;
  max-height: 1200px;
  opacity: 1;
  transition:
    max-height 220ms ease,
    opacity 160ms ease;
}

.epr-nav-section.is-section-collapsed .epr-nav-section-items {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.epr-sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--epr-space-3);
  width: 100%;
  padding: var(--epr-space-2) var(--epr-space-2);
  border-radius: var(--epr-radius-md);
  color: var(--epr-text-secondary);
  text-decoration: none;
  font-size: var(--epr-font-size-sm);
  line-height: 1.35;
  margin-bottom: 2px;
  overflow-wrap: normal;
  word-break: normal;
  border-left: var(--epr-border-width-emphasis) solid transparent;
  transition:
    background-color 120ms ease,
    color 120ms ease,
    padding 180ms ease;
}

.epr-sidebar-link:hover {
  background: var(--epr-surface-muted);
  color: var(--epr-brand-600);
}

.epr-sidebar-link.is-active {
  background: var(--epr-sidebar-active-bg);
  border-left: var(--epr-border-width-emphasis) solid var(--epr-sidebar-active-border);
  color: var(--epr-brand-700);
  font-weight: var(--epr-font-weight-semibold);
  padding-left: calc(var(--epr-space-2) - var(--epr-border-width-emphasis));
}

.epr-sidebar-link.is-icon-muted:not(.is-active) {
  color: var(--epr-text-muted);
}

.epr-sidebar-link.is-icon-muted:not(.is-active) .epr-nav-ic-wrap {
  opacity: 0.55;
}

.epr-nav-ic-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 var(--epr-icon-sidebar);
  width: var(--epr-icon-sidebar);
  height: var(--epr-icon-sidebar);
  color: currentColor;
}

.epr-nav-ic {
  display: block;
  width: var(--epr-icon-sidebar);
  height: var(--epr-icon-sidebar);
  flex-shrink: 0;
}

/* Font Awesome fallback (MenuIconRenderer — icon chưa có SVG nội bộ) */
.epr-nav-ic-fa {
  display: block;
  width: var(--epr-icon-sidebar);
  font-size: var(--epr-icon-sidebar);
  line-height: 1;
  text-align: center;
}

.epr-sidebar.is-collapsed .epr-sidebar-nav {
  padding-left: var(--epr-space-2);
  padding-right: var(--epr-space-2);
}

.epr-sidebar.is-collapsed .epr-menu-section {
  display: flex;
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.epr-sidebar.is-collapsed .epr-menu-section-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.epr-sidebar.is-collapsed .epr-menu-section::after {
  width: 1.75rem;
  height: 1px;
  background: var(--epr-border);
  content: "";
}

.epr-sidebar.is-collapsed .epr-menu-section-toggle {
  display: none;
}

.epr-sidebar.is-collapsed .epr-nav-section.is-section-collapsed .epr-nav-section-items {
  max-height: none;
  opacity: 1;
  pointer-events: auto;
}

.epr-sidebar.is-collapsed .epr-sidebar-link {
  justify-content: center;
  gap: 0;
  padding-left: var(--epr-space-2);
  padding-right: var(--epr-space-2);
  border-left-color: transparent;
}

.epr-sidebar.is-collapsed .epr-sidebar-link.is-active {
  box-shadow: inset 3px 0 0 var(--epr-sidebar-active-border);
}

.epr-sidebar.is-collapsed .epr-sidebar-link-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.epr-main {
  flex: 1 1 auto;
  background: var(--epr-page-bg);
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  position: relative;
}

/* Trang danh sách master: main là cột flex, bảng giãn theo chiều cao còn lại và cuộn nội bộ */
.epr-main:has(.epr-template--master-list) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.epr-main:has(.epr-template--master-list)>.epr-main-inner {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.epr-main:has(.epr-template--master-list) .epr-main-inner>.epr-dashboard-surface.epr-layout-surface--master-list-page {
  flex: 1 1 auto;
  min-height: 0;
}

/* Trang chi tiết master: breadcrumb + hero cố định — chỉ vùng nội dung cuộn (không dùng sticky) */
.epr-main:has(.epr-template--detail) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.epr-main:has(.epr-template--detail)>.epr-main-inner {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.epr-main:has(.epr-template--detail) .epr-main-inner>.epr-dashboard-surface.epr-layout-surface--master-detail-page {
  flex: 1 1 auto;
  min-height: 0;
}

.epr-main-inner {
  background: transparent;
  padding: var(--epr-density-page-pad-y) var(--epr-density-page-pad-x) !important;
}

/* Trang master list: canh sát mép main hơn (prototype — ít hở top / trái / phải) */
.epr-main-inner:has(.epr-template--master-list) {
  padding-top: var(--epr-space-1) !important;
  padding-bottom: var(--epr-space-2) !important;
  padding-left: var(--epr-space-1) !important;
  padding-right: var(--epr-space-1) !important;
}

/* Chi tiết master: cùng padding main-inner với danh sách master (space-1 trên/trái/phải, space-2 dưới) */
.epr-main-inner:has(.epr-layout-surface--master-detail-page),
.epr-main-inner:has(.epr-template--detail[data-epr-template="master-detail"]) {
  padding-top: var(--epr-space-1) !important;
  padding-bottom: var(--epr-space-2) !important;
  padding-left: var(--epr-space-1) !important;
  padding-right: var(--epr-space-1) !important;
}

/* Trang chat workspace: full viewport height, scroll nội bộ (sidebar + tin nhắn) */
.epr-main:has(.epr-ai-chat-workspace-page) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.epr-main:has(.epr-ai-chat-workspace-page) > .epr-main-inner {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
}

.epr-main-inner.is-loading {
  opacity: 0.65;
  transition: opacity 120ms ease-in-out;
}

[data-epr-master-list-table-refresh].is-loading {
  opacity: 0.65;
  pointer-events: none;
  transition: opacity 120ms ease-in-out;
}

.epr-route-progress {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: var(--epr-space-2);
  padding: var(--epr-space-2) var(--epr-space-3);
  border: 1px solid var(--epr-border);
  border-radius: var(--epr-radius-md);
  background: var(--epr-surface);
  box-shadow: var(--epr-shadow-md);
  color: var(--epr-text-secondary);
  font-size: var(--epr-font-size-sm);
  transform: translate(-50%, -50%);
}

.card {
  border-color: var(--epr-border);
  border-radius: var(--epr-card-radius);
  box-shadow: var(--epr-card-shadow);
}

.card.shadow-sm {
  box-shadow: var(--epr-card-shadow) !important;
}

.epr-filter-bar.card {
  border: var(--epr-border-width) solid var(--epr-border) !important;
  border-radius: var(--epr-card-radius);
  box-shadow: var(--epr-shadow-md) !important;
}

.card-header {
  background: var(--epr-surface);
  border-bottom-color: var(--epr-border);
  color: var(--epr-text-primary);
  font-size: var(--epr-card-title-size);
  line-height: var(--epr-card-title-line-height);
  font-weight: var(--epr-card-title-weight);
  padding: var(--epr-space-4) var(--epr-space-5);
}

.card-body {
  padding: var(--epr-density-card-pad);
}

.form-label {
  color: var(--epr-text-secondary);
  font-size: var(--epr-label-size);
  line-height: var(--epr-label-line-height);
  font-weight: var(--epr-label-weight);
}

.form-control,
.form-select {
  border-color: var(--epr-border);
  border-radius: var(--epr-radius-lg);
  box-sizing: border-box;
  color: var(--epr-text-primary);
  font-size: var(--epr-body-size);
  line-height: 1.5;
  min-height: var(--epr-form-control-min-height);
  padding-top: var(--epr-form-control-pad-y);
  padding-bottom: var(--epr-form-control-pad-y);
  padding-left: var(--epr-form-control-pad-x);
}

.form-control {
  padding-right: var(--epr-form-control-pad-x);
}

/* Giữ chiều cao giống .form-control; chỉ tăng padding phải cho chevron. */
.form-select:not([multiple]):not([size]),
.form-select[size="1"] {
  padding-right: var(--epr-form-select-pad-end);
  background-position: right var(--epr-form-control-pad-x) center;
}

/* Kích thước nhỏ: không ép min-height chung (pager, filter compact). */
.form-control-sm,
.form-select-sm {
  min-height: 0;
}

.form-control:focus {
  border-color: var(--epr-brand-600);
  outline: 0;
  box-shadow: none;
}

/* Select thường (data-epr-no-select2): viền xanh khi focus, không đổi màu khi hover */
.form-select:not(.select2-hidden-accessible):focus {
  border-color: var(--grac-green-600, #2d9d5c);
  outline: 0;
  box-shadow: none;
}

.table {
  color: var(--epr-text-primary);
  font-size: var(--epr-table-cell-size);
  line-height: var(--epr-table-cell-line-height);
  font-variant-numeric: var(--epr-tabular);
}

.table> :not(caption)>*>* {
  padding: var(--epr-table-cell-pad-y) var(--epr-table-cell-pad-x);
  border-bottom-color: var(--epr-border);
}

.table thead th {
  color: var(--epr-text-muted);
  font-size: var(--epr-table-head-size);
  line-height: var(--epr-type-table-head-lh);
  font-weight: var(--epr-type-table-head-fw);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Tiêu đề cột giữ đúng casing từ wording (vd. Tenant admin) */
.table thead th.epr-table-head--normal-case {
  text-transform: none;
  letter-spacing: 0.02em;
}

.table-hover>tbody>tr:hover>* {
  background-color: var(--grac-green-25);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem var(--epr-brand-500);
}

/*
 * Primary (Thêm / Lưu): Bootstrap 5.1 dist dùng màu xanh dương cố định, không đọc --bs-btn-*.
 * Override đầy đủ theo token GRAC (nền xanh, chữ trắng, bo góc rõ).
 */
.btn-primary {
  color: #fff;
  background-color: var(--grac-green-600);
  border-color: var(--grac-green-600);
  border-radius: var(--epr-radius-md);
}

.btn-primary:hover {
  color: #fff;
  background-color: var(--grac-green-700);
  border-color: var(--grac-green-700);
}

.btn-check:focus+.btn-primary,
.btn-primary:focus {
  color: #fff;
  background-color: var(--grac-green-700);
  border-color: var(--grac-green-700);
  box-shadow: 0 0 0 0.25rem rgba(45, 157, 92, 0.45);
}

.btn-check:checked+.btn-primary,
.btn-check:active+.btn-primary,
.btn-primary:active,
.btn-primary.active,
.show>.btn-primary.dropdown-toggle {
  color: #fff;
  background-color: var(--grac-green-800);
  border-color: var(--grac-green-800);
}

.btn-check:checked+.btn-primary:focus,
.btn-check:active+.btn-primary:focus,
.btn-primary:active:focus,
.btn-primary.active:focus,
.show>.btn-primary.dropdown-toggle:focus {
  box-shadow: 0 0 0 0.25rem rgba(45, 157, 92, 0.45);
}

.btn-primary:disabled,
.btn-primary.disabled {
  color: #fff;
  background-color: var(--grac-green-500);
  border-color: var(--grac-green-500);
}

.btn-outline-primary {
  color: var(--grac-green-700);
  border-color: var(--grac-green-600);
  border-radius: var(--epr-radius-lg);
}

.btn-outline-primary:hover {
  color: #fff;
  background-color: var(--grac-green-600);
  border-color: var(--grac-green-600);
}

.btn-check:focus+.btn-outline-primary,
.btn-outline-primary:focus {
  box-shadow: 0 0 0 0.25rem rgba(45, 157, 92, 0.45);
}

.btn-check:checked+.btn-outline-primary,
.btn-check:active+.btn-outline-primary,
.btn-outline-primary:active,
.btn-outline-primary.active,
.btn-outline-primary.dropdown-toggle.show {
  color: #fff;
  background-color: var(--grac-green-600);
  border-color: var(--grac-green-600);
}

.btn-check:checked+.btn-outline-primary:focus,
.btn-check:active+.btn-outline-primary:focus,
.btn-outline-primary:active:focus,
.btn-outline-primary.active:focus,
.btn-outline-primary.dropdown-toggle.show:focus {
  box-shadow: 0 0 0 0.25rem rgba(45, 157, 92, 0.45);
}

.btn-outline-primary:disabled,
.btn-outline-primary.disabled {
  color: var(--grac-green-600);
  background-color: transparent;
  border-color: var(--grac-green-600);
}

/* Chiều cao nút cỡ nhỏ — compact cho toolbar / bảng */
.epr-shell .btn-sm,
.epr-shell .btn-group-sm>.btn {
  min-height: 32px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
}

/* ---- Skip link (C5): Bootstrap visually-hidden-focusable + vị trí cố định khi focus ---- */
.epr-skip-link {
  z-index: 1080;
}

/* ---- F1: breadcrumb + toolbar chrome ---- */
.epr-breadcrumb-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--epr-space-3);
  min-width: 0;
}

.epr-breadcrumb-toolbar .epr-breadcrumb-bar {
  flex: 1 1 auto;
  min-width: 0;
}

.epr-breadcrumb-toolbar__actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--epr-space-2);
  margin-left: auto;
}

/* —— Master list + chi tiết master data: thanh breadcrumb + toolbar (prototype strip) —— */
.epr-template--master-list .epr-breadcrumb-toolbar--master-list,
.epr-template--detail .epr-breadcrumb-toolbar--detail {
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--epr-space-3);
  /* Đều bốn cạnh — trước 0.35rem dọc / 0.65rem ngang làm lệch góc trên-trái */
  padding: var(--epr-space-1);
  border-radius: var(--epr-radius-sm);
  background: linear-gradient(180deg, #eef1f4 0%, #e4e8ec 100%);
  border: 1px solid color-mix(in srgb, var(--epr-border) 85%, var(--epr-neutral-500));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.epr-template--detail .epr-breadcrumb-toolbar--detail {
  flex-shrink: 0;
  position: relative;
  z-index: 30;
}

.epr-template--detail .epr-breadcrumb-toolbar--detail:has(.epr-breadcrumb-actions-menu.show),
html.epr-breadcrumb-actions-menu-open .epr-template--detail .epr-breadcrumb-toolbar--detail {
  z-index: 1100;
}

@media (max-width: 767.98px) {

  .epr-template--master-list .epr-breadcrumb-toolbar--master-list,
  .epr-template--detail .epr-breadcrumb-toolbar--detail {
    flex-wrap: wrap;
  }
}

.epr-template--master-list .epr-breadcrumb-toolbar--master-list .epr-breadcrumb-bar,
.epr-template--detail .epr-breadcrumb-toolbar--detail .epr-breadcrumb-bar {
  min-width: 0;
}

.epr-template--master-list .epr-breadcrumb-toolbar--master-list .epr-breadcrumb-item+.epr-breadcrumb-item::before,
.epr-template--detail .epr-breadcrumb-toolbar--detail .epr-breadcrumb-item+.epr-breadcrumb-item::before {
  content: " / ";
  color: var(--epr-neutral-500);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.epr-template--master-list .epr-breadcrumb-toolbar--master-list .epr-breadcrumb-link,
.epr-template--master-list .epr-breadcrumb-toolbar--master-list .epr-breadcrumb-current,
.epr-template--detail .epr-breadcrumb-toolbar--detail .epr-breadcrumb-link,
.epr-template--detail .epr-breadcrumb-toolbar--detail .epr-breadcrumb-current {
  color: var(--grac-green-900);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  font-size: 0.625rem;
  line-height: 1.25;
}

.epr-template--master-list .epr-breadcrumb-toolbar--master-list .epr-breadcrumb-link:hover,
.epr-template--detail .epr-breadcrumb-toolbar--detail .epr-breadcrumb-link:hover {
  color: var(--grac-green-800);
  text-decoration: none;
}

.epr-template--master-list .epr-breadcrumb-toolbar__actions {
  gap: 0.5rem;
}

/* Breadcrumb toolbar: nút « Thao tác » + chevron xoay + menu có mũi tên trắng */
@keyframes epr-breadcrumb-actions-menu-in {
  from {
    opacity: 0;
    transform: translateY(-0.35rem) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes epr-breadcrumb-actions-menu-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(-0.25rem) scale(0.98);
  }
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-dropdown__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  font-size: var(--epr-font-size-sm);
  line-height: 1.25;
  white-space: nowrap;
  transition:
    transform 0.14s ease,
    background-color 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-dropdown__toggle:active:not(:disabled) {
  transform: scale(0.97);
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-dropdown__toggle.show,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-dropdown__toggle:hover,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-dropdown__toggle:focus-visible {
  border-color: var(--grac-green-500);
  background: var(--grac-green-50);
  color: var(--grac-green-900);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-dropdown__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.22s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-dropdown__toggle.show .epr-breadcrumb-actions-dropdown__chevron,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-dropdown:has(.epr-breadcrumb-actions-menu.show) .epr-breadcrumb-actions-dropdown__chevron {
  transform: rotate(180deg);
}

/* Vỏ dropdown: để Popper giữ transform — không animation/position:relative ở đây */
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu {
  min-width: 13.5rem;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu.show {
  z-index: 1100;
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-dropdown:has(.epr-breadcrumb-actions-menu.show) {
  z-index: 1100;
}

/* Trang detail cũ bọc nút trong .d-inline-flex — bỏ layout ngang trong menu */
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel>.d-inline-flex {
  display: contents;
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel {
  --epr-breadcrumb-actions-caret-right: 1.15rem;
  --epr-breadcrumb-actions-item-inset: 8px;
  position: relative;
  min-width: 13.5rem;
  padding: 0.4rem var(--epr-breadcrumb-actions-item-inset);
  text-align: left;
  background: var(--bs-dropdown-bg, #fff);
  border: 1px solid color-mix(in srgb, var(--epr-border) 90%, transparent);
  border-radius: var(--bs-dropdown-border-radius, var(--epr-radius-sm));
  box-shadow:
    0 4px 14px rgba(15, 23, 42, 0.1),
    0 1px 3px rgba(15, 23, 42, 0.06);
  transform-origin: top right;
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel::before {
  content: "";
  position: absolute;
  top: -5px;
  right: var(--epr-breadcrumb-actions-caret-right);
  width: 10px;
  height: 10px;
  background: var(--bs-dropdown-bg, #fff);
  border-top: 1px solid color-mix(in srgb, var(--epr-border) 90%, transparent);
  border-left: 1px solid color-mix(in srgb, var(--epr-border) 90%, transparent);
  transform: rotate(45deg);
  box-shadow: -1px -1px 2px rgba(15, 23, 42, 0.04);
  pointer-events: none;
  z-index: 1;
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu.show .epr-breadcrumb-actions-menu__panel:not(.epr-breadcrumb-actions-menu__panel--closing) {
  animation: epr-breadcrumb-actions-menu-in 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu.show .epr-breadcrumb-actions-menu__panel.epr-breadcrumb-actions-menu__panel--closing {
  animation: epr-breadcrumb-actions-menu-out 0.16s ease-in both;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {

  .epr-breadcrumb-toolbar .epr-breadcrumb-actions-dropdown__chevron,
  .epr-breadcrumb-toolbar .epr-breadcrumb-actions-dropdown__toggle {
    transition: none;
  }

  .epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu.show .epr-breadcrumb-actions-menu__panel {
    animation: none;
  }
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel .epr-btn-ic {
  display: none;
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel>.btn,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel>a.btn,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel>button.btn,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel>.epr-breadcrumb-action-item,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel .epr-breadcrumb-action-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  width: 100%;
  margin: 0 !important;
  margin-bottom: 0.125rem !important;
  border: 0 !important;
  border-radius: var(--epr-breadcrumb-actions-item-inset) !important;
  background: transparent !important;
  color: var(--epr-text-secondary) !important;
  text-align: left;
  font-size: var(--epr-font-size-sm);
  font-weight: var(--epr-font-weight-normal) !important;
  padding: 0.4rem 0.75rem !important;
  box-shadow: none !important;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel a.btn-primary,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel a.btn-success,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel a.btn-outline-primary {
  background: transparent !important;
  border: 0 !important;
  color: var(--epr-text-secondary) !important;
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel>.epr-breadcrumb-action-item::before,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel .epr-breadcrumb-action-item::before {
  content: "";
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px 20px;
  opacity: 0.95;
}

/* Icon theo chức năng (data-epr-breadcrumb-action từ epr-breadcrumb-actions.js) */
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel [data-epr-breadcrumb-action="timeline"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Ccircle cx='12' cy='12' r='8' stroke='%231f7a4f' stroke-width='1.6'/%3E%3Cpath d='M12 8v4l3 2' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel [data-epr-breadcrumb-action="print"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M7 9V4h10v5' stroke='%231f7a4f' stroke-width='1.6' stroke-linejoin='round'/%3E%3Crect x='5' y='9' width='14' height='8' rx='1.5' stroke='%231f7a4f' stroke-width='1.6'/%3E%3Cpath d='M8 17v3h8v-3' stroke='%231f7a4f' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel [data-epr-breadcrumb-action="split-merge"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 4v6M18 4v6M6 7h8a4 4 0 0 1 4 4v0a4 4 0 0 1-4 4H6' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round'/%3E%3Cpath d='M14 15l4 5M14 21l4-5' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel [data-epr-breadcrumb-action="edit"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M5 19h3l9.5-9.5-3-3L5 16v3z' stroke='%231f7a4f' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M14 6l3 3' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.epr-template--detail .epr-breadcrumb-actions-menu__panel .epr-breadcrumb-action-item.epr-dropdown-item--with-icon::before {
  display: none;
}

.epr-template--detail .epr-breadcrumb-actions-menu__panel .epr-breadcrumb-action-item .epr-actions-dropdown__item-icon {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--epr-brand-600, #059669);
}

.epr-template--detail .epr-breadcrumb-actions-menu__panel .epr-breadcrumb-action-item .epr-actions-dropdown__item-icon .epr-nav-ic {
  width: 1rem;
  height: 1rem;
}

.epr-template--detail .epr-breadcrumb-actions-menu__panel [data-epr-breadcrumb-action="status"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M3 3v5h5' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M16 16h5v5' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel [data-epr-breadcrumb-action="trust"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12 3l7 3v6c0 4.5-3 7.8-7 9-4-1.2-7-4.5-7-9V6l7-3z' stroke='%231f7a4f' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M9 12l2 2 4-4' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel [data-epr-breadcrumb-action="password"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Crect x='5' y='11' width='14' height='9' rx='2' stroke='%231f7a4f' stroke-width='1.6'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3' stroke='%231f7a4f' stroke-width='1.6'/%3E%3C/svg%3E");
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel [data-epr-breadcrumb-action="lock"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Crect x='5' y='11' width='14' height='10' rx='2' stroke='%231f7a4f' stroke-width='1.6'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0' stroke='%231f7a4f' stroke-width='1.6'/%3E%3Ccircle cx='12' cy='15' r='1.25' fill='%231f7a4f'/%3E%3C/svg%3E");
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel [data-epr-breadcrumb-action="more"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M7 7h10v10' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M7 17 17 7' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel [data-epr-breadcrumb-action="archive"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Crect x='3' y='4' width='18' height='5' rx='1' stroke='%231f7a4f' stroke-width='1.6'/%3E%3Cpath d='M5 9v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9' stroke='%231f7a4f' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M10 13h4' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel [data-epr-breadcrumb-action="delete"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 7h12M9 7V5h6v2M10 11v5M14 11v5M8 7l1 12h6l1-12' stroke='%23dc2626' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel [data-epr-breadcrumb-action="create"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12 6v12M6 12h12' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel [data-epr-breadcrumb-action="treeView"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12 3v18M6 9h12M8 15h8' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel [data-epr-breadcrumb-action="import"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='17 8 12 3 7 8'/%3E%3Cline x1='12' x2='12' y1='3' y2='15'/%3E%3C/svg%3E");
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel [data-epr-breadcrumb-action="add-participant"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2' stroke='%231f7a4f' stroke-width='1.6'/%3E%3Ccircle cx='9' cy='7' r='4' stroke='%231f7a4f' stroke-width='1.6'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87' stroke='%231f7a4f' stroke-width='1.6'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75' stroke='%231f7a4f' stroke-width='1.6'/%3E%3C/svg%3E");
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel [data-epr-breadcrumb-action="add-evidence"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12 3l7 3v6c0 4.5-3 7.8-7 9-4-1.2-7-4.5-7-9V6l7-3z' stroke='%231f7a4f' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M12 11v4M10 13h4' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel [data-epr-breadcrumb-action="create-weigh-record"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12 3v18' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round'/%3E%3Cpath d='M5 7h14' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round'/%3E%3Cpath d='M5 7 3 13h4L5 7z' stroke='%231f7a4f' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M19 7l-2 6h4l-2-6z' stroke='%231f7a4f' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M8 21h8' stroke='%231f7a4f' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel [data-epr-breadcrumb-action="default"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Ccircle cx='12' cy='12' r='2' fill='%231f7a4f'/%3E%3C/svg%3E");
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel>.btn:last-child,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel>a.btn:last-child,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel>button.btn:last-child,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel>.epr-breadcrumb-action-item:last-child {
  margin-bottom: 0 !important;
}

.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel>.btn:hover,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel>a.btn:hover,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel>button.btn:hover,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel>.epr-breadcrumb-action-item:hover,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel .epr-breadcrumb-action-item:hover,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel>.btn:focus-visible,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel>a.btn:focus-visible,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel>button.btn:focus-visible,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel>.epr-breadcrumb-action-item:focus-visible,
.epr-breadcrumb-toolbar .epr-breadcrumb-actions-menu__panel .epr-breadcrumb-action-item:focus-visible {
  background-color: var(--grac-green-50, #ecf8f0) !important;
  color: var(--epr-brand-700) !important;
  text-decoration: none;
}

/* Nút lọc: nền trắng, viền xám, icon & chữ xanh */
.epr-toolbar-filter-btn {
  color: var(--grac-green-900) !important;
  background-color: #fff !important;
  border: 1px solid color-mix(in srgb, var(--epr-border) 92%, var(--epr-neutral-500)) !important;
  border-radius: var(--epr-radius-sm) !important;
  font-weight: var(--epr-font-weight-semibold);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.epr-toolbar-filter-btn:hover {
  background-color: var(--grac-green-25) !important;
  border-color: color-mix(in srgb, var(--grac-green-600) 35%, var(--epr-border)) !important;
  color: var(--grac-green-900) !important;
}

.epr-toolbar-filter-btn:focus-visible {
  box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.2rem rgba(45, 157, 92, 0.45);
}

.epr-toolbar-filter-btn .epr-btn-ic {
  color: var(--grac-green-800);
}

/* Nút tạo chính: đã dùng .btn-primary (GRAC), thêm dấu + */
.epr-toolbar-create-btn::before {
  content: "+";
  margin-right: 0.28rem;
  font-weight: 800;
  opacity: 0.95;
}

.epr-template--master-list .epr-breadcrumb-toolbar__actions .epr-toolbar-create-btn.btn-primary {
  border-radius: var(--epr-radius-sm);
}

.epr-template--master-list .epr-breadcrumb-toolbar__actions .epr-btn-mint {
  border-radius: var(--epr-radius-sm);
  border-color: color-mix(in srgb, var(--grac-green-600) 42%, var(--epr-border));
  background: linear-gradient(180deg, #f4faf6 0%, var(--grac-green-25) 100%);
  color: var(--grac-green-900);
  font-weight: var(--epr-font-weight-semibold);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.epr-template--master-list .epr-breadcrumb-toolbar__actions .epr-btn-mint:hover {
  background: linear-gradient(180deg, #ecf8f0 0%, var(--grac-green-50) 100%);
  color: var(--grac-green-900);
}

.epr-master-list-filter-drawer {
  min-width: 0;
}

.epr-master-list-filter-drawer.is-collapsed,
.epr-master-list-filter-drawer[hidden] {
  display: none !important;
}

.epr-master-list-filter-card {
  overflow: hidden;
}

/* Master list: bộ lọc gọn hơn, bo góc nhẹ (không “pill”) */
.epr-template--master-list .epr-master-list-filter-card.epr-filter-bar-foundation {
  border-radius: var(--epr-radius-sm);
  box-shadow: var(--epr-shadow-sm);
}

.epr-template--master-list .epr-master-list-filter-card .epr-filter-bar-foundation__header {
  padding: var(--epr-space-2) var(--epr-space-3);
  gap: var(--epr-space-2);
  align-items: center;
}

.epr-template--master-list .epr-master-list-filter-card .epr-filter-bar-foundation__title {
  font-size: var(--epr-font-size-sm);
  line-height: 1.35rem;
}

.epr-template--master-list .epr-master-list-filter-card .epr-filter-bar-foundation__body {
  padding: var(--epr-space-2) var(--epr-space-3);
  gap: var(--epr-space-2);
}

.epr-template--master-list .epr-master-list-query-filters .form-label {
  margin-bottom: var(--epr-space-1);
}

.epr-template--master-list .epr-master-list-table-card>.epr-card__header {
  padding: var(--epr-space-2) var(--epr-space-3);
  gap: var(--epr-space-2);
  align-items: center;
}

.epr-template--master-list .epr-master-list-table-card .epr-card__actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--epr-space-2);
  min-width: 0;
}

.epr-summary-card--accent-neutral {
  border-top: 4px solid color-mix(in srgb, var(--epr-neutral-500) 38%, var(--epr-border));
}

.epr-summary-card--accent-neutral .epr-summary-card__icon-wrap {
  background: linear-gradient(155deg, var(--epr-neutral-100) 0%, #e6eaee 100%);
}

.epr-summary-card--accent-neutral .epr-summary-card__icon {
  color: var(--epr-brand-700);
}

.epr-summary-card--accent-blue {
  border-top: 4px solid #1e88e5;
}

.epr-summary-card--accent-blue .epr-summary-card__icon-wrap {
  background: linear-gradient(155deg, #e8f4fd 0%, #c5e3fc 55%, #aed8fa 100%);
}

.epr-summary-card--accent-blue .epr-summary-card__icon {
  color: #0d47a1;
}

.epr-summary-card--accent-green {
  border-top: 4px solid var(--grac-green-600);
}

.epr-summary-card--accent-green .epr-summary-card__icon-wrap {
  background: linear-gradient(155deg, var(--grac-green-25) 0%, var(--grac-green-50) 55%, var(--grac-green-100) 100%);
}

.epr-summary-card--accent-green .epr-summary-card__icon {
  color: var(--grac-green-900);
}

.epr-summary-card--accent-violet {
  border-top: 4px solid #5e35b1;
}

.epr-summary-card--accent-violet .epr-summary-card__icon-wrap {
  background: linear-gradient(155deg, #f3e5f5 0%, #e1bee7 55%, #ce93d8 100%);
}

.epr-summary-card--accent-violet .epr-summary-card__icon {
  color: #4a148c;
}

.epr-summary-card--accent-slate {
  border-top: 4px solid #546e7a;
}

.epr-summary-card--accent-slate .epr-summary-card__icon-wrap {
  background: linear-gradient(155deg, #eceff1 0%, #cfd8dc 70%, #b0bec5 100%);
}

.epr-summary-card--accent-slate .epr-summary-card__icon {
  color: #263238;
}

.epr-btn-mint {
  border: 1px solid var(--grac-green-500);
  border-radius: var(--epr-radius-sm);
  background: var(--grac-green-25);
  color: var(--grac-green-900);
  font-weight: var(--epr-font-weight-semibold);
}

.epr-btn-mint:hover {
  background: var(--grac-green-50);
  color: var(--grac-green-900);
}

.epr-btn-mint.dropdown-toggle::after {
  margin-left: 0.35rem;
}

.epr-master-list-filter-toggle .epr-btn-ic {
  display: inline-flex;
  width: 1.1rem;
  height: 1.1rem;
}

.epr-master-list-filter-toggle .epr-btn-ic svg {
  width: 100%;
  height: 100%;
}

.epr-breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--epr-space-1);
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: var(--epr-font-size-sm);
}

.epr-breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: var(--epr-space-2);
}

.epr-breadcrumb-item+.epr-breadcrumb-item::before {
  content: "/";
  color: var(--epr-neutral-500);
  opacity: 0.85;
  text-decoration: none;
  pointer-events: none;
}

.epr-breadcrumb-link {
  color: var(--epr-brand-700);
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--epr-radius-sm);
}

.epr-breadcrumb-link:hover {
  color: var(--epr-brand-600);
  text-decoration: underline;
}

.epr-breadcrumb-current {
  color: var(--epr-text-secondary);
  font-weight: var(--epr-font-weight-semibold);
}

.epr-page-header h1,
.epr-page-header .h4 {
  color: var(--epr-text-primary);
  font-family: var(--epr-font-display);
  font-size: var(--epr-page-title-size);
  line-height: var(--epr-page-title-line-height);
  font-weight: var(--epr-page-title-weight);
  letter-spacing: -0.02em;
}

.epr-page-header p {
  color: var(--epr-text-muted) !important;
  font-size: var(--epr-type-page-sub-fs);
  line-height: var(--epr-type-page-sub-lh);
}

.epr-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--epr-space-6);
  margin-bottom: var(--epr-space-4);
}

.epr-page-header__main {
  min-width: 0;
}

.epr-page-header__eyebrow {
  margin: 0 0 var(--epr-space-1);
  color: var(--epr-brand-700);
  font-size: var(--epr-label-size);
  line-height: var(--epr-label-line-height);
  font-weight: var(--epr-label-weight);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.epr-page-header__subtitle {
  max-width: 64rem;
  margin: var(--epr-space-2) 0 0;
}

.epr-page-header__actions,
.epr-page-header__secondary-actions,
.epr-page-header__primary-actions,
.epr-page-toolbar-foundation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--epr-space-2);
}

.epr-page-toolbar-foundation {
  padding: var(--epr-space-3);
  border: var(--epr-border-width) solid var(--epr-border);
  border-radius: var(--epr-card-radius);
  background: var(--epr-surface);
  box-shadow: var(--epr-shadow-sm);
}

.epr-page-toolbar-foundation__danger {
  margin-inline-start: auto;
}

.epr-filter-bar .form-label {
  margin-bottom: var(--epr-space-1);
}

.epr-card,
.epr-section-card,
.epr-filter-bar-foundation {
  border: var(--epr-border-width) solid var(--epr-border);
  border-radius: var(--epr-card-radius);
  background: var(--epr-surface);
  box-shadow: var(--epr-card-shadow);
}

.epr-card--soft {
  background: var(--epr-surface-muted);
  box-shadow: none;
}

.epr-card--compact .epr-card__body,
.epr-data-table--dense .epr-data-table__scroll {
  font-size: var(--epr-table-cell-size);
}

.epr-card__header,
.epr-filter-bar-foundation__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--epr-space-4);
  padding: var(--epr-space-2) var(--epr-space-3);
  border-bottom: var(--epr-border-width) solid var(--epr-border);
}

.epr-card__title-group {
  display: flex;
  align-items: flex-start;
  gap: var(--epr-space-3);
  min-width: 0;
}

.epr-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--epr-brand-700);
}

.epr-card__title,
.epr-filter-bar-foundation__title {
    margin: 0;
    color: var(--epr-text-muted);
    font-size: var(--epr-card-title-size);
    line-height: var(--epr-card-title-line-height);
    font-weight: var(--epr-card-title-weight);
    text-transform: uppercase;
}

.epr-card__subtitle {
  margin: var(--epr-space-1) 0 0;
  color: var(--epr-text-muted);
  font-size: var(--epr-font-size-sm);
  display: none;
}

.epr-card__body,
.epr-filter-bar-foundation__body {
  padding: var(--epr-density-card-pad);
}

.epr-card__footer {
  padding: var(--epr-space-3) var(--epr-space-5);
  border-top: var(--epr-border-width) solid var(--epr-border);
  background: var(--epr-surface-muted);
}

.epr-filter-bar-foundation__body {
  display: grid;
  gap: var(--epr-space-3);
}

.epr-search-input,
.epr-form-field {
  display: grid;
  gap: var(--epr-space-1);
}

.epr-search-input__label,
.epr-form-field__label {
  color: var(--epr-text-secondary);
  font-size: var(--epr-label-size);
  line-height: var(--epr-label-line-height);
  font-weight: var(--epr-label-weight);
}

.epr-search-input__control {
  position: relative;
  display: block;
}

.epr-search-input__clear {
  position: absolute;
  top: 50%;
  right: var(--epr-space-3);
  color: var(--epr-text-muted);
  text-decoration: none;
  transform: translateY(-50%);
}

.epr-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--epr-space-1);
  padding: 0.375rem 0.625rem;
  border: var(--epr-border-width) solid var(--epr-border);
  border-radius: var(--epr-radius-pill);
  background: var(--epr-surface);
  color: var(--epr-text-secondary);
  font-size: var(--epr-font-size-xs);
  font-weight: var(--epr-font-weight-semibold);
}

.epr-filter-chip.is-active {
  border-color: var(--epr-brand-600);
  background: var(--grac-green-50);
  color: var(--epr-brand-700);
}

.epr-filter-chip__remove {
  color: inherit;
  text-decoration: none;
}

.epr-data-table {
  border: var(--epr-border-width) solid var(--epr-border);
  border-radius: var(--epr-card-radius);
  background: var(--epr-surface);
  overflow-x: auto;
  overflow-y: visible;
}

.epr-data-table__scroll {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.epr-role-assigned-caps__scroll {
  max-height: 17.5rem;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Mẫu vai trò — workspace phân quyền (không KPI / bộ lọc master-list) */
.tpl-page.tpl-roles-workspace .epr-template__summary {
  display: none;
}

.tpl-page.tpl-roles-workspace .epr-template__content {
  margin-top: 0;
}

.epr-rtm-workspace .epr-rtm-role-list {
  max-height: min(32rem, calc(100vh - 14rem));
  overflow-y: auto;
}

.epr-rtm-role-row {
  cursor: pointer;
}

.epr-rtm-role-row.is-selected,
.epr-rtm-role-row.is-selected td {
  background-color: var(--epr-primary-soft, rgba(35, 164, 85, 0.12));
}

.tpl-working-context .epr-template__content {
  margin-top: 0;
}

.epr-working-context-current {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--epr-space-3);
}

.epr-working-context-groups {
  display: grid;
  gap: var(--epr-space-4);
}

.epr-working-context-group {
  display: grid;
  gap: var(--epr-space-2);
}

.epr-working-context-group__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--epr-space-3);
}

.epr-working-context-group__header h3 {
  margin: 0;
  color: var(--epr-text-secondary);
  font-size: var(--epr-font-size-sm);
  font-weight: var(--epr-font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.epr-working-context-role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: var(--epr-space-3);
}

.epr-working-context-role {
  display: grid;
  gap: var(--epr-space-3);
  padding: var(--epr-space-4);
  border: var(--epr-border-width) solid var(--epr-border);
  border-radius: var(--epr-card-radius);
  background: var(--epr-surface);
}

.epr-working-context-role.is-current {
  border-color: var(--epr-brand-600);
  background: var(--grac-green-50);
}

.epr-working-context-role.is-disabled {
  opacity: 0.68;
}

.epr-working-context-role__main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--epr-space-3);
}

.epr-working-context-role__main h4 {
  margin: 0;
  color: var(--epr-text-primary);
  font-size: var(--epr-font-size-base);
  font-weight: var(--epr-font-weight-semibold);
}

.epr-working-context-role__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--epr-space-2);
  margin-top: var(--epr-space-2);
  color: var(--epr-text-muted);
  font-size: var(--epr-font-size-sm);
}

.epr-working-context-role__actions {
  display: flex;
  justify-content: flex-end;
}

.epr-working-context-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.875rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--epr-radius-pill);
  font-size: var(--epr-font-size-xs);
  font-weight: var(--epr-font-weight-semibold);
  line-height: 1;
}

.epr-working-context-status.is-current {
  border: 1px solid #047857 !important;
  background-color: #047857 !important;
  color: #fff !important;
  opacity: 1 !important;
  text-shadow: none;
}

@media (max-width: 767.98px) {
  .epr-working-context-current {
    grid-template-columns: 1fr;
  }

  .epr-working-context-role-grid {
    grid-template-columns: 1fr;
  }
}

.epr-rtm-table-scroll {
  max-height: min(28rem, calc(100vh - 16rem));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.epr-rtm-module-tabs-wrap {
  margin-bottom: var(--epr-space-3);
}

.epr-rtm-module-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.25rem;
  margin: 0;
  background: var(--epr-surface-muted, #f4f6f8);
  border: 1px solid var(--epr-border);
  border-radius: var(--epr-radius-md, 0.5rem);
}

.epr-rtm-module-tabs .nav-item {
  margin: 0;
}

.epr-rtm-module-tabs .nav-link {
  border: none;
  border-radius: var(--epr-radius-sm, 0.375rem);
  color: var(--epr-text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
  padding: 0.4rem 0.9rem;
  text-transform: none;
  white-space: nowrap;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.epr-rtm-module-tabs .nav-link:hover {
  color: var(--epr-text-primary);
  background: rgba(255, 255, 255, 0.65);
}

.epr-rtm-module-tabs .nav-link:focus-visible {
  outline: var(--epr-focus-ring-width, 2px) solid var(--epr-focus-ring-color, #23a455);
  outline-offset: 1px;
}

.epr-rtm-module-tabs .nav-link.active,
.epr-rtm-module-tabs .nav-link.active:hover {
  color: var(--epr-primary, #23a455);
  background: var(--epr-surface, #fff);
  box-shadow: var(--epr-shadow-sm, 0 1px 2px rgba(15, 23, 42, 0.08));
}

.epr-rtm-tab-panes {
  border: 1px solid var(--epr-border);
  border-radius: var(--epr-radius-md, 0.5rem);
  background: var(--epr-surface, #fff);
  padding: 0;
  overflow: hidden;
}

.epr-rtm-tab-panes--flat {
  border: none;
  border-radius: 0;
  background: transparent;
}

.epr-rtm-tab-panes .tab-pane {
  padding: 0;
}

.epr-rtm-tab-panes .epr-rtm-table-scroll {
  border: none;
  border-radius: 0;
}

.epr-rtm-table--grac thead th {
  vertical-align: middle;
  text-align: center;
  white-space: nowrap;
}

.epr-rtm-table--grac thead th:nth-child(3) {
  text-align: left;
}

.epr-rtm-others-list {
  max-height: 14rem;
  overflow-y: auto;
  padding: 0.15rem 0;
}

.epr-rtm-other-item {
  line-height: 1.25;
}

.epr-role-assigned-caps thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  box-shadow: inset 0 -1px 0 var(--epr-border);
  background: var(--epr-surface);
}

.epr-data-table table,
.epr-data-table .table {
  width: 100%;
  margin-bottom: 0;
}

.epr-data-table .epr-table-num,
.epr-data-table .epr-data-table__num {
  text-align: right;
  font-variant-numeric: var(--epr-tabular);
}

.epr-card>.epr-data-table {
  border-inline: 0;
  border-bottom: 0;
  border-radius: 0;
  box-shadow: none;
}

.epr-card>.epr-data-table:last-child {
  border-bottom-left-radius: var(--epr-card-radius);
  border-bottom-right-radius: var(--epr-card-radius);
}

.epr-data-table thead th {
  background: var(--epr-surface-muted);
}

.epr-table-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: inherit;
  text-decoration: none;
  font-weight: inherit;
  white-space: nowrap;
}

.epr-table-sort:hover {
  color: var(--grac-green-800);
  text-decoration: none;
}

.epr-table-sort.is-active {
  color: var(--grac-green-800);
  font-weight: var(--epr-font-weight-semibold);
}

.epr-table-sort__indicator {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

.epr-table-sort__icon {
  display: block;
  width: 1rem;
  height: 1rem;
}

.epr-data-table tbody td {
  vertical-align: middle;
}

.epr-batch-list-origin-ref-cell {
  max-width: 8.5rem;
  width: 8.5rem;
}

.epr-batch-list-origin-ref {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  min-width: 0;
}

.epr-batch-list-origin-ref a,
.epr-batch-list-origin-ref code {
  display: inline;
}

/* Liên kết trong ô bảng (mã/tên → chi tiết): xanh da trời, không gạch chân; hover có gạch chân */
.epr-data-table tbody td a:not(.dropdown-item):not(.btn):not(.epr-table-pager__link):not(.epr-proj-coll-progress__flow-org-link) {
  color: var(--epr-info);
  text-decoration: none;
  font-weight: var(--epr-font-weight-medium);
}

.epr-data-table tbody td a:not(.dropdown-item):not(.btn):not(.epr-table-pager__link):not(.epr-proj-coll-progress__flow-org-link):hover {
  color: #1565c0;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.epr-data-table tbody td a:not(.dropdown-item):not(.btn):not(.epr-table-pager__link):not(.epr-proj-coll-progress__flow-org-link):focus-visible {
  outline: var(--epr-focus-ring-width) solid var(--epr-focus-ring-color);
  outline-offset: var(--epr-focus-ring-offset);
  border-radius: var(--epr-radius-sm);
}

.epr-data-table tbody tr:last-child>* {
  border-bottom-width: 0;
}

.epr-data-table__meta {
  color: var(--epr-text-muted);
  font-size: var(--epr-font-size-xs);
}

.epr-table-pager {
  padding: var(--epr-space-3) var(--epr-space-4);
  border-top: var(--epr-border-width) solid var(--epr-border);
  background: var(--epr-surface);
  font-size: var(--epr-font-size-sm);
}

.epr-table-pager__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--epr-space-4);
  width: 100%;
}

.epr-table-pager__range {
  margin: 0;
  flex: 0 1 auto;
  color: var(--epr-text-muted);
  font-size: var(--epr-font-size-sm);
  white-space: nowrap;
}

.epr-table-pager__nav {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.epr-table-pager__sizes {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--epr-space-2);
  flex: 0 0 auto;
  min-width: 0;
}

.epr-table-pager__sizes-label {
  margin: 0;
  flex-shrink: 0;
  color: var(--epr-text-muted);
  font-size: var(--epr-font-size-sm);
  white-space: nowrap;
}

.epr-table-pager__rows-select {
  width: auto;
  min-width: 3.5rem;
  max-width: 5rem;
  flex-shrink: 0;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
  font-size: var(--epr-font-size-sm);
  border-color: var(--epr-border);
  border-radius: var(--epr-radius-md);
  background-color: var(--epr-surface);
}

.epr-table-pager__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.epr-table-pager__item {
  display: flex;
  align-items: center;
  justify-content: center;
}

.epr-table-pager__item--gap {
  padding: 0 0.15rem;
}

.epr-table-pager__ellipsis {
  color: var(--epr-text-muted);
  font-size: var(--epr-font-size-sm);
  user-select: none;
}

.epr-table-pager__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 2.25rem;
  height: 2.25rem;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0;
  border: var(--epr-border-width) solid var(--epr-border);
  border-radius: 50%;
  background: var(--epr-surface);
  color: var(--epr-text-secondary);
  text-decoration: none;
  font-size: var(--epr-font-size-sm);
  font-weight: var(--epr-font-weight-medium);
  line-height: 1;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

a.epr-table-pager__link:hover {
  background: var(--epr-surface-muted);
  border-color: var(--epr-text-muted);
  color: var(--epr-text-primary);
}

.epr-table-pager__link--chev {
  font-size: 0.95rem;
  font-weight: var(--epr-font-weight-semibold);
  letter-spacing: -0.02em;
}

.epr-table-pager__item.is-active .epr-table-pager__link {
  border-color: var(--epr-brand-600);
  background: var(--epr-brand-600);
  color: #fff;
  font-weight: var(--epr-font-weight-semibold);
}

.epr-table-pager__item.is-disabled .epr-table-pager__link {
  color: var(--epr-text-muted);
  border-color: var(--epr-border);
  background: var(--epr-surface);
  pointer-events: none;
  opacity: 0.45;
}

/* Dropdown ⋮ trong bảng: Popper strategy "fixed" để menu không bị clip bởi overflow của .epr-data-table / .epr-main. */
.epr-actions-dropdown:not(.epr-breadcrumb-actions-dropdown) {
  position: relative;
  z-index: 1;
}

.epr-actions-dropdown:not(.epr-breadcrumb-actions-dropdown):has(.dropdown-menu.show) {
  z-index: 1080;
}

.epr-data-table .dropdown-menu.show {
  z-index: 1080;
}

.epr-actions-dropdown__toggle {
  padding: 0.15rem 0.45rem;
  line-height: 1;
  border: 1px solid var(--epr-border);
  background: var(--grac-green-50, #ecf8f0);
  color: var(--epr-brand-700);
  border-radius: var(--epr-radius-md);
}

.epr-actions-dropdown__toggle.dropdown-toggle::after {
  margin-left: 0.35rem;
  vertical-align: 0.15em;
}

.epr-rtm-check-all-toolbar .form-check-label {
  font-size: var(--epr-font-size-sm);
  font-weight: 500;
  color: var(--epr-text-secondary, #5c6b7a);
}

.epr-actions-dropdown__toggle:hover,
.epr-actions-dropdown__toggle:focus-visible {
  border-color: var(--epr-brand-500);
  background: var(--epr-surface);
  color: var(--epr-brand-800);
}

.epr-actions-dropdown__toggle.show {
  border-color: var(--epr-brand-600);
}

.epr-actions-dropdown__dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  line-height: 1;
}

.epr-actions-dropdown__dots-svg {
  display: block;
  flex-shrink: 0;
}

/* Menu ⋮ trong bảng danh sách — đồng bộ với menu Thao tác (detail), trừ breadcrumb */
@keyframes epr-actions-dropdown-menu-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.epr-actions-dropdown:not(.epr-breadcrumb-actions-dropdown) {
  --epr-actions-menu-inset: 8px;
  --epr-actions-menu-caret-left: 0.875rem;
}

.epr-actions-dropdown:not(.epr-breadcrumb-actions-dropdown) .epr-actions-dropdown__menu {
  position: relative;
  min-width: 11rem;
  padding: 0.4rem var(--epr-actions-menu-inset);
  margin: 0;
  overflow: visible;
  font-size: var(--epr-font-size-sm);
  text-align: left;
  background: var(--bs-dropdown-bg, #fff);
  border: 1px solid color-mix(in srgb, var(--epr-border) 90%, transparent);
  border-radius: var(--bs-dropdown-border-radius, var(--epr-radius-sm));
  box-shadow:
    0 4px 14px rgba(15, 23, 42, 0.1),
    0 1px 3px rgba(15, 23, 42, 0.06);
  transform-origin: top left;
}

.epr-actions-dropdown:not(.epr-breadcrumb-actions-dropdown) .epr-actions-dropdown__menu::before {
  content: "";
  position: absolute;
  top: -5px;
  left: var(--epr-actions-menu-caret-left);
  width: 10px;
  height: 10px;
  background: var(--bs-dropdown-bg, #fff);
  border-top: 1px solid color-mix(in srgb, var(--epr-border) 90%, transparent);
  border-left: 1px solid color-mix(in srgb, var(--epr-border) 90%, transparent);
  transform: rotate(45deg);
  box-shadow: -1px -1px 2px rgba(15, 23, 42, 0.04);
  pointer-events: none;
  z-index: 1;
}

.epr-actions-dropdown:not(.epr-breadcrumb-actions-dropdown) .epr-actions-dropdown__menu.show {
  animation: epr-actions-dropdown-menu-in 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .epr-actions-dropdown:not(.epr-breadcrumb-actions-dropdown) .epr-actions-dropdown__menu.show {
    animation: none;
  }
}

.epr-actions-dropdown:not(.epr-breadcrumb-actions-dropdown) .epr-actions-dropdown__menu>li {
  padding: 0;
  margin: 0;
}

.epr-actions-dropdown:not(.epr-breadcrumb-actions-dropdown) .epr-actions-dropdown__menu .dropdown-item {
  border-radius: var(--epr-actions-menu-inset);
  margin-bottom: 0.125rem;
  padding: 0.4rem 0.75rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.epr-actions-dropdown__menu .dropdown-item.epr-dropdown-item--with-icon {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.epr-actions-dropdown__item-icon {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--epr-brand-600, #059669);
}

.epr-actions-dropdown__item-icon .epr-nav-ic {
  width: 1rem;
  height: 1rem;
}

.epr-actions-dropdown__menu .dropdown-item.epr-dropdown-item--delete .epr-actions-dropdown__item-icon,
.epr-actions-dropdown__menu .dropdown-item.epr-dropdown-item--delete:hover .epr-actions-dropdown__item-icon,
.epr-actions-dropdown__menu .dropdown-item.epr-dropdown-item--delete:focus .epr-actions-dropdown__item-icon,
.epr-actions-dropdown__menu .dropdown-item.epr-dropdown-item--delete:active .epr-actions-dropdown__item-icon,
.epr-actions-dropdown__menu button.dropdown-item.epr-dropdown-item--delete .epr-actions-dropdown__item-icon,
.epr-actions-dropdown__menu button.dropdown-item.epr-dropdown-item--delete:hover .epr-actions-dropdown__item-icon,
.epr-actions-dropdown__menu button.dropdown-item.epr-dropdown-item--delete:focus .epr-actions-dropdown__item-icon,
.epr-actions-dropdown__menu button.dropdown-item.epr-dropdown-item--delete:active .epr-actions-dropdown__item-icon {
  color: #dc2626;
}

.epr-actions-dropdown__menu .dropdown-item.epr-dropdown-item--blocked .epr-actions-dropdown__item-icon {
  color: currentColor;
  opacity: 0.72;
}

.epr-actions-dropdown:not(.epr-breadcrumb-actions-dropdown) .epr-actions-dropdown__menu>li:last-child .dropdown-item {
  margin-bottom: 0;
}

.epr-actions-dropdown:not(.epr-breadcrumb-actions-dropdown) .epr-actions-dropdown__menu .dropdown-divider {
  margin: 0.25rem var(--epr-actions-menu-inset);
  opacity: 1;
}

/* Hover menu thao tác — nền xanh chung; mục Xóa chỉ đổi chữ/icon đỏ */
.epr-actions-dropdown__menu .dropdown-item:hover,
.epr-actions-dropdown__menu .dropdown-item:focus {
  background-color: var(--grac-green-50, #ecf8f0);
  color: var(--epr-brand-700, var(--bs-dropdown-link-color, #212529));
}

.epr-actions-dropdown__menu .dropdown-item:active,
.epr-actions-dropdown__menu .dropdown-item.active {
  background-color: var(--epr-neutral-100, #f3f4f6);
  color: var(--bs-dropdown-link-color, #212529);
}

.epr-actions-dropdown__menu .dropdown-item.epr-dropdown-item--delete,
.epr-actions-dropdown__menu .dropdown-item.epr-dropdown-item--delete:hover,
.epr-actions-dropdown__menu .dropdown-item.epr-dropdown-item--delete:focus,
.epr-actions-dropdown__menu .dropdown-item.epr-dropdown-item--delete:active,
.epr-actions-dropdown__menu button.dropdown-item.epr-dropdown-item--delete,
.epr-actions-dropdown__menu button.dropdown-item.epr-dropdown-item--delete:hover,
.epr-actions-dropdown__menu button.dropdown-item.epr-dropdown-item--delete:focus,
.epr-actions-dropdown__menu button.dropdown-item.epr-dropdown-item--delete:active {
  color: #dc2626;
}

.epr-actions-dropdown__menu button.dropdown-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: inherit;
}

.epr-actions-dropdown__menu button.dropdown-item:focus-visible {
  outline: 2px solid var(--epr-border, #d1d5db);
  outline-offset: -2px;
}

.epr-actions-dropdown__menu .epr-dropdown-item--blocked {
  color: var(--bs-secondary-color, #6b7280);
  cursor: not-allowed;
  opacity: 0.72;
}

.epr-actions-dropdown__menu .epr-dropdown-item--blocked:hover,
.epr-actions-dropdown__menu .epr-dropdown-item--blocked:focus,
.epr-actions-dropdown__menu .epr-dropdown-item--blocked:active {
  background-color: transparent;
  color: var(--bs-secondary-color, #6b7280);
}

.epr-col-stt {
  width: 2.75rem;
}

.epr-col-actions {
  width: 4rem;
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
}

/* Nút ⋮ / nhóm nút trong ô thao tác — ô đã text-align:center */
td.epr-col-actions>.dropdown.epr-actions-dropdown {
  display: inline-block;
  vertical-align: middle;
}

td.epr-col-actions>.btn-group {
  display: inline-flex;
  vertical-align: middle;
}

.epr-row-actions,
.epr-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--epr-space-2);
}

.epr-form-actions {
  padding-top: var(--epr-space-4);
  border-top: var(--epr-border-width) solid var(--epr-border);
}

.epr-form-actions__danger {
  margin-inline-end: auto;
}

.epr-form-field__hint,
.epr-form-field__validation {
  margin: 0;
  font-size: var(--epr-font-size-xs);
}

.epr-form-field__hint {
  color: var(--epr-text-muted);
}

.epr-form-field__validation,
.epr-form-field__required {
  color: var(--epr-danger);
}

.epr-form-field.is-disabled,
.epr-form-field.is-readonly {
  opacity: 0.72;
}

.epr-context-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--epr-space-2);
  padding: var(--epr-space-2) var(--epr-space-3);
  margin-bottom: var(--epr-space-3);
  border: var(--epr-border-width) solid var(--epr-border);
  border-radius: var(--epr-radius-lg);
  background: var(--epr-surface);
  color: var(--epr-text-secondary);
  box-shadow: var(--epr-shadow-sm);
  font-size: var(--epr-font-size-sm);
}

.epr-context-bar__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--epr-space-2);
  min-width: 0;
}

.epr-context-bar__user {
  color: var(--epr-text-primary);
  font-weight: var(--epr-font-weight-semibold);
}

.epr-context-bar__meta {
  color: var(--epr-text-muted);
  font-family: var(--epr-font-mono);
  font-size: var(--epr-type-code-fs);
  font-variant-numeric: var(--epr-tabular);
}

.epr-context-bar__divider {
  color: var(--epr-border);
}

.epr-context-bar__action {
  flex-shrink: 0;
}

/* ---- C5: :focus-visible (keyboard), giữ bootstrap cho mouse focus nếu cần) ---- */
a:focus-visible,
.epr-sidebar-link:focus-visible,
button:focus-visible,
.btn:focus-visible {
  outline: var(--epr-focus-ring-width) solid var(--epr-focus-ring-color);
  outline-offset: var(--epr-focus-ring-offset);
}

.form-control:focus-visible,
input:not([type="checkbox"]):not([type="radio"]):focus-visible,
textarea:focus-visible {
  border-color: var(--epr-brand-600);
  outline: 0;
  box-shadow: none;
}

.form-select:focus-visible:not(.select2-hidden-accessible),
select.form-select:focus-visible:not(.select2-hidden-accessible) {
  border-color: var(--grac-green-600, #2d9d5c);
  outline: 0;
  box-shadow: none;
}

.epr-topbar a:focus-visible,
.epr-topbar .btn:focus-visible {
  outline-color: var(--epr-focus-ring-color);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- F3: summary / empty / loading primitives ---- */
.epr-summary-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--epr-space-4);
  height: 100%;
  min-height: 5.75rem;
  padding: calc(var(--epr-density-card-pad) + 0.125rem) var(--epr-density-card-pad) var(--epr-density-card-pad);
  border: 1px solid color-mix(in srgb, var(--epr-border) 88%, var(--epr-neutral-500));
  border-radius: var(--epr-radius-md);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 6px 16px rgba(15, 23, 42, 0.06);
  background: linear-gradient(180deg, #fff 0%, var(--epr-surface) 42%, #fafcfd 100%);
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .epr-summary-card:hover {
    border-color: color-mix(in srgb, var(--epr-border) 55%, var(--epr-brand-500));
    box-shadow:
      0 2px 4px rgba(15, 23, 42, 0.05),
      0 10px 28px rgba(15, 23, 42, 0.09);
    transform: translateY(-2px);
  }
}

.epr-summary-card__icon-wrap {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.875rem;
  height: 2.875rem;
  margin-top: 0.1rem;
  border-radius: var(--epr-radius-md);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 1px 2px rgba(15, 23, 42, 0.06);
}

.epr-summary-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--epr-brand-700);
}

.epr-summary-card__icon .epr-nav-ic {
  width: 1.4rem;
  height: 1.4rem;
}

.epr-summary-card__body {
  min-width: 0;
}

.epr-summary-card__label {
  margin-bottom: var(--epr-space-2);
  color: var(--epr-text-secondary);
  font-size: var(--epr-type-kpi-label-fs);
  line-height: var(--epr-type-kpi-label-lh);
  font-weight: var(--epr-type-kpi-label-fw);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.epr-summary-card__value {
    color: var(--epr-text-muted);
    font-size: var(--epr-kpi-value-size);
    line-height: var(--epr-kpi-value-line-height);
    font-weight: var(--epr-type-kpi-value-fw);
    font-variant-numeric: var(--epr-tabular);
    letter-spacing: -0.02em;
}

.epr-summary-card__hint {
  margin: var(--epr-space-2) 0 0;
  color: var(--epr-text-muted);
  font-size: var(--epr-font-size-sm);
  line-height: 1.45;
}

.epr-empty-state {
  display: grid;
  place-items: center;
  gap: var(--epr-space-2);
  padding: var(--epr-space-6);
  text-align: center;
  border: var(--epr-border-width) dashed var(--epr-border);
  border-radius: var(--epr-radius-lg);
  background: var(--epr-surface-muted);
}

.epr-empty-state--compact {
  padding: var(--epr-space-3);
}

.epr-empty-state--page {
  min-height: 18rem;
}

.epr-empty-state__title,
.epr-permission-denied__title {
  margin: 0;
  color: var(--epr-text-primary);
  font-weight: var(--epr-font-weight-semibold);
}

.epr-empty-state__description,
.epr-permission-denied__message {
  margin: 0;
  color: var(--epr-text-muted);
}

.epr-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--epr-brand-700);
}

.epr-error-state {
  display: grid;
  gap: var(--epr-space-1);
  padding: var(--epr-space-3) var(--epr-space-4);
  border: var(--epr-border-width) solid var(--epr-border);
  border-radius: var(--epr-radius-lg);
  background: var(--epr-surface);
}

.epr-error-state--danger {
  border-color: rgba(229, 57, 53, 0.28);
  background: #fde9e9;
  color: #9a2c2c;
}

.epr-error-state--warning {
  border-color: rgba(242, 153, 74, 0.32);
  background: #fff2e6;
  color: #9a5b18;
}

.epr-error-state--forbidden,
.epr-error-state--not-found {
  border-color: var(--epr-border);
  background: var(--epr-surface-muted);
  color: var(--epr-text-secondary);
}

.epr-error-state__message {
  font-weight: var(--epr-font-weight-semibold);
}

.epr-error-state__detail {
  color: inherit;
  font-size: var(--epr-font-size-sm);
  opacity: 0.86;
}

.epr-loading-block .spinner-border {
  flex-shrink: 0;
}

.epr-loading-block {
  display: inline-flex;
  align-items: center;
  gap: var(--epr-space-2);
  padding: var(--epr-space-2) var(--epr-space-3);
  border: var(--epr-border-width) solid var(--epr-border);
  border-radius: var(--epr-radius-md);
  background: var(--epr-surface);
  color: var(--epr-text-secondary);
  font-size: var(--epr-font-size-sm);
}

.epr-loading-block--page,
.epr-loading-block--table {
  display: flex;
  justify-content: center;
  width: 100%;
}

.epr-loading-block--page {
  min-height: 18rem;
}

.epr-skeleton {
  display: inline-block;
  border-radius: var(--epr-radius-pill);
  background: linear-gradient(90deg, var(--epr-neutral-100), var(--grac-green-50), var(--epr-neutral-100));
}

.epr-skeleton--kpi {
  width: 5.5rem;
  height: var(--epr-kpi-value-size);
}

@media (prefers-reduced-motion: reduce) {
  .epr-loading-block .spinner-border {
    animation: none;
    border-color: var(--bs-primary);
    border-right-color: transparent;
  }
}

.epr-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--epr-space-1);
  padding: 0.375rem 0.625rem;
  border-radius: var(--epr-radius-pill) !important;
  font-weight: 700;
  font-size: var(--epr-font-size-xs);
  white-space: nowrap;
  text-align: center;
}

.epr-master-list-table-card .epr-col-status {
  min-width: 11rem;
  width: 11rem;
}

[data-testid="users-list-card"] .epr-col-organization {
  min-width: 18rem;
  width: 18rem;
  max-width: 24rem;
  white-space: normal;
  vertical-align: top;
}

.epr-status-badge__icon .epr-nav-ic {
  width: var(--epr-icon-chip);
  height: var(--epr-icon-chip);
}

.epr-status-badge--success,
.epr-status-badge.text-bg-success {
  background-color: var(--grac-green-100) !important;
  color: var(--epr-brand-700) !important;
}

.epr-status-badge--warning,
.epr-status-badge.text-bg-warning {
  background-color: #fff2e6 !important;
  color: #9a5b18 !important;
}

.epr-status-badge--danger,
.epr-status-badge.text-bg-danger {
  background-color: #fde9e9 !important;
  color: #9a2c2c !important;
}

.epr-status-badge--info,
.epr-status-badge.text-bg-info {
  background-color: #eaf4fe !important;
  color: #1d5f9f !important;
}

.epr-status-badge--trust {
  background-color: var(--grac-green-50) !important;
  color: var(--epr-brand-700) !important;
}

.epr-status-badge--blockchain {
  background-color: var(--epr-blockchain-accent-soft) !important;
  color: var(--epr-blockchain-accent) !important;
}

.epr-status-badge--neutral,
.epr-status-badge.text-bg-secondary {
  background-color: var(--epr-surface-muted) !important;
  color: var(--epr-text-secondary) !important;
}

.epr-contamination-downgrade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.125rem 0.5rem;
  border: 1px solid #cfd8e3;
  border-radius: var(--epr-radius-pill);
  background-color: #f3f7fb !important;
  color: #475569 !important;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}

/* Trạng thái Organizations: pill xanh / cam theo mẫu UI */
[data-testid="organizations-list-card"] .epr-status-badge {
  font-weight: 600;
  border: 1px solid transparent;
}

[data-testid="organizations-list-card"] .epr-status-badge--success {
  background-color: #e8f5e9 !important;
  color: #1b5e20 !important;
  border-color: #c8e6c9 !important;
}

[data-testid="organizations-list-card"] .epr-status-badge--warning {
  background-color: #fff3e0 !important;
  color: #e65100 !important;
  border-color: #ffe0b2 !important;
}

/* Trang detail master-data (Organization, Site, Unit, Supplier, …) — card/panel tách bạch */
.epr-org-detail--stack {
  display: flex;
  flex-direction: column;
  gap: var(--epr-space-3);
}

/* Thu hẹp gutter Bootstrap g-4 / gap-4 (mặc định 1.5rem) giữa các card trong layout 2 cột */
.epr-org-detail .row.g-4 {
  --bs-gutter-x: var(--epr-space-3);
  --bs-gutter-y: var(--epr-space-3);
}

.epr-org-detail .gap-4 {
  gap: var(--epr-space-3) !important;
}

.epr-org-detail__panel {
  background: var(--epr-surface);
  border: 1px solid var(--epr-border);
  border-radius: var(--epr-card-radius);
  box-shadow: var(--epr-card-shadow);
  overflow: hidden;
}

.epr-org-detail__hero {
  padding: var(--epr-space-4) var(--epr-space-4);
}

.epr-org-detail__hero-main {
  display: flex;
  align-items: flex-start;
  gap: var(--epr-space-4);
  flex-wrap: wrap;
}

.epr-org-detail__avatar {
  flex: 0 0 auto;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: var(--epr-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: var(--epr-brand-700);
  background: linear-gradient(145deg, var(--grac-green-50), #e3f2fd);
  border: 1px solid rgba(27, 94, 32, 0.12);
}

.epr-org-detail__avatar--logo {
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.epr-org-detail__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.epr-org-detail__title {
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    font-weight: 800;
    color: var(--epr-text-muted);
    margin: 0 0 var(--epr-space-2);
    line-height: 1.25;
}

.epr-org-detail__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.875rem;
}

.epr-org-detail__meta-sep {
  color: var(--epr-text-muted);
}

.epr-org-detail__loc {
  color: var(--epr-text-secondary);
}

.epr-org-detail__code-link,
.epr-org-detail__code-link code {
  font-weight: 600;
}

.epr-org-detail__code-pill {
  font-weight: 600;
  font-size: 0.75rem;
  background: #e8f4fc !important;
  color: #1565c0 !important;
  border: 1px solid #bbdefb;
}

.epr-org-detail__card-head {
  padding: var(--epr-space-3) var(--epr-space-4);
  border-bottom: 1px solid var(--epr-border);
  background: var(--epr-surface-muted);
}

.epr-org-detail__card-title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--grac-green-800);
}

.epr-org-detail__card-body {
  padding: 0 var(--epr-space-4) var(--epr-space-4);
  padding-top: var(--epr-space-2);
}

.epr-org-detail__card--fill {
  display: flex;
  flex-direction: column;
}

.epr-org-detail__card--fill .epr-org-detail__card-body {
  flex: 1 1 auto;
}

.epr-org-detail__card--full .epr-org-detail__card-body.p-0 {
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
}

.epr-org-detail__kv-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--epr-space-4);
  padding: var(--epr-space-2) 0;
  border-bottom: 1px solid var(--epr-surface-border, #e9ecef);
}

.epr-org-detail__kv-row--last {
  border-bottom: none;
}

.epr-org-detail__kv-label {
  flex: 0 1 46%;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--epr-neutral-500);
  align-self: center;
}

.epr-org-detail__kv-value {
  flex: 1 1 54%;
  text-align: left;
  font-size: 0.875rem;
  word-break: break-word;
  min-width: 0;
  font-size: var(--epr-font-size-sm);
  color: var(--epr-neutral-900);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.epr-preserve-lines {
  white-space: pre-wrap !important;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.epr-org-detail__value-link {
  text-decoration: none;
  font-weight: 600;
}

.epr-org-detail__value-link:hover {
  text-decoration: none;
}

.epr-proj-detail__kv-chip-link {
  display: inline-flex;
  align-items: center;
}

.epr-proj-detail__kv-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.35rem;
  padding: 0.15rem 0.6rem;
}

.epr-org-detail a.epr-popup-link,
.epr-org-detail a.epr-org-list-code-link {
  text-decoration: none;
}

.epr-org-detail a.epr-popup-link:hover,
.epr-org-detail a.epr-org-list-code-link:hover {
  text-decoration: none;
}

/* Tab Giao dịch — chi tiết dự án: bảng lô hàng / lô tái chế scroll ngang */
.epr-project-transactions-table {
  min-width: 0;
}

.epr-project-transactions-table .epr-org-detail__card-body {
  min-width: 0;
}

.epr-project-transactions-table .epr-data-table {
  border: 0;
  border-radius: 0;
  min-width: 0;
  overflow: hidden;
}

.epr-project-transactions-table .epr-data-table__scroll {
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.epr-project-transactions-table table {
  width: max-content;
  min-width: 100%;
  margin-bottom: 0;
}

.epr-project-transactions-table thead th,
.epr-project-transactions-table tbody td {
  white-space: nowrap;
  vertical-align: middle;
}

.epr-project-transactions-table tbody td code,
.epr-project-transactions-table tbody td a {
  white-space: nowrap;
}

.epr-ro-detail-batches__body {
  padding-top: 0;
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
}

.epr-ro-detail-batches__body>.text-muted {
  padding: var(--epr-space-3) var(--epr-space-4);
}

.epr-ro-detail-batches__table {
  font-size: 0.8125rem;
}

.epr-ro-detail-batches__table thead th {
  font-size: 0.6875rem;
  padding: 0.35rem 0.75rem;
  white-space: nowrap;
}

.epr-ro-detail-batches__table tbody td {
  padding: 0.4rem 0.75rem;
  vertical-align: top;
}

.epr-ro-detail-batches__table tbody td:first-child {
  width: 1%;
  white-space: nowrap;
}

.epr-org-detail__mono {
  font-size: 0.8125rem;
}

.epr-org-detail__map-wrap {
  margin-top: var(--epr-space-3);
  border-radius: var(--epr-radius-md);
  overflow: hidden;
  border: 1px solid var(--epr-border);
  background: var(--epr-surface-muted, #f8f9fa);
}

.epr-org-detail__map-leaflet {
  width: 100%;
  min-height: 280px;
  height: 42vh;
  max-height: 420px;
  z-index: 0;
}

.epr-org-detail__map-leaflet .leaflet-container {
  width: 100%;
  height: 100%;
  font-family: inherit;
  border-radius: inherit;
}

.epr-proj-detail__map-block .epr-org-detail__map-wrap,
.epr-proj-detail__map-block {
  border-radius: var(--epr-radius-md);
  overflow: hidden;
  border: 1px solid var(--epr-border);
  background: var(--epr-surface-muted, #f8f9fa);
}

.epr-proj-detail__map-legend {
  padding: 0.75rem 1rem 0.85rem;
  border-top: 1px solid var(--epr-border);
  background: var(--epr-surface, #fff);
}

.epr-proj-detail__map-legend-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bs-secondary-color, #6c757d);
}

.epr-proj-detail__map-legend-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.25rem;
  align-items: center;
}

.epr-proj-detail__map-legend-row {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--epr-text-secondary, #5c6670);
}

.epr-proj-detail__map-legend-label {
  white-space: nowrap;
}

.epr-proj-detail__map-legend-flow-line {
  display: inline-block;
  width: 36px;
  height: 0;
  border-top: 3px dashed #16a34a;
  opacity: 0.85;
}

.epr-proj-detail__map-legend-row--flow {
  margin-left: 0.15rem;
}

.epr-ops-map-marker-wrap {
  background: transparent !important;
  border: none !important;
}

.epr-ops-map-marker-pin,
.epr-ops-map-legend-pin {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
  border: 2px solid rgba(255, 255, 255, 0.95);
  background: linear-gradient(145deg, var(--ops-pin-a, #3b82f6), var(--ops-pin-b, #1e40af));
}

.epr-ops-map-legend-pin {
  flex-shrink: 0;
}

.epr-ops-map-marker-pin__ic,
.epr-ops-map-legend-pin__ic {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  line-height: 0;
}

.epr-ops-map-pin-ic {
  width: 18px;
  height: 18px;
  display: block;
}

.epr-proj-detail__mat-overall {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 0.65rem;
}

.epr-proj-detail__mat-overall-k {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bs-secondary-color, #6c757d);
}

.epr-proj-detail__mat-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(4.5rem, 1fr) 3.25rem minmax(8.5rem, 10.5rem);
  gap: 0.35rem 0.5rem;
  align-items: center;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.08));
}

.epr-proj-detail__mat-row:last-child {
  border-bottom: none;
}

.epr-proj-detail__mat-meta {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.epr-proj-detail__mat-code {
  font-size: 0.72rem;
  font-weight: 700;
}

.epr-proj-detail__mat-name {
  font-size: 0.78rem;
  color: var(--bs-body-color, #212529);
}

.epr-proj-detail__mat-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.epr-proj-detail__mat-row > .epr-proj-detail__mat-bar {
  width: 100%;
  min-width: 0;
}

.epr-proj-detail__mat-bar-wrap--lg .epr-proj-detail__mat-bar {
  height: 8px;
}

.epr-proj-detail__mat-bar {
  display: block;
  flex: 1;
  min-width: 2.5rem;
  height: 6px;
  border-radius: 999px;
  background: var(--bs-secondary-bg, #e9ecef);
  overflow: hidden;
}

.epr-proj-detail__mat-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.2s ease;
}

.epr-proj-detail__fill--behind {
  background: linear-gradient(90deg, #f87171, #dc2626);
}

.epr-proj-detail__fill--risk {
  background: linear-gradient(90deg, #fb923c, #ea580c);
}

.epr-proj-detail__fill--ok {
  background: linear-gradient(90deg, #86efac, #22c55e);
}

.epr-proj-detail__mat-pct {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--bs-secondary-color, #6c757d);
  flex-shrink: 0;
  width: 3.25rem;
  min-width: 3.25rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.epr-proj-detail__mat-nums {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--bs-secondary-color, #6c757d);
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.epr-proj-detail__mat-block {
  border: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.08));
  border-radius: 0.45rem;
  overflow: hidden;
}

.epr-proj-detail__mat-block + .epr-proj-detail__mat-block {
  margin-top: 0.45rem;
}

.epr-proj-detail__mat-block-toggle {
  display: grid;
  grid-template-columns: 0.75rem minmax(0, 1fr);
  gap: 0.45rem;
  align-items: center;
  width: 100%;
  padding: 0.4rem 0.55rem;
  border: 0;
  background: var(--bs-tertiary-bg, #f8f9fa);
  text-align: left;
  line-height: 1.25;
}

.epr-proj-detail__mat-block-toggle .epr-menu-section-chevron {
  align-self: center;
}

.epr-proj-detail__mat-block-toggle:not(.collapsed) {
  border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.08));
}

.epr-proj-detail__mat-block-toggle:not(.collapsed) .epr-menu-section-chevron::before {
  transform: translate(-50%, -65%) rotate(45deg);
}

.epr-proj-detail__mat-block-toggle.collapsed .epr-menu-section-chevron::before {
  transform: translate(-65%, -50%) rotate(-45deg);
}

.epr-proj-detail__mat-block-main {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(5rem, 1fr) minmax(8.5rem, 10.5rem);
  gap: 0.35rem 0.5rem;
  align-items: center;
  min-width: 0;
  width: 100%;
}

.epr-proj-detail__mat-meta-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.epr-proj-detail__mat-participant-count {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 600;
}

.epr-proj-detail__mat-block > .collapse {
  margin: 0;
  padding: 0;
}

.epr-proj-detail__mat-block > .collapse:not(.show) {
  display: none;
}

.epr-proj-detail__mat-participants {
  padding: 0.25rem 0.55rem 0.25rem calc(0.55rem + 0.75rem + 0.45rem);
}

.epr-proj-detail__mat-part-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(5rem, 1fr) minmax(8.5rem, 10.5rem);
  gap: 0.35rem 0.5rem;
  align-items: center;
  padding: 0.18rem 0;
  border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.06));
}

.epr-proj-detail__mat-part-row:last-child {
  border-bottom: none;
}

.epr-proj-detail__mat-part-meta {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.epr-proj-detail__mat-part-code {
  font-size: 0.68rem;
  font-weight: 700;
}

.epr-proj-detail__mat-part-name {
  font-size: 0.76rem;
  color: var(--bs-body-color, #212529);
}

.epr-proj-detail__doc-block {
  margin-bottom: 0.85rem;
}

.epr-proj-detail__doc-block:last-child {
  margin-bottom: 0;
}

.epr-proj-detail__doc-h {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--epr-neutral-600, #4b5563);
}

.epr-proj-detail__doc-ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.epr-proj-detail__doc-li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8rem;
  gap: 0.35rem 0.5rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e9ecef;
  font-size: 0.8rem;
}

.epr-proj-detail__doc-li:last-child {
  border-bottom: none;
}

.epr-proj-detail__doc-main {
  min-width: 0;
}

.epr-proj-detail__doc-sub {
  color: var(--epr-neutral-700, #374151);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.epr-proj-detail__doc-st {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--epr-neutral-600, #4b5563);
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  text-align: center;
  width: 100%;
  min-width: 0;
}

.epr-proj-detail__doc-st .epr-status-badge {
  margin-inline: auto;
}

/* Marker: ô vuông bo góc, nền xanh, icon lá trắng */
.epr-org-map-marker-root {
  background: transparent !important;
  border: none !important;
}

.epr-org-map-marker {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(165deg, #43a047 0%, #2e7d32 55%, #1b5e20 100%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
}

.epr-org-map-marker:focus-visible {
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.45), 0 2px 10px rgba(0, 0, 0, 0.28);
}

/* Popup: nền trắng, bo góc — className áp vào wrapper + tip */
.leaflet-popup-content-wrapper.epr-org-map-popup-wrap {
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  border: 1px solid var(--epr-border, #dee2e6);
}

.leaflet-popup-tip.epr-org-map-popup-wrap {
  box-shadow: none;
  border: 1px solid var(--epr-border, #dee2e6);
}

.leaflet-popup-content-wrapper.epr-org-map-popup-wrap .leaflet-popup-content {
  margin: 14px 16px;
  min-width: 200px;
}

.epr-org-map-popup-inner {
  text-align: left;
}

.epr-org-map-popup__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--epr-text-primary);
  line-height: 1.35;
  margin: 0 0 6px;
  padding-right: 1.5rem;
}

.epr-org-map-popup__sub {
  font-size: 0.8125rem;
  color: var(--epr-text-secondary);
  margin: 0 0 6px;
}

.epr-org-map-popup__code {
  font-size: 0.8125rem;
}

.epr-org-map-popup__code code {
  font-size: inherit;
  color: var(--epr-brand-700);
  font-weight: 600;
}

/* Operations map popup — dùng chung trên bản đồ chi tiết dự án */
.epr-ops-map-popup__head {
  margin-bottom: 0.25rem;
}

.epr-ops-map-popup__org-name {
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: break-word;
}

.epr-ops-map-popup__site-type-row {
  margin-top: 0.35rem;
}

.epr-ops-map-popup__site-type {
  margin: 0;
  white-space: nowrap;
}

.epr-ops-map-popup__subtitle {
  font-size: 0.8125rem;
  color: var(--epr-color-text-muted, #64748b);
  margin-bottom: 0.35rem;
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: break-word;
}

.epr-ops-map-popup__link {
  font-size: 0.8125rem;
}

.epr-ops-map-inspector-badge {
  display: inline-block;
  margin: 0 0 0.5rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--epr-surface-muted, #f1f5f9);
  color: var(--bs-secondary-color, #6c757d);
}

.leaflet-container a.leaflet-popup-close-button {
  width: 1.75rem;
  height: 1.75rem;
  font-size: 1.25rem;
  line-height: 1.5rem;
  padding: 0;
  color: var(--epr-text-muted);
  font-weight: 400;
}

.leaflet-container a.leaflet-popup-close-button:hover {
  color: var(--epr-text-primary);
}

.epr-org-detail__map-placeholder {
  min-height: 220px;
}

.epr-batch-lineage-diagram {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.epr-batch-lineage-diagram-layout {
  align-items: stretch;
}

.epr-batch-lineage-diagram__column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
}

.epr-batch-lineage-diagram__column-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--bs-secondary-color, #6c757d);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.epr-batch-lineage-diagram__group {
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 0.5rem;
  background: var(--bs-body-bg, #fff);
  overflow: hidden;
}

.epr-batch-lineage-diagram__head {
  border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.08));
}

.epr-batch-lineage-diagram__toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.epr-batch-lineage-diagram__toggle:hover {
  background: var(--bs-tertiary-bg, rgba(0, 0, 0, 0.03));
}

.epr-batch-lineage-diagram__chevron {
  display: inline-flex;
  flex: 0 0 auto;
  margin-top: 0.125rem;
  transition: transform 0.2s ease;
}

.epr-batch-lineage-diagram__chevron .epr-nav-ic {
  width: 1rem;
  height: 1rem;
}

.epr-batch-lineage-diagram__head-text {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.epr-batch-lineage-diagram__group.is-collapsed .epr-batch-lineage-diagram__head {
  border-bottom: 0;
}

.epr-batch-lineage-diagram__group.is-collapsed .epr-batch-lineage-diagram__chevron {
  transform: rotate(-90deg);
}

.epr-batch-lineage-diagram__group.is-collapsed .epr-batch-lineage-diagram__body {
  display: none;
}

.epr-batch-lineage-diagram__title {
  font-weight: 600;
  font-size: 0.9375rem;
}

.epr-batch-lineage-diagram__flow {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  padding: 1rem;
  overflow-x: auto;
}

.epr-batch-lineage-diagram__side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.75rem;
  flex: 1 1 0;
  min-width: 0;
}

.epr-batch-lineage-diagram__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--bs-secondary-color, #6c757d);
  padding: 0 0.25rem;
}

.epr-batch-lineage-diagram__card {
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 0.375rem;
  padding: 0.75rem;
  background: var(--bs-body-bg, #fff);
  min-width: 10rem;
}

.epr-batch-lineage-diagram__card--current {
  border-color: var(--grac-green-600, #059669);
  box-shadow: 0 0 0 1px rgba(5, 150, 105, 0.15);
}

.epr-batch-lineage-diagram__card-code {
  margin-bottom: 0.25rem;
}

.epr-batch-lineage-diagram__card-desc {
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.epr-batch-lineage-diagram__card-qty {
  margin-bottom: 0.5rem;
}

.epr-batch-lineage-diagram__card-status .badge {
  font-weight: 500;
}

/* Danh sách tổ chức — mã → chi tiết (SPA) */
a.epr-org-list-code-link {
  text-decoration: none;
  color: inherit;
}

a.epr-org-list-code-link:hover {
  text-decoration: underline;
  color: var(--grac-green-800, #065f46);
}

a.epr-batch-lineage-flow-link {
  cursor: pointer;
}

a.epr-batch-lineage-flow-link:hover code {
  text-decoration: underline;
  color: var(--grac-green-800, #065f46);
}

.epr-template {
  display: grid;
  gap: var(--epr-density-section-gap);
}

.epr-template--master-list {
  display: flex;
  flex-direction: column;
  gap: var(--epr-space-2);
  flex: 1 1 auto;
  min-height: 0;
}

/* Detail: breadcrumb / summary cố định — chỉ .epr-template__content cuộn */
.epr-template--detail {
  display: flex;
  flex-direction: column;
  gap: var(--epr-density-section-gap);
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.epr-template--detail>.epr-breadcrumb-toolbar--detail,
.epr-template--detail>.epr-template__header,
.epr-template--detail>.epr-template__summary,
.epr-template--detail>.epr-template__summary-strip {
  flex-shrink: 0;
}

.epr-template--detail>.epr-template__content {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.epr-template--master-list,
.epr-template--form,
.epr-template--detail,
.epr-template--dashboard,
.epr-template--workspace,
.epr-template--operational,
.epr-template--workflow,
.epr-template--lineage,
.epr-template--ai-review,
.epr-template--configuration {
  min-width: 0;
}

.epr-template__header,
.epr-template__toolbar,
.epr-template__summary,
.epr-template__filters,
.epr-template__content,
.epr-template__section,
.epr-template__state {
  min-width: 0;
}

.epr-template--master-list>.epr-breadcrumb-toolbar,
.epr-template--master-list>.epr-template__header,
.epr-template--master-list>.epr-template__toolbar,
.epr-template--master-list>.epr-template__summary,
.epr-template--master-list>.epr-master-list-filter-drawer,
.epr-template--master-list>.epr-template__state {
  flex-shrink: 0;
}

.epr-template--detail>.epr-breadcrumb-toolbar--detail,
.epr-template--detail>.epr-template__header,
.epr-template--detail>.epr-template__summary {
  flex-shrink: 0;
}

.epr-template--master-list .epr-template__content {
  display: flex;
  flex-direction: column;
  gap: var(--epr-space-2);
  flex: 1 1 auto;
  min-height: 0;
}

.epr-template--master-list .epr-template__content>.epr-master-list-table-card,
.epr-template--master-list .epr-template__content>[data-epr-master-list-table-refresh] {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

.epr-template--master-list .epr-template__content>[data-epr-master-list-table-refresh] {
  display: flex;
  flex-direction: column;
}

.epr-template--master-list .epr-template__content>[data-epr-master-list-table-refresh]>.epr-master-list-table-card {
  flex: 1 1 auto;
  min-height: 0;
}

.epr-template--master-list .epr-template__content>*:not(.epr-master-list-table-card):not([data-epr-master-list-table-refresh]) {
  flex-shrink: 0;
}

.epr-template--master-list .epr-summary-card {
  min-height: 4.25rem;
  padding: var(--epr-space-2) var(--epr-space-3);
  gap: var(--epr-space-2);
}

.epr-template--master-list .epr-summary-card__icon-wrap {
  width: 2.5rem;
  height: 2.5rem;
  margin-top: 0;
}

.epr-template--master-list .epr-summary-card__label {
  margin-bottom: var(--epr-space-1);
}

.epr-template--master-list .epr-summary-card__value {
  font-size: clamp(1.875rem, 2.4vw, 2.35rem);
  line-height: 1.1;
}

.epr-master-list-create {
  background: var(--epr-surface-muted);
  box-shadow: var(--epr-shadow-sm);
}

.epr-master-list-create .epr-card__body {
  padding-top: var(--epr-space-4);
}

.epr-master-list-form {
  row-gap: var(--epr-space-3) !important;
}

.epr-form-validation-summary {
  margin-bottom: var(--epr-space-3);
  color: var(--epr-danger);
  font-size: var(--epr-font-size-sm);
}

.epr-form-validation-summary:empty {
  display: none;
}

.epr-master-list-table-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.epr-template--master-list .epr-master-list-table-card>.epr-data-table {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.epr-template--master-list .epr-master-list-table-card>.epr-table-pager {
  flex-shrink: 0;
}

.epr-template--master-list .epr-data-table__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.epr-template--master-list .epr-data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: var(--epr-border-width) solid var(--epr-border);
  vertical-align: bottom;
}

.epr-template--master-list .epr-master-list-table-card tbody tr:nth-child(even)>td {
  background-color: color-mix(in srgb, var(--epr-surface-muted) 65%, var(--epr-surface));
}

.epr-template--master-list .epr-master-list-table-card tbody tr:hover>td {
  background-color: var(--grac-green-25);
}

.epr-col-check {
  width: 2.5rem;
  min-width: 2.5rem;
  max-width: 2.95rem;
  padding-left: var(--epr-space-2) !important;
  padding-right: var(--epr-space-2) !important;
}

/* Checkbox danh sách master: to hơn mặc định một chút */
.epr-template--master-list .epr-master-list-table-card .form-check-input {
  width: 1.03125rem;
  height: 1.03125rem;
  margin-top: 0;
}

.epr-master-list-bulk-toolbar {
  flex-wrap: wrap;
}

.epr-master-list-bulk-toolbar--card {
  flex-shrink: 0;
}

.epr-template--master-list .epr-table-pager {
  padding: var(--epr-space-2) var(--epr-space-3);
}

.epr-template--master-list .epr-table-pager__bar {
  gap: var(--epr-space-2);
}

.epr-template--master-list .epr-master-list-table-card .table> :not(caption)>*>* {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: var(--epr-border-width) solid var(--epr-border);
}

.epr-master-list-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--epr-space-2);
}

.epr-template__summary,
.epr-template__summary-strip,
.epr-template__status-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--epr-space-3);
}

.epr-template__summary-strip,
.epr-template__status-strip {
  padding: 0.75rem 1rem;
  border: var(--epr-border-width) solid var(--epr-border);
  border-radius: var(--epr-card-radius);
  background: var(--epr-surface);
  box-shadow: var(--epr-card-shadow);
}

.epr-template__summary-strip>.epr-master-detail-hero {
  flex: 1 1 100%;
  min-width: 0;
}

.epr-template__grid,
.epr-workspace__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem);
  gap: var(--epr-density-section-gap);
  align-items: start;
}

.epr-template__main,
.epr-workspace__main {
  display: grid;
  gap: var(--epr-density-section-gap);
  min-width: 0;
}

.epr-template__aside,
.epr-workspace__side {
  display: grid;
  gap: var(--epr-space-4);
  min-width: 0;
}

/* Chi tiết master data (tenant, …): hero trong summary strip + khối thuộc tính */
.epr-master-detail-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--epr-space-3);
  width: 100%;
  min-width: 0;
}

.epr-master-detail-hero__avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--epr-radius-md);
  background: var(--grac-green-25);
  color: var(--epr-brand-700);
  font-weight: 700;
  font-size: 0.8125rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--grac-green-100);
}

.epr-master-detail-hero__text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1 1 0;
}

/* Một dải: (tiêu đề + mã) … trạng thái — gọn, không tách lung tung */
.epr-master-detail-hero__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
  width: 100%;
  min-width: 0;
}

.epr-master-detail-hero__head .epr-master-detail-hero__title-row {
  flex: 1 1 12rem;
  min-width: 0;
}

.epr-master-detail-hero__head .epr-master-detail-hero__meta {
  flex: 0 0 auto;
  margin-top: 0;
}

@media (min-width: 768px) {
  .epr-master-detail-hero__head .epr-master-detail-hero__meta {
    margin-inline-start: auto;
  }
}

.epr-master-detail-hero__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--epr-space-2);
}

.epr-master-detail-hero__title {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.25;
  font-weight: var(--epr-section-title-weight);
  color: var(--epr-text-primary);
}

.epr-master-detail-hero__badge-code {
  font-size: var(--epr-font-size-xs);
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--epr-radius-sm);
  background: #eaf4fe;
  color: #1d5f9f;
}

.epr-master-detail-hero__subtitle {
  margin: 0;
  font-size: var(--epr-font-size-xs);
  line-height: 1.35;
  color: var(--epr-text-secondary);
  max-width: 72ch;
}

.epr-master-detail-hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--epr-space-2);
}

.epr-master-detail-kv__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--epr-space-3);
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--epr-border);
}

.epr-master-detail-kv__row:last-child {
  border-bottom: none;
}

.epr-master-detail-kv__label {
  margin: 0;
  font-size: var(--epr-font-size-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--epr-text-secondary);
}

.epr-master-detail-kv__value {
  margin: 0;
  font-size: var(--epr-font-size-sm);
  color: var(--epr-text-primary);
  text-align: right;
}

.epr-template__danger-zone {
  padding: var(--epr-space-4);
  border: var(--epr-border-width) solid rgba(202, 63, 63, 0.32);
  border-radius: var(--epr-card-radius);
  background: #fff7f7;
}

.epr-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--epr-density-section-gap);
}

.epr-dashboard-grid>* {
  grid-column: span 6;
  min-width: 0;
}

.epr-dashboard-grid>.epr-card--wide,
.epr-dashboard-grid>.epr-dashboard-panel--wide,
.epr-dashboard-grid>.epr-data-table {
  grid-column: 1 / -1;
}

.epr-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr));
  gap: var(--epr-space-4);
}

.epr-template--master-list .epr-template__summary.epr-kpi-grid {
  gap: var(--epr-space-3);
}

@media (min-width: 1200px) {
  .epr-template__summary.epr-kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.epr-workspace {
  min-width: 0;
}

.epr-workspace__layout--review {
  grid-template-columns: minmax(20rem, 1fr) minmax(20rem, 28rem);
}

.epr-configuration-nav {
  position: sticky;
  top: calc(var(--epr-topbar-height) + var(--epr-space-4));
}

/* Trang cấu hình một cột (không aside): full width vùng main */
.epr-template__content--full {
  display: block;
  width: 100%;
  min-width: 0;
}

.epr-template__main--full {
  width: 100%;
  max-width: none;
}

.epr-template--configuration .epr-card--configuration {
  width: 100%;
}

.epr-main-inner:has(.epr-template--configuration[data-epr-template="configuration"]) {
  padding-top: var(--epr-space-1) !important;
  padding-bottom: var(--epr-space-2) !important;
  padding-left: var(--epr-space-1) !important;
  padding-right: var(--epr-space-1) !important;
}

code {
  color: var(--epr-text-primary);
  font-family: var(--epr-font-mono);
  font-size: var(--epr-type-code-fs);
  line-height: var(--epr-type-code-lh);
  font-weight: var(--epr-type-code-fw);
  font-variant-numeric: var(--epr-tabular);
}

.epr-global-toast-host {
  position: fixed;
  top: calc(var(--epr-topbar-height) + var(--epr-space-2));
  right: var(--epr-space-4);
  bottom: auto;
  z-index: 1080;
  display: grid;
  gap: var(--epr-space-2);
  width: min(24rem, calc(100vw - 2rem));
  pointer-events: none;
}

.epr-global-toast-host>* {
  pointer-events: auto;
}

.epr-toast {
  padding: var(--epr-space-3) var(--epr-space-4);
  border: var(--epr-border-width) solid var(--epr-border);
  border-radius: var(--epr-radius-lg);
  background: var(--epr-surface);
  box-shadow: var(--epr-shadow-lg);
  color: var(--epr-text-primary);
}

.epr-toast__body {
  font-size: var(--epr-font-size-sm);
  line-height: 1.45;
}

.epr-toast--success {
  border-left: 4px solid var(--bs-success, #198754);
}

.epr-toast--danger {
  border-left: 4px solid var(--bs-danger, #dc3545);
}

.epr-toast--warning {
  border-left: 4px solid var(--bs-warning, #ffc107);
}

.epr-toast--info {
  border-left: 4px solid var(--bs-info, #0dcaf0);
}

.epr-shared-modal-host {
  position: relative;
  z-index: 1070;
}

/* Popup iframe: max ≈ viewport; chiều cao iframe = min(nội dung, max) — resizeEprPopupIframe đặt height px */
[data-epr-dynamic-modal] .modal-dialog {
  max-height: calc(100vh - 2rem);
  margin: 1rem auto;
}

[data-epr-dynamic-modal] .modal-content {
  max-height: calc(100vh - 2rem);
  height: auto;
}

[data-epr-dynamic-modal] .modal-header,
[data-epr-dynamic-modal] .modal-footer {
  flex-shrink: 0;
}

[data-epr-dynamic-modal] .modal-body.epr-modal__body {
  flex: 0 0 auto;
  min-height: 0;
  overflow: hidden;
  display: block;
}

[data-epr-dynamic-modal] .modal-body.epr-modal__body iframe {
  display: block;
  width: 100%;
  min-height: 0 !important;
  border: 0;
  background: var(--epr-surface, #fff);
}

.epr-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1070;
  display: grid;
  place-items: center;
  padding: var(--epr-space-4);
  background: rgba(44, 51, 56, 0.42);
}

.epr-modal-dialog {
  width: min(100%, 40rem);
  max-height: calc(100vh - 3rem);
  overflow: hidden;
  border-radius: var(--epr-card-radius);
  background: var(--epr-surface);
  box-shadow: var(--epr-shadow-lg);
}

.epr-modal-dialog--sm {
  width: min(100%, 28rem);
}

.epr-modal-dialog--lg {
  width: min(100%, 56rem);
}

.epr-modal-dialog--xl {
  width: min(100%, 72rem);
}

.epr-modal__header,
.epr-modal__footer {
  padding: var(--epr-space-4) var(--epr-space-5);
  border-color: var(--epr-border);
}

.epr-modal__header {
  border-bottom: var(--epr-border-width) solid var(--epr-border);
}

.epr-modal__body {
  padding: var(--epr-space-5);
  overflow-y: auto;
}

.epr-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--epr-space-2);
  border-top: var(--epr-border-width) solid var(--epr-border);
}

@media (max-width: 900px) {
  .epr-topbar {
    flex-wrap: wrap;
    height: auto;
    padding-top: var(--epr-space-2);
    padding-bottom: var(--epr-space-2);
  }

  .epr-topbar-left,
  .epr-topbar-tools {
    width: 100%;
  }

  .epr-topbar-tools {
    justify-content: flex-end;
    flex-wrap: wrap;
    row-gap: var(--epr-space-2);
    gap: var(--epr-space-2);
    align-content: flex-start;
  }

  .epr-topbar-actions {
    gap: var(--epr-space-2);
  }

  .epr-page-header,
  .epr-card__header,
  .epr-filter-bar-foundation__header,
  .epr-table-pager,
  .epr-template__summary,
  .epr-template__summary-strip,
  .epr-template__status-strip {
    flex-direction: column;
    align-items: stretch;
  }

  .epr-table-pager__bar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--epr-space-3);
  }

  .epr-table-pager__nav {
    justify-content: center;
  }

  .epr-table-pager__sizes {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: nowrap;
  }

  .epr-template__grid,
  .epr-workspace__layout,
  .epr-workspace__layout--review {
    grid-template-columns: 1fr;
  }

  .epr-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .epr-dashboard-grid>* {
    grid-column: 1 / -1;
  }

  .epr-configuration-nav {
    position: static;
  }

  .epr-page-header__actions,
  .epr-page-toolbar-foundation,
  .epr-row-actions,
  .epr-form-actions {
    justify-content: flex-start;
  }

  .epr-topbar-title {
    display: none;
  }

  .epr-topbar-context-pill {
    max-width: min(100%, 20rem);
  }

  .epr-sidebar {
    flex-basis: var(--epr-sidebar-collapsed);
    width: var(--epr-sidebar-collapsed);
    min-width: var(--epr-sidebar-collapsed);
    max-width: var(--epr-sidebar-collapsed);
  }

  .epr-sidebar .epr-menu-section-label,
  .epr-sidebar .epr-sidebar-link-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

html.epr-popup-html-root {
  height: 100%;
}

html.epr-popup-html-root body.epr-popup-body {
  min-height: 100%;
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Select2 mở trong popup: giữ overflow ẩn — tránh scrollbar dọc thứ hai trên body/modal */
html.epr-popup-html-root.epr-select2-open,
html.epr-popup-html-root.epr-select2-open body.epr-popup-body {
  overflow: hidden !important;
}

html.epr-popup-html-root.epr-select2-open .epr-popup-frame__main {
  overflow: visible !important;
}

/* Dropdown gắn body (popup đổi trạng thái): không ẩn overflow — tránh list bị cắt */
html.epr-popup-html-root.epr-select2-open.epr-select2-body-dropdown,
html.epr-popup-html-root.epr-select2-open.epr-select2-body-dropdown body.epr-popup-body {
  overflow: visible !important;
}

html.epr-popup-html-root.epr-select2-open.epr-select2-body-dropdown .epr-popup-frame,
html.epr-popup-html-root.epr-select2-open.epr-select2-body-dropdown .epr-popup-frame__main {
  overflow: visible !important;
}

[data-epr-dynamic-modal].epr-modal--select2-open .modal-content,
[data-epr-dynamic-modal].epr-modal--select2-open .modal-body.epr-modal__body {
  overflow: hidden !important;
}

[data-epr-dynamic-modal].epr-modal--select2-open.epr-modal--select2-dropdown-body .modal-content,
[data-epr-dynamic-modal].epr-modal--select2-open.epr-modal--select2-dropdown-body .modal-body.epr-modal__body {
  overflow: visible !important;
}

[data-epr-dynamic-modal].epr-modal--select2-open .select2-dropdown {
  z-index: 1090;
}

[data-epr-dynamic-modal].epr-modal--select2-open .select2-container--open {
  z-index: 1085;
}

[data-epr-dynamic-modal].epr-modal--select2-open.epr-modal--select2-dropdown-body .select2-dropdown .select2-results__options {
  max-height: min(20rem, 55vh);
}

body.epr-popup-body .select2-dropdown {
  z-index: 1060;
  max-height: min(16rem, 42vh);
}

body.epr-popup-body .select2-container--open {
  z-index: 10600;
}

.epr-popup-body .epr-popup-frame {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.epr-popup-body .epr-popup-frame__bar {
  flex-shrink: 0;
}

.epr-popup-body .epr-popup-frame__main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0 !important;
}

body.epr-popup-body .epr-popup-form {
  margin-bottom: 0;
}

body.epr-popup-body .epr-popup-form--entity-translation {
  min-height: 10rem;
  padding-bottom: 1rem;
}

body.epr-popup-body .epr-popup-frame__main:has(.epr-popup-form--entity-translation) {
  padding-bottom: 1rem !important;
}

.epr-et-loading {
  align-items: center;
  display: flex;
  gap: 0.625rem;
  justify-content: center;
  min-height: 8rem;
  padding: 1.5rem 0;
}

.epr-et-loading.d-none {
  display: none !important;
}

.epr-et-field {
  background: var(--epr-neutral-100, #f4f6f8);
  border: 1px solid var(--epr-border, #e2e5e9);
  border-radius: 0.625rem;
  padding: 0.875rem 1rem;
}

.epr-et-field--spaced {
  margin-top: 0.875rem;
}

.epr-et-field__title {
  color: var(--epr-neutral-700, #374151);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.625rem;
  text-transform: uppercase;
}

.epr-et-source {
  align-items: baseline;
  background: #fff;
  border: 1px dashed var(--epr-border, #d8dde3);
  border-radius: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 0.625rem;
  margin-bottom: 0.75rem;
  padding: 0.625rem 0.75rem;
}

.epr-et-source__label {
  color: var(--epr-neutral-500, #6b7280);
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 600;
}

.epr-et-source__value {
  color: var(--epr-neutral-800, #1f2937);
  flex: 1 1 auto;
  font-size: 0.9375rem;
  line-height: 1.45;
  min-width: 0;
  word-break: break-word;
}

.epr-et-lang-list {
  background: #fff;
  border: 1px solid var(--epr-border, #e2e5e9);
  border-radius: 0.5rem;
  overflow: hidden;
}

.epr-et-lang-row {
  align-items: center;
  display: grid;
  gap: 0.5rem 0.75rem;
  grid-template-columns: 1fr;
  padding: 0.75rem;
}

.epr-et-lang-row + .epr-et-lang-row {
  border-top: 1px solid var(--epr-border, #eef1f4);
}

.epr-et-lang-row__label-wrap {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.epr-et-lang-row__label {
  color: var(--epr-neutral-700, #374151);
  font-size: 0.8125rem;
  font-weight: 600;
}

.epr-et-manual-badge {
  background-color: var(--grac-green-100, #dcfce7) !important;
  border: 1px solid var(--epr-brand-200, #bbf7d0) !important;
  color: var(--epr-brand-700, #15803d) !important;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.125rem 0.4375rem;
}

.epr-et-lang-row__input .form-control,
.epr-et-lang-row__input .epr-et-readonly {
  min-height: 2rem;
}

.epr-et-lang-row__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

@media (min-width: 768px) {
  .epr-et-lang-row {
    grid-template-columns: 7.5rem 1fr auto;
  }

  .epr-et-lang-row__actions {
    grid-column: auto;
    justify-content: flex-end;
    white-space: nowrap;
  }
}

.epr-popup-form--project-status .epr-project-status-form__spacer,
.epr-popup-form--bulk-status .epr-project-status-form__spacer {
  min-height: 8rem;
  pointer-events: none;
}

.epr-popup-form--reconciliation-workflow .epr-reconciliation-workflow-form__spacer {
  min-height: 8rem;
  pointer-events: none;
}

.epr-popup-form--dispute-workflow .epr-dsp-workflow-dynamic-fields {
  min-height: 8.5rem;
}

.epr-dispute-events-list > li + li {
  border-top: 1px solid var(--bs-border-color);
}

.epr-popup-form--dispute-workflow .epr-dispute-workflow-form__spacer {
  min-height: 8rem;
  pointer-events: none;
}

.epr-popup-form--evidence-review .epr-evidence-review-form__spacer {
  min-height: 8rem;
  pointer-events: none;
}

/* Nút Hủy/Lưu trong iframe + footer modal host: thanh nền full ngang / sát đáy */
[data-epr-dynamic-modal] .modal-footer.epr-modal__footer,
body.epr-popup-body .epr-popup-form__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  margin: 0;
  margin-top: 1rem;
  border-top: 1px solid var(--epr-border, #e2e5e9);
  background: var(--epr-neutral-100, #f4f6f8);
  box-sizing: border-box;
}

/* Full bleed ngang trong main có px-3; đáy main không còn padding (xem _LayoutPopup) */
body.epr-popup-body .epr-popup-frame__main .epr-popup-form__actions {
  margin-left: -1rem;
  margin-right: -1rem;
  margin-bottom: 0;
  width: auto;
  max-width: none;
}

/* Footer modal ngoài: sát cạnh dưới nội dung, full chiều ngang content */
[data-epr-dynamic-modal] .modal-footer.epr-modal__footer {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 0;
  border-radius: 0;
}

body.epr-popup-body .epr-popup-form__actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  box-shadow: none;
}

.epr-popup-footer__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.25;
  padding: 0.45rem 1rem;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.epr-popup-footer__btn--cancel {
  background: #fff;
  border-color: #d1d5db;
  color: #374151;
}

.epr-popup-footer__btn--cancel:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  color: #1f2937;
}

.epr-popup-footer__btn--save {
  background: var(--grac-green-600, #2d9d5c);
  border-color: var(--grac-green-600, #2d9d5c);
  color: #fff;
}

.epr-popup-footer__btn--save:hover {
  background: var(--grac-green-700, #23814d);
  border-color: var(--grac-green-700, #23814d);
  color: #fff;
}

.epr-popup-footer__ic {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  line-height: 0;
}

.epr-popup-footer__btn--save .epr-popup-footer__ic {
  color: #fff;
}

.epr-popup-footer__btn--cancel .epr-popup-footer__ic {
  color: #6b7280;
}

.epr-popup-footer__btn--danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.epr-popup-footer__btn--danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}

.epr-popup-footer__btn--danger .epr-popup-footer__ic {
  color: #fff;
}

/* Modal ngoài: header mint + iframe đủ cao (nội dung form trong iframe) */
.epr-popup-host__header {
  background: var(--grac-green-50, #ecf8f0);
  color: var(--epr-brand-800, #14532d);
  border-bottom: 1px solid var(--epr-brand-200, #bbf7d0);
}

.epr-popup-host__header .modal-title {
  display: flex;
  align-items: center;
  min-width: 0;
}

.epr-popup-host__title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  max-width: 100%;
}

.epr-popup-host__title-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--epr-brand-800, #14532d);
}

.epr-popup-host__title-icon .epr-nav-ic {
  width: 1.25rem;
  height: 1.25rem;
}

.epr-popup-host__title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hộp thoại xác nhận shell (header mint / body text / footer giống popup form) */
#epr-confirm-action-modal .epr-confirm-dialog__header .btn-close {
  filter: none;
  opacity: 0.55;
}

#epr-confirm-action-modal .epr-confirm-dialog__header .btn-close:hover {
  opacity: 0.85;
}

#epr-confirm-action-modal .epr-confirm-dialog__body {
  background: #fff;
  color: var(--epr-text-body, #374151);
  font-size: 0.9375rem;
  line-height: 1.55;
  min-height: 3.25rem;
}

#epr-confirm-action-modal.epr-confirm-dialog--alert-only .epr-confirm-dialog__body {
  color: var(--epr-text-primary);
}

#epr-confirm-action-modal .epr-confirm-dialog__footer {
  margin: 0;
  background: var(--epr-neutral-100, #f4f6f8);
  border-top: 1px solid var(--epr-border, #e2e5e9);
}

#epr-confirm-action-modal .epr-popup-footer__btn--save .epr-popup-footer__ic {
  display: none;
}

/* data-popup-size=md — Bootstrap không có modal-md mặc định */
@media (min-width: 576px) {
  .modal-dialog.modal-md {
    max-width: 600px;
  }
}

.epr-modal__body iframe {
  display: block;
  width: 100%;
  min-height: 22rem;
  border: 0;
  background: var(--epr-surface, #fff);
}

/* Khung form bên trong iframe (_LayoutPopup) — gần WebAdmin */
.epr-popup-frame__bar {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.25rem;
  /*border-radius: var(--epr-radius-md, 0.375rem);
  background: var(--grac-green-50, #ecf8f0);
  border: 1px solid var(--epr-brand-200, #bbf7d0);*/
}

.epr-popup-frame__ic {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 2px;
  background: var(--epr-brand-600, #16a34a);
  flex-shrink: 0;
  opacity: 0.9;
}

.epr-popup-frame__title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  color: var(--epr-brand-800, #14532d);
}

.epr-popup-section__title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--epr-text-muted);
  margin-bottom: 0.85rem;
}

/* Chờ xử lý (ShowWaiting) + Select2 trong vùng nội dung */
.epr-waiting-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(44, 51, 56, 0.35);
}

.epr-waiting-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.epr-waiting-card .spinner-border {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.epr-main .select2-container,
.epr-popup-body .select2-container {
  display: block;
  min-width: 0;
}

.epr-main .select2-container--default .select2-selection--single {
  position: relative;
  height: auto;
  min-height: var(--epr-form-control-min-height);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: var(--epr-form-control-pad-y) calc(var(--epr-form-select-pad-end) + 0.5rem) var(--epr-form-control-pad-y) var(--epr-form-control-pad-x);
  border: var(--epr-border-width, 1px) solid var(--epr-border, #ced4da);
  border-radius: var(--epr-radius-lg, 0.5rem);
  background-color: var(--epr-surface, #fff);
}

.epr-main .select2-container--default .select2-selection--single .select2-selection__rendered,
.epr-popup-body .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 1.4;
  padding-left: 0;
}

.epr-main .select2-container--default .select2-selection--single .select2-selection__arrow,
.epr-popup-body .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
}

/* Select2 allowClear: × cuối ô (trước mũi tên), xám đen giống nút Hủy */
.epr-main .select2-container--default .select2-selection--single .select2-selection__clear,
.epr-popup-body .select2-container--default .select2-selection--single .select2-selection__clear {
  position: absolute;
  right: 1.85rem;
  top: 50%;
  transform: translateY(-55%);
  float: none;
  margin: 0;
  padding: 0;
  width: 1rem;
  height: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7125rem;
  font-weight: 700;
  color: #6b7280;
  border: 1px solid #d1d5db;
  border-radius: 50%;
  background-color: var(--epr-surface, #fff);
  cursor: pointer;
  z-index: 2;
  opacity: 1;
}

.epr-main .select2-container--default .select2-selection--single .select2-selection__clear:hover,
.epr-popup-body .select2-container--default .select2-selection--single .select2-selection__clear:hover {
  background-color: #f9fafb;
  border-color: #9ca3af;
  color: #374151;
}

.epr-main .select2-container--default .select2-selection--single .select2-selection__rendered:has(.select2-selection__clear),
.epr-popup-body .select2-container--default .select2-selection--single .select2-selection__rendered:has(.select2-selection__clear) {
  padding-right: 2.25rem;
}

.epr-main .select2-container.epr-select2-form-wrap--sm .select2-selection--single .select2-selection__clear,
body.epr-popup-body .select2-container.epr-select2-form-wrap--sm .select2-selection--single .select2-selection__clear {
  right: 1.65rem;
  width: 1rem;
  height: 1rem;
  font-size: 0.75rem;
}

.epr-main .select2-container--default .select2-selection--multiple {
  min-height: var(--epr-form-control-min-height);
  box-sizing: border-box;
  padding: 0.25rem 0.5rem;
  border: var(--epr-border-width, 1px) solid var(--epr-border, #ced4da);
  border-radius: var(--epr-radius-lg, 0.5rem);
  background-color: var(--epr-surface, #fff);
}

/* Select2: không dùng class form-select trên .select2-container (tránh 2 mũi tên Bootstrap + Select2). */
.epr-main .select2-container.epr-select2-form-wrap--sm .select2-selection--single {
  min-height: 0;
  height: auto;
  padding: 0.25rem 2rem 0.25rem 0.5rem;
  font-size: 0.875rem;
}

/* Popup iframe: không có .epr-main — trước đây Select2 dùng height 28px mặc định, lệch .form-control */
body.epr-popup-body .select2-container--default .select2-selection--single {
  position: relative;
  height: auto;
  min-height: var(--epr-form-control-min-height);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: var(--epr-form-control-pad-y) calc(var(--epr-form-select-pad-end) + 0.5rem) var(--epr-form-control-pad-y) var(--epr-form-control-pad-x);
  border: var(--epr-border-width, 1px) solid var(--epr-border, #ced4da);
  border-radius: var(--epr-radius-lg, 0.5rem);
  background-color: var(--epr-surface, #fff);
}

body.epr-popup-body .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 1.5;
  padding-left: 0;
  color: var(--epr-text-primary);
  font-size: var(--epr-body-size);
}

body.epr-popup-body .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
}

body.epr-popup-body .select2-container.epr-select2-form-wrap--sm .select2-selection--single {
  min-height: 0;
  height: auto;
  padding: 0.25rem 2rem 0.25rem 0.5rem;
  font-size: 0.875rem;
}

/* Dropdown popup iframe: gắn .epr-popup-frame__main, z-index cao; iframe nới height khi mở (epr-components.js) */
body.epr-popup-body .select2-dropdown {
  z-index: 10500;
}

.epr-popup-frame__main .select2-dropdown {
  z-index: 10500;
}

body.epr-popup-body .select2-dropdown.epr-select2-popup-compact {
  max-height: none;
}

body.epr-popup-body .select2-dropdown.epr-select2-popup-compact .select2-results__options {
  max-height: 10.5rem;
  overflow-y: auto;
  padding-bottom: 0.75rem;
  scroll-padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

body.epr-popup-body .select2-dropdown.epr-select2-popup-compact .select2-results__option:last-child {
  margin-bottom: 0.15rem;
}

body.epr-popup-body .epr-popup-form--dropdown-body .select2-dropdown {
  max-height: none;
}

body.epr-popup-body .epr-popup-form--dropdown-body .select2-dropdown .select2-results__options {
  max-height: min(20rem, 60vh);
}

/* Popup cập nhật trạng thái lô — dropdown trong main; ghi đè cap 16rem + overflow:hidden */
body.epr-popup-body:has(form.epr-batch-status-form) .select2-dropdown.epr-select2-batch-status-dd {
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
}

/* Event Taxonomy popup: chỉ .select2-results__options cuộn — item cuối không bị cắt */
body.epr-popup-body:has(form.epr-event-taxonomy-form) .select2-dropdown {
  max-height: none !important;
  overflow: visible !important;
}

body.epr-popup-body:has(form.epr-event-taxonomy-form) .select2-dropdown .select2-results {
  max-height: none !important;
  overflow: visible !important;
}

body.epr-popup-body:has(form.epr-event-taxonomy-form) .select2-dropdown .select2-results > .select2-results__options {
  max-height: min(10.5rem, 32vh) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-bottom: 0.85rem !important;
  scroll-padding-bottom: 0.65rem !important;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

body.epr-popup-body:has(form.epr-event-taxonomy-form) .select2-dropdown .select2-results__option:last-child {
  margin-bottom: 0.25rem;
}

body.epr-popup-body .select2-dropdown.epr-select2-event-taxonomy-dd {
  max-height: none !important;
  overflow: visible !important;
}

body.epr-popup-body .select2-dropdown.epr-select2-event-taxonomy-dd .select2-results {
  max-height: none !important;
  overflow: visible !important;
}

body.epr-popup-body .select2-dropdown.epr-select2-event-taxonomy-dd .select2-results > .select2-results__options {
  max-height: min(10.5rem, 32vh) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-bottom: 0.85rem !important;
  scroll-padding-bottom: 0.65rem !important;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

html.epr-popup-html-root.epr-select2-open:has(form.epr-event-taxonomy-form) .epr-popup-frame__main {
  overflow: visible !important;
}

body.epr-popup-body:has(form.epr-batch-status-form) .select2-dropdown.epr-select2-batch-status-dd .select2-results__options {
  max-height: min(20rem, calc(100vh - 5rem)) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
}

html.epr-popup-html-root.epr-select2-open:has(form.epr-batch-status-form) .epr-popup-frame__main {
  overflow: visible !important;
}

body.epr-popup-body .epr-popup-frame__main:has(form.epr-batch-status-form) {
  min-height: 0;
  padding: 0.75rem 1rem 0.25rem;
}

body.epr-popup-body form.epr-batch-status-form .mb-3 {
  margin-bottom: 0.75rem !important;
}

/* Popup cập nhật trạng thái User — cùng pattern lô */
body.epr-popup-body:has(form.epr-user-status-form) .select2-dropdown.epr-select2-user-status-dd {
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
}

body.epr-popup-body:has(form.epr-user-status-form) .select2-dropdown.epr-select2-user-status-dd .select2-results__options {
  max-height: min(20rem, calc(100vh - 5rem)) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
}

html.epr-popup-html-root.epr-select2-open:has(form.epr-user-status-form) .epr-popup-frame__main {
  overflow: visible !important;
}

body.epr-popup-body .epr-popup-frame__main:has(form.epr-user-status-form) {
  min-height: 0;
  padding: 0.75rem 1rem 0.25rem;
}

body.epr-popup-body form.epr-user-status-form .mb-2,
body.epr-popup-body form.epr-user-status-form .mb-3 {
  margin-bottom: 0.75rem !important;
}

[data-epr-dynamic-modal] .modal-body.epr-modal__body:has(iframe[src*="/Users/Status"]) iframe {
  min-height: 0 !important;
}

/* Popup cập nhật trạng thái Tenant — cùng pattern User */
body.epr-popup-body:has(form.epr-tenant-status-form) .select2-dropdown.epr-select2-tenant-status-dd {
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
}

body.epr-popup-body:has(form.epr-tenant-status-form) .select2-dropdown.epr-select2-tenant-status-dd .select2-results__options {
  max-height: min(20rem, calc(100vh - 5rem)) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
}

html.epr-popup-html-root.epr-select2-open:has(form.epr-tenant-status-form) .epr-popup-frame__main {
  overflow: visible !important;
}

body.epr-popup-body .epr-popup-frame__main:has(form.epr-tenant-status-form) {
  min-height: 0;
  padding: 0.75rem 1rem 0.25rem;
}

body.epr-popup-body form.epr-tenant-status-form .mb-2,
body.epr-popup-body form.epr-tenant-status-form .mb-3 {
  margin-bottom: 0.75rem !important;
}

[data-epr-dynamic-modal] .modal-body.epr-modal__body:has(iframe[src*="/Tenants/Status"]) iframe {
  min-height: 0 !important;
}

/* Popup khóa/mở khóa User — cùng pattern trạng thái User */
body.epr-popup-body:has(form.epr-user-lock-form) .select2-dropdown.epr-select2-user-lock-dd {
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
}

body.epr-popup-body:has(form.epr-user-lock-form) .select2-dropdown.epr-select2-user-lock-dd .select2-results__options {
  max-height: min(20rem, calc(100vh - 5rem)) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
}

html.epr-popup-html-root.epr-select2-open:has(form.epr-user-lock-form) .epr-popup-frame__main {
  overflow: visible !important;
}

body.epr-popup-body .epr-popup-frame__main:has(form.epr-user-lock-form) {
  min-height: 0;
  padding: 0.75rem 1rem 0.25rem;
}

body.epr-popup-body form.epr-user-lock-form .mb-2,
body.epr-popup-body form.epr-user-lock-form .mb-3 {
  margin-bottom: 0.75rem !important;
}

[data-epr-dynamic-modal] .modal-body.epr-modal__body:has(iframe[src*="/Users/Lock"]) iframe {
  min-height: 0 !important;
}

/* Popup cập nhật trạng thái Site — cùng pattern lô */
body.epr-popup-body:has(form.epr-site-status-form) .select2-dropdown.epr-select2-site-status-dd {
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
}

body.epr-popup-body:has(form.epr-site-status-form) .select2-dropdown.epr-select2-site-status-dd .select2-results__options {
  max-height: min(20rem, calc(100vh - 5rem)) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
}

html.epr-popup-html-root.epr-select2-open:has(form.epr-site-status-form) .epr-popup-frame__main {
  overflow: visible !important;
}

body.epr-popup-body .epr-popup-frame__main:has(form.epr-site-status-form) {
  min-height: 0;
  padding: 0.75rem 1rem 0.25rem;
}

body.epr-popup-body form.epr-site-status-form .mb-2,
body.epr-popup-body form.epr-site-status-form .mb-3 {
  margin-bottom: 0.75rem !important;
}

[data-epr-dynamic-modal] .modal-body.epr-modal__body:has(iframe[src*="/Sites/Status"]) iframe {
  min-height: 0 !important;
}

/* Popup cập nhật trạng thái RO — cùng pattern lô */
body.epr-popup-body:has(form.epr-ro-status-form) .select2-dropdown.epr-select2-ro-status-dd {
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
}

body.epr-popup-body:has(form.epr-ro-status-form) .select2-dropdown.epr-select2-ro-status-dd .select2-results__options {
  max-height: min(20rem, calc(100vh - 5rem)) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
}

html.epr-popup-html-root.epr-select2-open:has(form.epr-ro-status-form) .epr-popup-frame__main {
  overflow: visible !important;
}

body.epr-popup-body .epr-popup-frame__main:has(form.epr-ro-status-form) {
  min-height: 0;
  padding: 0.75rem 1rem 0.25rem;
}

body.epr-popup-body form.epr-ro-status-form .mb-2,
body.epr-popup-body form.epr-ro-status-form .mb-3 {
  margin-bottom: 0.75rem !important;
}

[data-epr-dynamic-modal] .modal-body.epr-modal__body:has(iframe[src*="/RecycleOrders/Status"]) iframe {
  min-height: 0 !important;
}

/* Popup cập nhật trạng thái lô tái chế — cùng pattern RO */
body.epr-popup-body:has(form.epr-rl-status-form) .select2-dropdown.epr-select2-rl-status-dd {
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
}

body.epr-popup-body:has(form.epr-rl-status-form) .select2-dropdown.epr-select2-rl-status-dd .select2-results__options {
  max-height: min(20rem, calc(100vh - 5rem)) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-bottom: 0.65rem !important;
  scroll-padding-bottom: 0.5rem !important;
  -webkit-overflow-scrolling: touch;
}

body.epr-popup-body:has(form.epr-rl-status-form) .select2-dropdown.epr-select2-rl-status-dd .select2-results__option:last-child {
  margin-bottom: 0.15rem;
}

html.epr-popup-html-root.epr-select2-open:has(form.epr-rl-status-form) .epr-popup-frame__main {
  overflow: visible !important;
}

body.epr-popup-body .epr-popup-frame__main:has(form.epr-rl-status-form) {
  min-height: 0;
  padding: 0.75rem 1rem 0.25rem;
}

body.epr-popup-body form.epr-rl-status-form .mb-2 {
  margin-bottom: 0.75rem !important;
}

[data-epr-dynamic-modal] .modal-body.epr-modal__body:has(iframe[src*="/RecycleLots/Status"]) iframe {
  min-height: 0 !important;
}

/* Popup cập nhật trạng thái phiếu cân — cùng pattern lô tái chế */
body.epr-popup-body:has(form.epr-weigh-record-status-form) .select2-dropdown.epr-select2-weigh-record-status-dd {
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
}

body.epr-popup-body:has(form.epr-weigh-record-status-form) .select2-dropdown.epr-select2-weigh-record-status-dd .select2-results__options {
  max-height: min(20rem, calc(100vh - 5rem)) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-bottom: 0.65rem !important;
  scroll-padding-bottom: 0.5rem !important;
  -webkit-overflow-scrolling: touch;
}

body.epr-popup-body:has(form.epr-weigh-record-status-form) .select2-dropdown.epr-select2-weigh-record-status-dd .select2-results__option:last-child {
  margin-bottom: 0.15rem;
}

html.epr-popup-html-root.epr-select2-open:has(form.epr-weigh-record-status-form) .epr-popup-frame__main {
  overflow: visible !important;
}

body.epr-popup-body .epr-popup-frame__main:has(form.epr-weigh-record-status-form) {
  min-height: 11rem;
  padding: 0.75rem 1rem 0.25rem;
}

body.epr-popup-body form.epr-weigh-record-status-form .mb-2 {
  margin-bottom: 0.75rem !important;
}

[data-epr-dynamic-modal] .modal-body.epr-modal__body:has(iframe[src*="/WeighRecords/Status"]) iframe {
  min-height: 14rem !important;
}

/* Popup tách/gộp lô — danh sách lô con / lô nguồn: tối thiểu 2 dòng, cuộn khi thêm dòng */
.epr-batch-split-rows,
.epr-batch-merge-rows {
  --epr-batch-split-row-block: 4.25rem;
  --epr-batch-split-row-gap: 0.5rem;
  min-height: calc(2 * var(--epr-batch-split-row-block) + var(--epr-batch-split-row-gap));
  max-height: calc(2 * var(--epr-batch-split-row-block) + var(--epr-batch-split-row-gap));
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.125rem;
}

.epr-batch-merge-rows {
  --epr-batch-split-row-block: 4.75rem;
}

.epr-batch-merge-result-kl {
  background: var(--epr-surface-muted, #f4f6f8);
  color: var(--grac-green-900, #0f3d2e);
  font-weight: var(--epr-font-weight-semibold);
  cursor: default;
}

body.epr-popup-body .epr-popup-frame__main:has(#epr-batch-split-merge-form) {
  flex: 0 1 auto;
  min-height: 0;
  padding-bottom: 0 !important;
}

body.epr-popup-body:has(#epr-batch-split-merge-form) {
  height: auto;
  min-height: 0;
}

body.epr-popup-body:has(#epr-batch-split-merge-form) .epr-popup-frame {
  flex: 0 1 auto;
}

body.epr-popup-body form#epr-batch-split-merge-form {
  padding-bottom: 0;
}

body.epr-popup-body form#epr-batch-split-merge-form .epr-popup-form__actions {
  margin-top: 0.75rem;
  position: static;
}

[data-epr-dynamic-modal] .modal-body.epr-modal__body:has(iframe[src*="/Batches/Status"]) iframe {
  min-height: 0 !important;
}

/* ---- Select2: dropdown, hover, ô tìm kiếm (GRAC) ---- */
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.select2-dropdown {
  border: var(--epr-border-width, 1px) solid var(--grac-green-600, #2d9d5c) !important;
  border-radius: var(--epr-radius-lg, 0.5rem);
  box-shadow: none;
  overflow: hidden;
  background: var(--epr-surface, #fff);
  padding-bottom: 0.2rem;
  /*border-top: 0 !important;*/
}

/* Dropdown ngay dưới ô select (cùng dropdownParent): nối viền với phần trên */
.select2-container--default.select2-container--open+.select2-dropdown {
  border-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  margin-top: -1px;
  box-shadow: none;
}

.select2-container--default .select2-search--dropdown {
  position: relative;
  padding: 0.5rem 0.65rem 0.35rem;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--epr-border, #ced4da);
  border-radius: var(--epr-radius-md, 0.375rem);
  padding: 0.42rem 0.65rem;
  font-size: var(--epr-body-size, 0.9375rem);
  line-height: 1.4;
  color: var(--epr-text-primary, #1f2937);
  background-color: var(--epr-surface, #fff);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.select2-container--default .select2-search--dropdown .select2-search__field::placeholder {
  color: var(--epr-text-muted, #6b7280);
  opacity: 1;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
  border-color: var(--grac-green-600, #2d9d5c);
  outline: none;
  background-color: var(--epr-surface, #fff);
  box-shadow: none;
}

.select2-container--default .select2-results>.select2-results__options {
  max-height: 16rem;
  padding: 0.3rem 0.25rem 0.4rem;
}

.select2-container--default .select2-results__option {
  padding: 0.45rem 0.7rem;
  margin: 0.1rem 0.2rem;
  border-radius: var(--epr-radius-sm, 0.375rem);
  font-size: var(--epr-body-size, 0.9375rem);
  line-height: 1.45;
  color: var(--epr-text-primary, #374151);
  transition: background-color 0.12s ease, color 0.12s ease;
}

.select2-container--default .select2-results__option--selectable:hover,
.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--grac-green-50, #ecf8f0) !important;
  color: var(--grac-green-900, #14532d) !important;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
  background-color: var(--grac-green-25, #f4faf6);
  color: var(--grac-green-800, #166534);
  font-weight: 500;
}

.select2-container--default .select2-results__option--disabled {
  color: var(--epr-text-muted, #6b7280);
  background-color: var(--epr-surface-subtle, #f3f4f6);
  border-left: 3px solid var(--epr-border-strong, #d1d5db);
  cursor: not-allowed;
  opacity: 0.8;
}

.select2-container--default .select2-results__option--disabled.select2-results__option--highlighted,
.select2-container--default .select2-results__option--disabled:hover {
  background-color: var(--epr-surface-subtle, #f3f4f6) !important;
  color: var(--epr-text-muted, #6b7280) !important;
}

.select2-container--default .select2-results__option .epr-select2-quick-create-option {
  color: var(--grac-green-700, #15803d);
  font-weight: 500;
}

.select2-container--default .select2-results__message .epr-select2-quick-create-option {
  display: block;
  padding: 0.125rem 0;
  color: var(--grac-green-700, #15803d);
  font-weight: 500;
}

/* Select2: viền xanh chỉ khi đã click mở (không hover/ focus khi đóng) */
.epr-main .select2-container--default.select2-container--open .select2-selection--single,
.epr-main .select2-container--default.select2-container--open .select2-selection--multiple,
.epr-popup-body .select2-container--default.select2-container--open .select2-selection--single,
.epr-popup-body .select2-container--default.select2-container--open .select2-selection--multiple,
body.epr-popup-body .select2-container--default.select2-container--open .select2-selection--single,
body.epr-popup-body .select2-container--default.select2-container--open .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
  border: var(--epr-border-width, 1px) solid var(--grac-green-600, #2d9d5c);
  box-shadow: none;
  outline: none;
  border-bottom: none !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
  border-radius: var(--epr-radius-pill, 999px);
  border-color: color-mix(in srgb, var(--grac-green-600, #2d9d5c) 25%, var(--epr-border));
  background: var(--grac-green-50, #ecf8f0);
  color: var(--grac-green-900, #14532d);
}

/* ---- Trang đăng nhập (_LayoutLogin) ---- */
body.epr-login-page {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--epr-font-sans, system-ui, sans-serif);
  color: var(--epr-text-primary);
}

.epr-login {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem 2.5rem;
  box-sizing: border-box;
}

.epr-login__bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: #134e32;
  background-image: url("/assets/images/BG-Login-01.png");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
}

.epr-login__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 26rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
}

.epr-login__hero {
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.2);
}

.epr-login__logo {
  display: block;
  width: min(100%, 20rem);
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.28));
}

.epr-login__mark {
  font-size: clamp(2.25rem, 6vw, 2.85rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.1;
  font-family: var(--epr-font-display, var(--epr-font-sans, system-ui));
}

.epr-login__tagline {
  margin: 0.65rem 0 0;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.96;
}

.epr-login__card {
  width: 100%;
  background: #fff;
  border-radius: 1.75rem;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2), 0 4px 16px rgba(0, 0, 0, 0.08);
  padding: 2rem 1.75rem 1.5rem;
}

.epr-login__card-head {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.25rem;
}

.epr-login__form {
  margin: 0;
}

.epr-login__field {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 9999px;
  padding: 0.65rem 1.15rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.epr-login__field:focus-within {
  border-color: rgba(45, 157, 92, 0.45);
  box-shadow: 0 0 0 3px rgba(45, 157, 92, 0.2);
}

.epr-login__field--user {
  background: #f0f0f0;
}

.epr-login__field--pass {
  background: #e8f0fe;
}

.epr-login__ic {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: #6b7280;
}

.epr-login__input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--epr-text-primary);
  outline: none;
}

.epr-login__input::placeholder {
  color: #9ca3af;
}

.epr-login__submit {
  width: 100%;
  margin-top: 0.35rem;
  border: 0;
  border-radius: 9999px;
  padding: 0.72rem 1.25rem;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--grac-green-600, #2d9d5c);
  box-shadow: 0 4px 14px rgba(26, 107, 63, 0.38);
  transition: background 0.15s ease, transform 0.06s ease;
}

.epr-login__submit:hover {
  background: var(--grac-green-700, #23814d);
  color: #fff;
}

.epr-login__submit:active {
  transform: scale(0.99);
}

.epr-login__hint {
  line-height: 1.45;
}

.epr-login__hint code {
  font-size: 0.8125em;
}

/* Thông báo lỗi đăng nhập: không nền / không viền, chữ đỏ */
.epr-login__error,
.epr-login__feedback {
  margin: 0;
  padding: 10px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--epr-danger, #e53935);
  font-weight: 500;
}

.epr-login__feedback ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--grac-green-800);
  letter-spacing: -0.02em;
}

/* --- Navigation menus: tree + table workbench --- */
.tpl-page--nav-menu-workbench .epr-template__summary {
  display: none;
}

.epr-nav-menu-workbench__layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: var(--epr-space-4, 1rem);
  align-items: start;
}

@media (max-width: 991.98px) {
  .epr-nav-menu-workbench__layout {
    grid-template-columns: 1fr;
  }
}

.epr-nav-menu-workbench__sidebar {
  overflow: hidden;
}

.epr-nav-menu-workbench__sidebar-head {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--epr-border, #e5e7eb);
}

.epr-nav-menu-workbench__tab-all.is-active {
  background: var(--grac-green-50, #ecfdf5) !important;
  border-color: var(--grac-green-400, #34d399) !important;
  color: var(--grac-green-800, #065f46) !important;
  font-weight: 600;
}

.epr-nav-menu-workbench__tab-all:focus,
.epr-nav-menu-workbench__tab-all:active:focus {
  box-shadow: none;
}

.epr-nav-menu-workbench__tree-wrap {
  max-height: min(70vh, 640px);
  overflow: auto;
}

.epr-nav-menu-workbench__tree .epr-nav-menu-tree__list {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.5rem;
}

.epr-nav-menu-workbench__tree .epr-nav-menu-tree__item {
  position: relative;
  margin: 0;
  padding-left: 0.35rem;
}

.epr-nav-menu-workbench__tree .epr-nav-menu-tree__item>.epr-nav-menu-tree__list {
  margin-left: 0.5rem;
  padding-left: 0.5rem;
  border-left: 1px dashed var(--epr-border, #d1d5db);
}

.epr-nav-menu-workbench__tree .epr-nav-menu-tree__node {
  color: var(--epr-text-primary, #111827);
  border-radius: 0.25rem;
  width: 100%;
}

.epr-nav-menu-workbench__tree .epr-nav-menu-tree__node:hover {
  background: rgba(0, 0, 0, 0.04);
}

.epr-nav-menu-workbench__tree .epr-nav-menu-tree__node.is-active {
  background: var(--grac-green-50, #ecfdf5);
  color: var(--grac-green-800, #065f46);
  font-weight: 600;
}

.epr-nav-menu-workbench__main {
  overflow: hidden;
}

.epr-modal-section__ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: var(--grac-green-100);
  color: var(--grac-green-700);
}

/* Organization form — gợi ý địa chỉ (Nominatim / OSM) */
.epr-nominatim-input-row.is-epr-nominatim-fetching .epr-nominatim-address-input {
  padding-right: 2.35rem;
}

.epr-nominatim-loading {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  display: none;
  align-items: center;
  pointer-events: none;
}

.epr-nominatim-input-row.is-epr-nominatim-fetching .epr-nominatim-loading {
  display: flex;
}

.epr-nominatim-wrap .epr-nominatim-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 1080;
  margin-top: 2px;
  max-height: 14rem;
  overflow: auto;
  background: var(--epr-surface, #fff);
  border: 1px solid var(--epr-border, #e5e7eb);
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
}

.epr-nominatim-suggest__item {
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  font-size: var(--epr-font-size-sm, 0.875rem);
  line-height: 1.35;
  border-bottom: 1px solid var(--epr-border, #f3f4f6);
}

.epr-nominatim-suggest__item:last-child {
  border-bottom: none;
}

.epr-nominatim-suggest__item:hover,
.epr-nominatim-suggest__item:focus {
  background: var(--grac-green-50, #ecfdf5);
}

.epr-nominatim-attribution {
  font-size: 0.7rem;
  line-height: 1.35;
  opacity: 0.85;
}

.epr-site-map-picker__map {
  width: 100%;
  min-height: min(62vh, 34rem);
  border: 1px solid var(--epr-border, #e5e7eb);
  border-radius: 0.5rem;
  overflow: hidden;
}

.epr-site-map-picker__search {
  position: relative;
}

.epr-site-map-picker__suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 1090;
  max-height: 14rem;
  overflow: auto;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
}

.epr-site-map-picker__suggest-item {
  font-size: var(--epr-font-size-sm, 0.875rem);
  line-height: 1.35;
  text-align: left;
}

/* KPI accent — membership tenant scope */
.epr-summary-card--accent-orange {
  border-color: rgba(234, 88, 12, 0.28);
}

.epr-summary-card--accent-orange .epr-summary-card__icon-wrap {
  background: rgba(234, 88, 12, 0.12);
}

.epr-summary-card--accent-orange .epr-summary-card__icon {
  color: #c2410c;
}

/* Trang Forbidden / Error 401 */
.epr-access-denied {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: min(28rem, calc(100vh - 12rem));
  padding: 2rem 1rem;
}

body.epr-login-page .epr-access-denied {
  min-height: min(32rem, 100vh);
  padding: 2.5rem 1.25rem;
}

.epr-access-denied__card {
  width: 100%;
  max-width: 28rem;
  padding: 2rem 1.75rem 1.5rem;
  text-align: center;
  border-radius: var(--epr-radius-lg, 0.5rem);
  border: 1px solid var(--epr-border, #e2e5e9);
  background: var(--epr-surface, #fff);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 32px rgba(15, 23, 42, 0.08);
}

.epr-access-denied__code {
  margin: 0 0 0.35rem;
  font-size: clamp(3.25rem, 10vw, 4.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: #c98a1a;
  background: linear-gradient(165deg, #e8b84a 0%, #c98a1a 55%, #a86f12 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.epr-access-denied__icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  margin: 0.25rem auto 1rem;
  border-radius: 999px;
  background: var(--grac-green-25, #ecfdf5);
  border: 1px solid var(--grac-green-100, #d1fae5);
  color: var(--epr-brand-700, #047857);
}

.epr-access-denied__icon-wrap svg {
  width: 1.5rem;
  height: 1.5rem;
}

.epr-access-denied__title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e3a5f;
}

.epr-access-denied__message {
  margin: 0 auto 1.25rem;
  max-width: 22rem;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--epr-text-muted, #4b5563);
}

.epr-access-denied__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.epr-access-denied__btn {
  min-width: 8.5rem;
  font-weight: 600;
}

/* Popup gán membership — header xanh nhạt */
.epr-membership-assign-form__head {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.65rem 0.75rem;
  margin: -0.25rem -0.25rem 0.75rem;
  border-radius: var(--epr-radius-md, 0.375rem);
  background: var(--grac-green-25, #ecfdf5);
  border: 1px solid var(--grac-green-100, #d1fae5);
}

.epr-membership-assign-form__ic {
  display: inline-flex;
  color: var(--epr-brand-700, #047857);
  flex-shrink: 0;
}

.epr-membership-assign-form__ic svg {
  width: 1.25rem;
  height: 1.25rem;
}

.epr-membership-assign-form__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--epr-brand-800, #065f46);
}

.epr-membership-assign-form__lead {
  font-size: 0.8125rem;
  color: var(--epr-text-muted, #4b5563);
  margin-top: 0.15rem !important;
}

.epr-password-field {
  position: relative;
  display: block;
  width: 100%;
}

.epr-password-field__input {
  width: 100%;
  padding-right: 2.75rem;
}

.epr-password-field__input:focus {
  border-color: var(--grac-green-400, #4ade80);
  box-shadow: 0 0 0 0.2rem rgba(74, 222, 128, 0.15);
}

.epr-password-field__toggle {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--epr-text-muted, #64748b);
  border-radius: var(--epr-radius-sm, 0.25rem);
  cursor: pointer;
}

.epr-password-field__toggle:hover {
  color: var(--epr-brand-700, #047857);
  background: var(--grac-green-25, #ecfdf5);
}

.epr-password-field__toggle:focus-visible {
  outline: 2px solid var(--grac-green-400, #4ade80);
  outline-offset: 2px;
}

.epr-password-field__icon svg {
  display: block;
}

/* Popup Thêm đơn bán — một scrollbar dọc (main); bảng vật liệu cuộn ngang khi cần */
.epr-popup-frame__main:has(.epr-popup-form--order-add) {
  overflow-x: hidden;
}

.epr-popup-frame__main:has(.epr-popup-form--select2-stable) {
  overflow-x: hidden;
}

body.epr-popup-body:has(.epr-popup-form--order-add) .epr-popup-frame__main {
  overflow-y: auto;
  overflow-x: hidden;
}

body.epr-popup-body:has(.epr-popup-form--select2-stable) .epr-popup-frame__main {
  overflow-y: auto;
  overflow-x: hidden;
}

body.epr-popup-body:has(.epr-popup-form--order-add).epr-select2-open .epr-popup-frame__main {
  overflow-y: auto;
}

body.epr-popup-body:has(.epr-popup-form--select2-stable).epr-select2-open .epr-popup-frame__main {
  overflow-y: auto;
}

.epr-popup-form--order-add .epr-order-add-source-panel .epr-order-add-source-wrap {
  border: 1px solid var(--grac-green-100, rgba(46, 125, 50, 0.22));
  border-radius: var(--epr-radius-sm, 8px);
  background: var(--epr-neutral-50, #f8faf9);
  overflow-x: auto;
  overflow-y: visible;
  max-height: none;
}

.epr-popup-form--order-add .epr-order-add-source-table {
  font-size: 0.8125rem;
  margin-bottom: 0;
}

.epr-popup-form--order-add .epr-table-wrap--order-add-items {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  max-height: none;
  -webkit-overflow-scrolling: touch;
}

.epr-popup-form--order-add .epr-order-add-items {
  --epr-so-row-control-h: 1.85rem;
  table-layout: fixed;
  width: 100%;
  min-width: 30rem;
  max-width: 100%;
  font-size: 0.72rem;
  margin-bottom: 0;
}

.epr-popup-form--order-add .epr-order-add-items thead th {
  white-space: nowrap;
  font-size: 0.58rem;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  vertical-align: middle;
}

.epr-popup-form--order-add .epr-order-add-items th,
.epr-popup-form--order-add .epr-order-add-items td {
  padding: 0.28rem 0.32rem;
  vertical-align: middle;
  min-width: 0;
}

.epr-popup-form--order-add .epr-order-add-items .form-select,
.epr-popup-form--order-add .epr-order-add-items .form-control {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 0.72rem;
  height: var(--epr-so-row-control-h);
  min-height: var(--epr-so-row-control-h);
  padding: 0 0.35rem;
  line-height: calc(var(--epr-so-row-control-h) - 2px);
}

.epr-popup-form--order-add .epr-order-add-items .select2-container {
  width: 100% !important;
  max-width: 100%;
  min-width: 0;
}

.epr-popup-form--order-add .epr-order-add-items .select2-container .select2-selection--single {
  height: var(--epr-so-row-control-h) !important;
  min-height: var(--epr-so-row-control-h) !important;
  box-sizing: border-box;
}

.epr-popup-form--order-add .epr-order-add-items .select2-container .select2-selection__rendered {
  padding-left: 0.35rem;
  padding-right: 1.25rem;
  font-size: 0.72rem;
  line-height: calc(var(--epr-so-row-control-h) - 2px) !important;
}

.epr-popup-form--order-add .epr-order-add-items .select2-container .select2-selection__arrow {
  height: calc(var(--epr-so-row-control-h) - 2px) !important;
  top: 0 !important;
}

.epr-popup-form--order-add .epr-order-add-items .form-select-sm {
  padding-top: 0;
  padding-bottom: 0;
}

.epr-popup-form--order-add .epr-order-add-items td.text-end .form-control {
  text-align: right;
}

.epr-popup-form--select2-stable .epr-table-wrap--order-add-items {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  max-height: none;
  -webkit-overflow-scrolling: touch;
}

/* Recycle Lot — vật liệu đầu ra luôn hiển thị tiêu đề, picker và header bảng */
.epr-popup-form--order-add .epr-rl-output-materials-section > h3 {
  display: block;
  visibility: visible;
}

.epr-popup-form--order-add .epr-rl-output-material-picker-wrap {
  display: block;
  min-height: 2.5rem;
}

.epr-popup-form--order-add .epr-rl-output-materials-table-wrap {
  display: block;
  min-height: 2.75rem;
}

.epr-popup-form--order-add .epr-rl-output-materials-table-wrap .epr-order-add-items thead {
  display: table-header-group;
}

.epr-popup-form--order-add .epr-order-add-items--rl-output {
  min-width: 28rem;
}

.epr-popup-form--order-add .epr-order-add-items--rl-output th:nth-child(2),
.epr-popup-form--order-add .epr-order-add-items--rl-output td:nth-child(2) {
  width: auto;
}

.epr-popup-form--order-add .epr-order-add-items--rl-output th:nth-child(3),
.epr-popup-form--order-add .epr-order-add-items--rl-output td:nth-child(3) {
  width: 11rem;
}

.epr-popup-form--order-add .epr-order-add-items--rl-output th:nth-child(4),
.epr-popup-form--order-add .epr-order-add-items--rl-output td:nth-child(4) {
  width: 9rem;
}

#epr-recycle-lot-create-form,
#epr-recycle-lot-edit-form {
  margin-bottom: 0;
}

#epr-recycle-lot-create-form .epr-rl-io-suggestions-panel,
#epr-recycle-lot-edit-form .epr-rl-io-suggestions-panel {
  margin-bottom: 0;
}

.epr-popup-form--order-add .epr-rl-row-remove {
  min-width: 1.75rem;
  min-height: 1.75rem;
  padding: 0;
  line-height: 1;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--bs-danger, #dc3545);
  box-shadow: none;
}

.epr-popup-form--order-add .epr-rl-row-remove:hover,
.epr-popup-form--order-add .epr-rl-row-remove:focus {
  color: var(--bs-danger, #dc3545);
  background-color: transparent;
  box-shadow: none;
}

.epr-popup-form--order-add .epr-rl-row-remove:focus-visible {
  outline: 2px solid rgba(220, 53, 69, 0.45);
  outline-offset: 1px;
}

.epr-rl-output-material-row--highlight {
  animation: epr-rl-output-material-highlight 1.6s ease-out;
}

@keyframes epr-rl-output-material-highlight {
  0% {
    background-color: rgba(45, 157, 92, 0.22);
  }
  100% {
    background-color: transparent;
  }
}

.epr-popup-form--select2-stable .epr-order-add-items {
  --epr-so-row-control-h: 1.85rem;
  table-layout: fixed;
  width: 100%;
  min-width: 30rem;
  max-width: 100%;
  font-size: 0.72rem;
  margin-bottom: 0;
}

.epr-popup-form--select2-stable .epr-order-add-items thead th {
  white-space: nowrap;
  font-size: 0.68rem;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  vertical-align: middle;
}

.epr-popup-form--select2-stable .epr-order-add-items th,
.epr-popup-form--select2-stable .epr-order-add-items td {
  padding: 0.28rem 0.32rem;
  vertical-align: middle;
  min-width: 0;
}

.epr-popup-form--select2-stable .epr-order-add-items .form-select,
.epr-popup-form--select2-stable .epr-order-add-items .form-control {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 0.72rem;
  height: var(--epr-so-row-control-h);
  min-height: var(--epr-so-row-control-h);
  padding: 0 0.35rem;
  line-height: calc(var(--epr-so-row-control-h) - 2px);
}

.epr-popup-form--select2-stable .epr-order-add-items td.text-end .form-control {
  text-align: right;
}

/* Popup cấu hình vật liệu tổ chức — bảng cuộn, footer cố định đáy */
body.epr-popup-body:has(.epr-popup-form--org-material-alias) .epr-popup-frame__main {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.epr-popup-form--org-material-alias {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 100%;
  box-sizing: border-box;
}

.epr-popup-form--org-material-alias .epr-org-mat-alias-table-scroll {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-height: min(10rem, 22vh);
  max-height: none;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: var(--epr-radius-sm, 8px);
  background: var(--bs-body-bg, #fff);
}

.epr-popup-form--org-material-alias .epr-org-mat-alias-table-scroll .epr-table-wrap--order-add-items {
  overflow: visible;
  max-height: none;
}

.epr-popup-form--org-material-alias .epr-org-mat-alias-table-scroll .epr-order-add-items thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bs-table-bg, #f8f9fa);
  box-shadow: inset 0 -1px 0 var(--bs-border-color, #dee2e6);
}

.epr-popup-form--org-material-alias .epr-popup-form__actions {
  margin-top: auto;
  flex-shrink: 0;
  position: static;
}

.epr-popup-form--org-material-alias .epr-order-add-items {
  table-layout: fixed;
}

.epr-popup-form--org-material-alias .epr-order-add-items col.epr-org-mat-alias-col-line {
  width: 1.75rem;
}

.epr-popup-form--org-material-alias .epr-order-add-items col.epr-org-mat-alias-col-remove {
  width: 1.65rem;
}

.epr-popup-form--org-material-alias .epr-order-add-items th:nth-child(1),
.epr-popup-form--org-material-alias .epr-order-add-items td:nth-child(1) {
  width: 1.75rem;
  max-width: 1.75rem;
  padding-left: 0.12rem;
  padding-right: 0.12rem;
  text-align: center;
}

.epr-popup-form--org-material-alias .epr-order-add-items th:nth-child(2),
.epr-popup-form--org-material-alias .epr-order-add-items td:nth-child(2) {
  width: 36%;
}

.epr-popup-form--org-material-alias .epr-order-add-items th:nth-child(4),
.epr-popup-form--org-material-alias .epr-order-add-items td:nth-child(4) {
  width: 1.65rem;
  max-width: 1.65rem;
  padding-left: 0.08rem;
  padding-right: 0.08rem;
  text-align: center;
}

.epr-popup-form--org-material-alias .epr-order-add-items .epr-org-mat-alias-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
  min-width: 1.45rem;
  min-height: 1.45rem;
  padding: 0;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  color: var(--bs-danger, #dc3545);
  background-color: #fff;
  border: 1px solid var(--bs-danger, #dc3545);
  border-radius: var(--epr-radius-sm, 0.375rem);
  box-shadow: none;
  cursor: pointer;
  vertical-align: middle;
}

.epr-popup-form--org-material-alias .epr-order-add-items .epr-org-mat-alias-remove:hover,
.epr-popup-form--org-material-alias .epr-order-add-items .epr-org-mat-alias-remove:focus {
  color: #fff;
  background-color: var(--bs-danger, #dc3545);
  border-color: var(--bs-danger, #dc3545);
}

.epr-popup-form--select2-stable .epr-project-participant-items col.epr-project-participant-items__col-line {
  width: 1.75rem;
}

.epr-popup-form--select2-stable .epr-project-participant-items col.epr-project-participant-items__col-org {
  width: 9rem;
}

.epr-popup-form--select2-stable .epr-project-participant-items col.epr-project-participant-items__col-scope,
.epr-popup-form--select2-stable .epr-project-participant-items col.epr-project-participant-items__col-role,
.epr-popup-form--select2-stable .epr-project-participant-items col.epr-project-participant-items__col-primary {
  width: 6.5rem;
}

.epr-participant-master-detail {
  display: flex;
  gap: 0.75rem;
  min-height: 14rem;
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--bs-body-bg, #fff);
}

.epr-org-detail__card-body > .epr-participant-master-detail {
  border-color: var(--bs-border-color-translucent, rgba(0, 0, 0, 0.08));
  min-height: 16rem;
}

.epr-org-detail__card-body > .epr-participant-master-detail .epr-participant-master-detail__nav {
  flex-basis: 18rem;
  max-width: 18rem;
}

.epr-participant-master-detail__nav {
  flex: 0 0 18rem;
  max-width: 18rem;
  border-right: 1px solid var(--bs-border-color, #dee2e6);
  background: var(--bs-tertiary-bg, #f8f9fa);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.epr-participant-master-detail__nav-head {
  padding: 0.45rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--bs-secondary-color, #6c757d);
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}

.epr-participant-org-nav-list {
  list-style: none;
  padding: 0.35rem;
  margin: 0;
  overflow-y: auto;
  flex: 1 1 auto;
}

.epr-participant-org-nav-item-wrap {
  margin-bottom: 0.2rem;
}

.epr-participant-org-nav-item-wrap:last-child {
  margin-bottom: 0;
}

.epr-participant-org-nav-tab {
  display: flex;
  align-items: stretch;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 0.4rem;
  background: transparent;
  transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.epr-participant-org-nav-tab:hover {
  background: var(--bs-body-bg, #fff);
}

.epr-participant-org-nav-tab.is-active {
  background: var(--bs-body-bg, #fff);
  border-color: var(--bs-primary, #0d6efd);
  box-shadow: 0 0 0 1px rgba(13, 110, 253, 0.12);
}

.epr-participant-org-nav-item {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.42rem 0.35rem 0.42rem 0.55rem;
  border: 0;
  border-radius: 0.4rem 0 0 0.4rem;
  background: transparent;
  text-align: left;
  font-size: 0.8125rem;
  color: var(--bs-body-color, #212529);
}

.epr-participant-org-nav-item:focus-visible {
  outline: 2px solid rgba(13, 110, 253, 0.35);
  outline-offset: -2px;
}

.epr-participant-org-nav-item__title {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.epr-participant-org-nav-item__grades {
  flex: 0 0 auto;
  font-size: 0.625rem;
}

.epr-participant-org-nav-tab__close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0 0.4rem 0.4rem 0;
  background: transparent;
  color: var(--bs-secondary-color, #6c757d);
  font-size: 1rem;
  line-height: 1;
  opacity: 0;
  overflow: hidden;
  transition: opacity 0.12s ease, width 0.12s ease, min-width 0.12s ease, color 0.12s ease, background-color 0.12s ease;
}

.epr-participant-org-nav-tab:hover .epr-participant-org-nav-tab__close,
.epr-participant-org-nav-tab:focus-within .epr-participant-org-nav-tab__close {
  width: 1.5rem;
  min-width: 1.5rem;
  opacity: 1;
}

.epr-participant-org-nav-tab__close:hover,
.epr-participant-org-nav-tab__close:focus-visible {
  color: var(--bs-danger, #dc3545);
  background: rgba(220, 53, 69, 0.08);
}

.epr-participant-org-nav-tab__close:focus-visible {
  outline: 2px solid rgba(220, 53, 69, 0.35);
  outline-offset: -2px;
}

.epr-participant-master-detail__detail {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.65rem;
  overflow-y: auto;
}

.epr-participant-org-detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 10rem;
  padding: 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--bs-secondary-color, #6c757d);
}

.epr-participant-org-detail-panel__title {
  margin: 0 0 0.65rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.epr-participant-org-detail-panel__settings .form-label {
  font-size: 0.8125rem;
  color: var(--bs-secondary-color, #6c757d);
}

.epr-participant-create-orgs .select2-container--default .select2-selection--multiple {
  min-height: 2.25rem;
}

.epr-popup-form--select2-stable .epr-project-participant-items td .select2-container {
  width: 100% !important;
  max-width: 100%;
}

.epr-popup-form--select2-stable .epr-project-participant-items col.epr-project-participant-items__col-remove {
  width: var(--epr-so-row-control-h, 1.85rem);
}

.epr-popup-form--select2-stable .epr-project-participant-items th:nth-child(2),
.epr-popup-form--select2-stable .epr-project-participant-items td:nth-child(2) {
  white-space: normal;
  word-break: break-word;
}

.epr-popup-form--order-add .epr-money-input,
.epr-popup-form--order-add .epr-money-display {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.epr-popup-form--order-add .epr-so-currency-suffix {
  min-width: 2.75rem;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8125rem;
}

.epr-popup-form--order-add .epr-order-add-items th:nth-child(1),
.epr-popup-form--order-add .epr-order-add-items td:nth-child(1) {
  width: 1.75rem;
  text-align: center;
}

.epr-popup-form--order-add .epr-order-add-items th:nth-child(2),
.epr-popup-form--order-add .epr-order-add-items td:nth-child(2) {
  width: 24%;
}

.epr-popup-form--order-add .epr-order-add-items th:nth-child(3),
.epr-popup-form--order-add .epr-order-add-items td:nth-child(3) {
  width: 18%;
}

.epr-popup-form--order-add .epr-order-add-items th:nth-child(4),
.epr-popup-form--order-add .epr-order-add-items td:nth-child(4) {
  width: 3.75rem;
}

.epr-popup-form--order-add .epr-order-add-items th:nth-child(5),
.epr-popup-form--order-add .epr-order-add-items td:nth-child(5) {
  width: 10%;
}

.epr-popup-form--order-add .epr-order-add-items th:nth-child(6),
.epr-popup-form--order-add .epr-order-add-items td:nth-child(6) {
  width: 4.5rem;
}

.epr-popup-form--order-add .epr-order-add-items th:nth-child(7),
.epr-popup-form--order-add .epr-order-add-items td:nth-child(7) {
  width: 2.75rem;
}

.epr-popup-form--order-add .epr-order-add-items th:nth-child(8),
.epr-popup-form--order-add .epr-order-add-items td:nth-child(8) {
  width: 12%;
}

.epr-popup-form--order-add .epr-order-add-items th:nth-child(9),
.epr-popup-form--order-add .epr-order-add-items td:nth-child(9) {
  width: 1.75rem;
  text-align: center;
  padding-left: 0.1rem;
  padding-right: 0.1rem;
}

.epr-popup-form--order-add .epr-order-add-items--po th:nth-child(2),
.epr-popup-form--order-add .epr-order-add-items--po td:nth-child(2) {
  width: 22%;
}

.epr-popup-form--order-add .epr-order-add-items--po th:nth-child(3),
.epr-popup-form--order-add .epr-order-add-items--po td:nth-child(3) {
  width: 16%;
}

.epr-popup-form--order-add .epr-order-add-items--po th:nth-child(4),
.epr-popup-form--order-add .epr-order-add-items--po td:nth-child(4) {
  width: 4.5rem;
}

.epr-popup-form--order-add .epr-order-add-items--po th:nth-child(5),
.epr-popup-form--order-add .epr-order-add-items--po td:nth-child(5) {
  width: 7.5rem;
}

.epr-popup-form--order-add .epr-order-add-items--po th:nth-child(6),
.epr-popup-form--order-add .epr-order-add-items--po td:nth-child(6) {
  width: 5.5rem;
}

.epr-popup-form--order-add .epr-order-add-items--po th:nth-child(7),
.epr-popup-form--order-add .epr-order-add-items--po td:nth-child(7) {
  width: 2.5rem;
}

.epr-popup-form--order-add .epr-order-add-items--po th:nth-child(8),
.epr-popup-form--order-add .epr-order-add-items--po td:nth-child(8) {
  width: 6.5rem;
  white-space: nowrap;
}

.epr-popup-form--order-add .epr-order-add-items--po th:nth-child(9),
.epr-popup-form--order-add .epr-order-add-items--po td:nth-child(9) {
  width: 1.75rem;
  text-align: center;
  padding-left: 0.1rem;
  padding-right: 0.1rem;
}

.epr-popup-form--order-add .epr-order-add-items--po .epr-po-line-status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* SO edit: batch + line-status columns */
.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) th:nth-child(1),
.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) td:nth-child(1) {
  width: 2.25rem;
}

.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) th:nth-child(2),
.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) td:nth-child(2) {
  width: 7.5rem;
  white-space: nowrap;
}

.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) th:nth-child(3),
.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) td:nth-child(3) {
  width: 20%;
}

.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) th:nth-child(4),
.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) td:nth-child(4) {
  width: 16%;
}

.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) th:nth-child(5),
.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) td:nth-child(5) {
  width: 4.5rem;
}

.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) th:nth-child(6),
.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) td:nth-child(6) {
  width: 7.5rem;
}

.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) th:nth-child(7),
.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) td:nth-child(7) {
  width: 5.5rem;
}

.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) th:nth-child(8),
.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) td:nth-child(8) {
  width: 2.5rem;
}

.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) th:nth-child(9),
.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) td:nth-child(9) {
  width: 6.5rem;
  white-space: nowrap;
}

.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) th:nth-child(10),
.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) td:nth-child(10) {
  width: 1.75rem;
  text-align: center;
  padding-left: 0.1rem;
  padding-right: 0.1rem;
}

.epr-popup-form--order-add .epr-order-add-items--so:not(.epr-order-add-items--so-no-line-status) .epr-so-line-status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* SO create: batch lines table without line-status column */
.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status th:nth-child(1),
.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status td:nth-child(1) {
  width: 2.25rem;
}

.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status th:nth-child(2),
.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status td:nth-child(2) {
  width: 7.5rem;
  white-space: nowrap;
}

.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status th:nth-child(3),
.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status td:nth-child(3) {
  width: 20%;
}

.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status th:nth-child(4),
.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status td:nth-child(4) {
  width: 16%;
}

.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status th:nth-child(5),
.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status td:nth-child(5) {
  width: 4.5rem;
}

.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status th:nth-child(6),
.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status td:nth-child(6) {
  width: 7.5rem;
}

.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status th:nth-child(7),
.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status td:nth-child(7) {
  width: 5.5rem;
}

.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status th:nth-child(8),
.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status td:nth-child(8) {
  width: 2.5rem;
}

.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status th:nth-child(9),
.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status td:nth-child(9) {
  width: 1.75rem;
  text-align: center;
  padding-left: 0.1rem;
  padding-right: 0.1rem;
}

.epr-popup-form--order-add .epr-order-add-items--so.epr-order-add-items--so-no-line-status .epr-so-line-status-cell {
  display: none;
}

.epr-popup-form--order-add .epr-order-add-items--ro-batches {
  min-width: 36rem;
}

.epr-popup-form--order-add .epr-order-add-items--ro-batches th:nth-child(2),
.epr-popup-form--order-add .epr-order-add-items--ro-batches td:nth-child(2) {
  width: 22%;
}

.epr-popup-form--order-add .epr-order-add-items--ro-batches th:nth-child(3),
.epr-popup-form--order-add .epr-order-add-items--ro-batches td:nth-child(3) {
  width: 24%;
}

.epr-popup-form--order-add .epr-order-add-items--ro-batches th:nth-child(4),
.epr-popup-form--order-add .epr-order-add-items--ro-batches td:nth-child(4) {
  width: 4.5rem;
}

.epr-popup-form--order-add .epr-order-add-items--ro-batches th:nth-child(5),
.epr-popup-form--order-add .epr-order-add-items--ro-batches td:nth-child(5) {
  width: 10%;
}

.epr-popup-form--order-add .epr-order-add-items--ro-batches th:nth-child(6),
.epr-popup-form--order-add .epr-order-add-items--ro-batches td:nth-child(6) {
  width: 12%;
}

.epr-popup-form--order-add .epr-order-add-items--ro-batches th:nth-child(7),
.epr-popup-form--order-add .epr-order-add-items--ro-batches td:nth-child(7) {
  width: 1.75rem;
  text-align: center;
  padding-left: 0.1rem;
  padding-right: 0.1rem;
}

.epr-popup-form--order-add .epr-order-add-items--ro-batches .form-control[readonly] {
  background-color: var(--bs-secondary-bg, #f8f9fa);
}

.epr-popup-form--order-add .epr-order-add-item-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 32px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--grac-green-700, #15803d);
  background-color: var(--grac-green-50, #ecfdf5);
  border: 1px dashed var(--grac-green-300, #86efac);
  border-radius: var(--epr-radius-lg, 0.5rem);
  box-shadow: none;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.epr-popup-form--order-add .epr-order-add-item-btn:hover,
.epr-popup-form--order-add .epr-order-add-item-btn:focus {
  color: var(--grac-green-800, #166534);
  background-color: var(--grac-green-100, #dcfce7);
  border-color: var(--grac-green-500, #22c55e);
  border-style: solid;
}

.epr-popup-form--order-add .epr-order-add-item-btn:focus-visible {
  outline: 2px solid var(--grac-green-400, #4ade80);
  outline-offset: 2px;
  box-shadow: none;
}

.epr-popup-form--order-add .epr-order-add-item-btn__ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Chi tiết đơn bán / đơn mua — layout card tách khối (dùng chung class epr-so-detail) */
.epr-so-detail--stack {
  display: flex;
  flex-direction: column;
  gap: var(--epr-space-4);
}

.epr-so-detail__panel {
  background: var(--epr-surface);
  border: 1px solid var(--epr-border);
  border-radius: var(--epr-card-radius);
  box-shadow: var(--epr-card-shadow);
  overflow: hidden;
}

.epr-so-detail__hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--epr-space-4);
  padding: var(--epr-space-4);
}

.epr-so-detail__hero-main {
  display: flex;
  align-items: flex-start;
  gap: var(--epr-space-4);
  flex: 1 1 auto;
  min-width: min(100%, 16rem);
}

.epr-so-detail__avatar {
  flex: 0 0 auto;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: var(--epr-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: var(--epr-brand-700);
  background: linear-gradient(145deg, var(--grac-green-50), #e8f5e9);
  border: 1px solid rgba(27, 94, 32, 0.12);
}

.epr-so-detail__title {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 800;
  color: var(--epr-text-primary);
  margin: 0 0 var(--epr-space-2);
  line-height: 1.25;
}

.epr-so-detail__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.875rem;
}

.epr-so-detail__meta-sep {
  color: var(--epr-text-muted);
}

.epr-so-detail__code-link,
.epr-so-detail__code-link code {
  font-weight: 600;
}

.epr-so-detail__amount {
  font-size: 1.125rem;
  color: var(--epr-text-primary);
}

.epr-so-detail__card-head {
  padding: var(--epr-space-3) var(--epr-space-4);
  border-bottom: 1px solid var(--epr-border);
  background: var(--epr-surface-muted);
}

.epr-so-detail__card-title {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--grac-green-800);
    font-size: 0.875rem;
    font-weight: bold; /* Thêm dòng này để in đậm chữ */
}

.epr-so-detail__card-body {
  padding: 0 var(--epr-space-4) var(--epr-space-4);
  padding-top: var(--epr-space-2);
}

.epr-so-detail__card--fill {
  display: flex;
  flex-direction: column;
}

.epr-so-detail__card--fill .epr-so-detail__card-body {
  flex: 1 1 auto;
}

.epr-so-detail__card--full .epr-so-detail__card-body.p-0 {
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
}

.epr-so-detail__kv-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--epr-space-4);
  padding: var(--epr-space-2) 0;
  border-bottom: 1px solid var(--epr-surface-border, #e9ecef);
}

.epr-so-detail__kv-row--last {
  border-bottom: none;
}

.epr-so-detail__kv-label {
  flex: 0 1 46%;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--epr-neutral-500);
}

.epr-so-detail__kv-value {
  flex: 1 1 54%;
  text-align: left;
  word-break: break-word;
  min-width: 0;
  font-size: var(--epr-font-size-sm);
  color: var(--epr-neutral-900);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.epr-so-detail__value-link {
  text-decoration: none;
  font-weight: 600;
}

.epr-so-detail__value-link:hover {
  text-decoration: underline;
}

.epr-so-detail-items thead th {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.epr-so-detail-items .epr-status-badge {
  white-space: nowrap;
}

.epr-so-detail__so-links-table .epr-so-detail__value-link {
  text-decoration: none;
  font-weight: 600;
  color: var(--epr-brand-700, #1b5e20);
}

.epr-so-detail__so-links-table .epr-so-detail__value-link:hover {
  text-decoration: underline;
}

.epr-so-detail__so-links-table .epr-status-badge {
  white-space: nowrap;
}

.tpl-detail-tx-transaction .epr-so-detail--stack {
  max-width: none;
}

.form-check-input:checked {
  background-color: var(--grac-green-600, #2d9d5c) !important;
  border-color: var(--grac-green-600, #2d9d5c) !important;
}

.form-check-input[type=checkbox]:indeterminate {
  background-color: var(--grac-green-600, #2d9d5c) !important;
  border-color: var(--grac-green-600, #2d9d5c) !important;
}

/* AI Summary panel (AI-FE-001) */
.epr-ai-panel {
  position: relative;
}

.epr-ai-panel--busy .epr-ai-panel__bd {
  min-height: 6rem;
  pointer-events: none;
  opacity: 0.4;
}

.epr-ai-panel__overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  border-radius: inherit;
}

.epr-ai-panel__overlay[hidden] {
  display: none !important;
}

.epr-ai-panel__loading {
  display: flex;
  align-items: center;
  font-size: 0.9375rem;
}

.epr-ai-panel__hd .epr-ai-panel__mark {
  color: var(--epr-primary, #0d6efd);
  font-size: 1.25rem;
  line-height: 1;
}

.epr-ai-panel__eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.epr-ai-panel__quota {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--epr-text-secondary);
  background-color: var(--epr-surface-muted);
  border: 1px solid var(--epr-border);
  border-radius: var(--epr-radius-sm, 0.375rem);
  white-space: nowrap;
}

.epr-ai-panel__summary {
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
  white-space: pre-line;
}

.epr-ai-panel__bullets {
  padding-left: 1.25rem;
  margin-bottom: 0;
}

.epr-ai-panel__bullets li+li {
  margin-top: 0.25rem;
}

.epr-ai-panel__anom-title {
  font-size: 0.875rem;
}

/* AI extraction review (AI-FE-002) */
.epr-confidence-meter {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 7rem;
}

.epr-confidence-meter__track {
  flex: 1;
  height: 0.35rem;
  background: var(--grac-green-100);
  border-radius: 999px;
  overflow: hidden;
}

.epr-confidence-meter__bar {
  height: 100%;
  background: var(--grac-green-600);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.epr-confidence-meter__bar--medium {
  background: var(--grac-green-500);
}

.epr-confidence-meter__bar--low {
  background: var(--grac-green-400, #5cb87a);
}

.epr-confidence-meter__pct {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--grac-green-800);
  min-width: 2.25rem;
}

.epr-extraction-table .epr-extraction-row--high {
  background: var(--grac-green-25);
}

.epr-extraction-table .epr-extraction-row--medium {
  background: color-mix(in srgb, var(--grac-green-50) 75%, var(--epr-surface));
}

.epr-extraction-table .epr-extraction-row--lowconf {
  background: color-mix(in srgb, var(--grac-green-25) 65%, var(--epr-surface));
}

.epr-extraction-table .epr-extraction-row--unknown {
  background: transparent;
}

.epr-extraction-table tbody tr:hover {
  background: color-mix(in srgb, var(--grac-green-50) 85%, var(--epr-surface)) !important;
}

.epr-ai-extraction .spinner-border {
  color: var(--grac-green-600);
  border-right-color: currentColor;
}

.epr-ai-extraction--processing .epr-org-detail__card-body {
  position: relative;
}

.epr-evidence-upload-form .epr-evidence-upload__attachment-preview {
  max-width: 100%;
}

.epr-evidence-upload-form .epr-evidence-upload__preview-image {
  display: block;
  max-width: 100%;
  max-height: 24rem;
  width: auto;
  height: auto;
  object-fit: contain;
}

.epr-evidence-upload-form .epr-evidence-upload__preview-pdf {
  display: block;
  height: 12rem;
  min-height: 0;
  border: 0;
}

.epr-evidence-upload-form .epr-ai-extraction__scroll {
  max-height: min(50vh, 28rem);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.15rem;
}

.epr-evidence-upload-form .epr-ai-extraction__scroll .table-responsive {
  margin-bottom: 0;
}

/* AI "Thinking..." state (evidence extraction, ChatGPT-style) */
.epr-ai-thinking {
  padding: 1rem 1.1rem;
  border: var(--epr-border-width) solid color-mix(in srgb, var(--grac-green-600) 24%, var(--epr-border));
  border-radius: var(--epr-radius-md);
  background: linear-gradient(135deg,
      color-mix(in srgb, var(--grac-green-50) 88%, var(--epr-surface)) 0%,
      var(--epr-surface) 55%,
      color-mix(in srgb, var(--grac-green-50) 40%, var(--epr-surface)) 100%);
  background-size: 200% 200%;
  animation: epr-ai-thinking-bg 4s ease infinite;
}

@keyframes epr-ai-thinking-bg {

  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

.epr-ai-thinking__inner {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.epr-ai-thinking__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
  font-weight: 600;
  font-size: var(--epr-font-size-sm);
  color: var(--epr-text-primary);
}

.epr-ai-thinking__dots {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: 0.15rem;
  vertical-align: middle;
}

.epr-ai-thinking__dots i {
  display: block;
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: var(--grac-green-600);
  animation: epr-ai-thinking-dot 1.2s ease-in-out infinite;
}

.epr-ai-thinking__dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.epr-ai-thinking__dots i:nth-child(3) {
  animation-delay: 0.3s;
}

.epr-ai-thinking__dots--sm i {
  width: 0.28rem;
  height: 0.28rem;
}

@keyframes epr-ai-thinking-dot {

  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }

  40% {
    transform: translateY(-0.22rem);
    opacity: 1;
  }
}

.epr-ai-thinking__status {
  display: block;
  margin-top: 0.35rem;
  font-size: var(--epr-font-size-sm);
  color: var(--epr-text-secondary);
  opacity: 0;
  transform: translateY(0.35rem);
  transition: opacity 0.32s ease, transform 0.32s ease;
}

.epr-ai-thinking__status--visible {
  opacity: 1;
  transform: translateY(0);
}

.epr-ai-thinking__bar {
  height: 3px;
  margin-top: 0.85rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--grac-green-100) 80%, var(--epr-neutral-100));
  overflow: hidden;
}

.epr-ai-thinking__bar span {
  display: block;
  height: 100%;
  width: 38%;
  border-radius: inherit;
  background: linear-gradient(90deg,
      transparent 0%,
      var(--grac-green-500) 45%,
      var(--grac-green-400) 55%,
      transparent 100%);
  animation: epr-ai-thinking-shimmer 1.5s ease-in-out infinite;
}

@keyframes epr-ai-thinking-shimmer {
  0% {
    transform: translateX(-130%);
  }

  100% {
    transform: translateX(340%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .epr-ai-thinking {
    animation: none;
    background: color-mix(in srgb, var(--grac-green-50) 72%, var(--epr-surface));
  }

  .epr-ai-thinking__dots i,
  .epr-ai-thinking__bar span {
    animation: none;
  }

  .epr-ai-thinking__status {
    opacity: 1;
    transform: none;
  }
}

/* AI Chat FAB (AI-FE-003) — GRAC green brand */
.ai-chat-root {
  --ai-chat-brand: var(--epr-brand-600, var(--grac-green-600));
  --ai-chat-brand-hover: var(--grac-green-700);
  --ai-chat-brand-active: var(--grac-green-800);
  --ai-chat-brand-soft: var(--grac-green-50);
  --ai-chat-brand-tint: var(--grac-green-100);
  --ai-chat-focus-ring: rgba(45, 157, 92, 0.45);

  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 110;
  pointer-events: none;
}

.ai-chat-fab,
.ai-chat-panel {
  pointer-events: auto;
}

.ai-chat-fab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0 0.95rem;
  border: 0;
  border-radius: 999px;
  background: var(--ai-chat-brand);
  color: var(--epr-text-inverse, #fff);
  font-weight: 700;
  box-shadow: 0 14px 34px rgba(21, 93, 55, 0.28);
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-chat-fab:hover {
  background: var(--ai-chat-brand-hover);
}

.ai-chat-fab:focus-visible {
  outline: var(--epr-focus-ring-width, 2px) solid var(--ai-chat-brand);
  outline-offset: var(--epr-focus-ring-offset, 2px);
  box-shadow: 0 0 0 0.2rem var(--ai-chat-focus-ring);
}

.ai-chat-fab__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.ai-chat-panel {
  position: absolute;
  right: 0;
  bottom: 3.8rem;
  width: min(420px, calc(100vw - 1.75rem));
  max-height: min(78vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--epr-surface, #fff);
  border: 1px solid var(--epr-border, #dee2e6);
  border-radius: 1.1rem;
  box-shadow: 0 24px 62px rgba(15, 23, 42, 0.24);
  overflow: hidden;
}

.ai-chat-panel[hidden] {
  display: none;
}

.ai-chat-panel__header {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--epr-border, #dee2e6);
  background: linear-gradient(180deg, var(--ai-chat-brand-soft) 0%, var(--epr-surface, #fff) 100%);
  overflow: visible;
  position: relative;
  z-index: 2;
}

.ai-chat-panel__identity {
  display: flex;
  gap: 0.65rem;
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.ai-chat-panel__avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: var(--ai-chat-brand-tint);
  color: var(--ai-chat-brand-hover);
  border: 1px solid color-mix(in srgb, var(--ai-chat-brand) 22%, #fff);
}

.ai-chat-panel__title {
  margin: 0;
  font-size: 0.95rem;
}

.ai-chat-panel__title-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.ai-chat-panel__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.ai-chat-panel__action-btn {
  border: 1px solid color-mix(in srgb, var(--ai-chat-brand) 35%, var(--epr-border, #dee2e6));
  border-radius: 999px;
  background: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  color: var(--ai-chat-brand-hover);
  cursor: pointer;
  pointer-events: auto;
  white-space: nowrap;
}

.ai-chat-panel__action-btn:hover {
  background: var(--ai-chat-brand-soft);
}

.ai-chat-panel__new-session {
  display: none;
}

.ai-chat-entity-picker {
  margin-top: 0.35rem;
  border: 1px solid var(--epr-border, #dee2e6);
  border-radius: 0.375rem;
  background: #fff;
  padding: 0.35rem;
  position: relative;
  z-index: 5;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.ai-chat-entity-picker__input {
  width: 100%;
  border: 1px solid var(--epr-border, #dee2e6);
  border-radius: 0.25rem;
  padding: 0.25rem 0.45rem;
  font-size: 0.78rem;
}

.ai-chat-entity-picker__results {
  max-height: 9rem;
  overflow-y: auto;
  margin-top: 0.25rem;
}

.ai-chat-entity-picker__item,
.ai-chat-entity-picker__empty {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.28rem 0.35rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.ai-chat-entity-picker__item:hover {
  background: color-mix(in srgb, var(--ai-chat-brand) 8%, #fff);
}

.ai-chat-entity-picker__item.is-current {
  font-weight: 600;
  color: var(--ai-chat-brand);
}

.ai-chat-entity-picker__empty {
  color: var(--epr-text-muted, #6c757d);
  cursor: default;
}

.ai-chat-panel__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--grac-green-800);
  background: var(--ai-chat-brand-tint);
  border: 1px solid color-mix(in srgb, var(--ai-chat-brand) 28%, #fff);
}

.ai-chat-panel__context {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ai-chat-brand-hover);
}

.ai-chat-panel__subtitle,
.ai-chat-panel__quota {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: var(--epr-text-muted, #6c757d);
}

.ai-chat-panel__quota--low {
  color: #b45309;
}

.ai-chat-panel__quota--exceeded {
  color: #b91c1c;
  font-weight: 600;
}

.ai-chat-msg__links {
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px dashed color-mix(in srgb, var(--epr-border, #dee2e6) 70%, transparent);
  font-size: 0.78rem;
}

.ai-chat-msg__links-label {
  color: var(--epr-text-muted, #6c757d);
}

.ai-chat-msg__link {
  color: var(--ai-chat-brand-hover);
  font-weight: var(--epr-font-weight-medium, 500);
  text-decoration: none;
}

.ai-chat-msg__link:hover {
  color: var(--ai-chat-brand-active);
  text-decoration: underline;
}

.ai-chat-panel__close {
  border: 1px solid var(--epr-border, #dee2e6);
  border-radius: 0.375rem;
  width: 2rem;
  height: 2rem;
  background: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}

.ai-chat-panel__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.8rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ai-chat-msg {
  display: flex;
}

.ai-chat-msg--assistant {
  justify-content: flex-start;
}

.ai-chat-msg--user {
  justify-content: flex-end;
}

.ai-chat-msg__bubble {
  max-width: 88%;
  border-radius: 0.9rem;
  padding: 0.55rem 0.7rem;
  background: var(--epr-neutral-100, #f3f4f6);
}

.ai-chat-msg--user .ai-chat-msg__bubble {
  background: var(--ai-chat-brand-soft);
  border: 1px solid color-mix(in srgb, var(--ai-chat-brand) 18%, #fff);
  color: var(--epr-text-primary);
}

.ai-chat-msg--error .ai-chat-msg__bubble {
  background: color-mix(in srgb, var(--bs-danger, #dc3545) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--bs-danger, #dc3545) 35%, #fff);
  color: var(--bs-danger-text-emphasis, #58151c);
}

.ai-chat-msg--assistant .ai-chat-msg__bubble {
  background: var(--epr-surface, #fff);
  border: 1px solid color-mix(in srgb, var(--epr-border, #dee2e6) 85%, var(--ai-chat-brand) 15%);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.ai-chat-msg__bubble p,
.ai-chat-msg__content {
  margin: 0;
}

.ai-chat-msg__bubble > .ai-chat-md__p:first-child,
.ai-chat-msg__content .ai-chat-md__p:first-child {
  margin-top: 0;
}

@keyframes ai-chat-msg-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-chat-msg--enter {
  animation: ai-chat-msg-enter 0.2s ease-out both;
}

@media (prefers-reduced-motion: reduce) {
  .ai-chat-msg--enter {
    animation: none;
  }
}

.ai-chat-md {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--epr-text-primary, #1f2937);
}

.ai-chat-md__p {
  margin: 0 0 0.55rem;
}

.ai-chat-md__p:last-child {
  margin-bottom: 0;
}

.ai-chat-md__heading {
  margin: 0.15rem 0 0.4rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--epr-text-primary, #1f2937);
}

.ai-chat-md h4.ai-chat-md__heading {
  font-size: 0.92rem;
}

.ai-chat-md h5.ai-chat-md__heading {
  font-size: 0.88rem;
}

.ai-chat-md h6.ai-chat-md__heading {
  font-size: 0.84rem;
  color: var(--epr-text-secondary, #4b5563);
}

.ai-chat-md__ul,
.ai-chat-md__ol {
  margin: 0.15rem 0 0.65rem;
  padding-left: 1.2rem;
}

.ai-chat-md__ul:last-child,
.ai-chat-md__ol:last-child,
.ai-chat-md__table-wrap:last-child {
  margin-bottom: 0;
}

.ai-chat-md__ul li,
.ai-chat-md__ol li {
  margin: 0.22rem 0;
}

.ai-chat-md__ul li::marker {
  color: var(--ai-chat-brand, #155d37);
}

.ai-chat-md__code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82em;
  background: color-mix(in srgb, var(--epr-neutral-100, #f3f4f6) 80%, #fff);
  border: 1px solid var(--epr-border, #e5e7eb);
  border-radius: 0.25rem;
  padding: 0.05rem 0.35rem;
}

.ai-chat-md strong {
  font-weight: 600;
  color: var(--epr-text-primary, #111827);
}

.ai-chat-md__table-wrap {
  overflow-x: auto;
  margin: 0.35rem 0 0.65rem;
  border-radius: 0.45rem;
  border: 1px solid var(--epr-border, #e5e7eb);
}

.ai-chat-md__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  line-height: 1.4;
}

.ai-chat-md__table th,
.ai-chat-md__table td {
  padding: 0.35rem 0.5rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--epr-border, #e5e7eb);
}

.ai-chat-md__table th {
  background: color-mix(in srgb, var(--ai-chat-brand-soft) 55%, #fff);
  font-weight: 600;
  white-space: nowrap;
}

.ai-chat-md__table tbody tr:last-child td {
  border-bottom: 0;
}

.ai-chat-md__table tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--epr-neutral-100, #f9fafb) 65%, #fff);
}

.ai-chat-msg__bubble p {
  margin: 0;
  white-space: pre-wrap;
}

.ai-chat-msg--typing .ai-chat-msg__bubble--thinking {
  background: color-mix(in srgb, var(--ai-chat-brand-soft) 92%, #fff);
  border: 1px solid color-mix(in srgb, var(--ai-chat-brand) 20%, #fff);
}

.ai-chat-msg--typing .epr-ai-thinking__title {
  font-size: 0.88rem;
  font-weight: 500;
}

.ai-chat-panel__quick-prompts {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.45rem;
  flex-shrink: 0;
  padding: 0.65rem 0.95rem;
  border-top: 1px solid var(--epr-border, #dee2e6);
  background: var(--epr-surface, #fff);
}

.ai-chat-prompt {
  display: inline-block;
  border: 1px solid var(--epr-border, #dee2e6);
  border-radius: 999px;
  background: #fff;
  font-size: 0.72rem;
  line-height: 1.35;
  padding: 0.35rem 0.65rem;
  white-space: normal;
  text-align: left;
  max-width: 100%;
  word-break: break-word;
  cursor: pointer;
  color: var(--epr-text-secondary);
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.ai-chat-prompt:hover {
  border-color: color-mix(in srgb, var(--ai-chat-brand) 40%, var(--epr-border, #dee2e6));
  background: var(--ai-chat-brand-soft);
  color: var(--ai-chat-brand-hover);
}

.ai-chat-prompt:focus-visible {
  outline: var(--epr-focus-ring-width, 2px) solid var(--ai-chat-brand);
  outline-offset: 1px;
}

.ai-chat-followups {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px dashed color-mix(in srgb, var(--epr-border, #dee2e6) 80%, transparent);
}

.ai-chat-followups__label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--epr-text-muted, #6c757d);
}

.ai-chat-followups__items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.ai-chat-panel__scope {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ai-chat-brand-hover);
}

.ai-chat-panel__scope-btn {
  display: none;
}

.ai-chat-panel__scope-label {
  flex: 1 1 auto;
  min-width: 0;
}

.ai-chat-panel__scope-link {
  color: var(--ai-chat-brand-hover);
  font-weight: 600;
  text-decoration: none;
}

.ai-chat-panel__scope-link:hover {
  color: var(--ai-chat-brand-active);
  text-decoration: underline;
}

.ai-chat-panel__composer-field {
  position: relative;
}

.ai-chat-panel__input-shell {
  display: flex;
  align-items: center;
  border: 1px solid var(--epr-border, #dee2e6);
  border-radius: 0.75rem;
  background: var(--epr-surface, #fff);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-chat-panel__input-shell:focus-within {
  border-color: var(--ai-chat-brand);
  box-shadow: 0 0 0 0.2rem var(--ai-chat-focus-ring);
}

.ai-chat-panel__input-shell:has(.ai-chat-panel__input:disabled) {
  background: #f8f9fa;
  opacity: 0.9;
}

.ai-chat-panel__slash-trigger {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 2.35rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--epr-border, #dee2e6);
  border-radius: 0;
  background: color-mix(in srgb, var(--ai-chat-brand-soft) 55%, #fff);
  color: var(--ai-chat-brand-hover);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.ai-chat-panel__slash-trigger:hover {
  background: var(--ai-chat-brand-soft);
  color: var(--ai-chat-brand-active);
}

.ai-chat-panel__slash-trigger:focus-visible {
  outline: var(--epr-focus-ring-width, 2px) solid var(--ai-chat-brand);
  outline-offset: -2px;
}

.ai-chat-panel__input-shell .ai-chat-panel__input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  min-height: 2.75rem;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: calc((2.75rem - 1.25em) / 2) 0.65rem;
  line-height: 1.25;
  background: transparent;
  resize: none;
}

.ai-chat-panel__input-shell .ai-chat-panel__input:focus {
  border: 0;
  box-shadow: none;
  outline: 0;
}

.ai-chat-slash-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 0.35rem);
  max-height: 14rem;
  overflow-y: auto;
  border: 1px solid var(--epr-border, #dee2e6);
  border-radius: 0.75rem;
  background: var(--epr-surface, #fff);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  z-index: 2;
}

.ai-chat-slash-menu__title {
  padding: 0.45rem 0.65rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--epr-text-muted, #6c757d);
}

.ai-chat-slash-menu__item {
  display: flex;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.45rem 0.65rem;
  cursor: pointer;
}

.ai-chat-slash-menu__item:hover,
.ai-chat-slash-menu__item--active {
  background: var(--ai-chat-brand-soft);
}

.ai-chat-slash-menu__cmd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  color: var(--ai-chat-brand-hover);
  white-space: nowrap;
}

.ai-chat-slash-menu__label {
  font-size: 0.78rem;
  color: var(--epr-text-secondary);
}

.ai-chat-slash-menu__empty {
  padding: 0.65rem;
  font-size: 0.78rem;
  color: var(--epr-text-muted, #6c757d);
}

.ai-chat-panel__composer {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex-shrink: 0;
  padding: 0.65rem 0.75rem;
  border-top: 1px solid var(--epr-border, #dee2e6);
}

.ai-chat-panel__composer-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
}

.ai-chat-panel__hint {
  font-size: 0.72rem;
  color: var(--epr-text-muted, #6c757d);
}

.ai-chat-panel__input {
  width: 100%;
  max-height: 8rem;
  font: inherit;
  line-height: 1.45;
}

.ai-chat-panel__input:disabled {
  cursor: not-allowed;
}

.ai-chat-panel__send {
  flex-shrink: 0;
  border: 0;
  border-radius: 0.75rem;
  min-height: 2.35rem;
  padding: 0 0.9rem;
  background: var(--ai-chat-brand);
  color: var(--epr-text-inverse, #fff);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.ai-chat-panel__send:hover:not(:disabled) {
  background: var(--ai-chat-brand-hover);
}

.ai-chat-panel__send:focus-visible {
  outline: var(--epr-focus-ring-width, 2px) solid var(--ai-chat-brand);
  outline-offset: 2px;
  box-shadow: 0 0 0 0.2rem var(--ai-chat-focus-ring);
}

.ai-chat-panel__send:disabled {
  opacity: 0.6;
  cursor: default;
}

@media (max-width: 680px) {
  .ai-chat-root {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .ai-chat-panel {
    width: calc(100vw - 1.5rem);
    bottom: 3.6rem;
  }

  .ai-chat-fab__label {
    display: none;
  }
}

.epr-ai-chat-workspace-page {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
}

#epr-ai-chat-workspace-mount {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#epr-ai-chat-workspace-mount > .ai-ws,
#epr-ai-chat-workspace-mount > .ai-chat-workspace {
  flex: 1 1 auto;
}

.ai-chat-workspace {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 1rem;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  align-items: stretch;
}

.ai-chat-workspace__sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem;
  border: 1px solid var(--epr-border, #dee2e6);
  border-radius: 0.85rem;
  background: var(--epr-surface, #fff);
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.ai-chat-workspace__sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.ai-chat-workspace__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.ai-chat-workspace__new {
  border: 1px solid color-mix(in srgb, var(--ai-chat-brand) 35%, var(--epr-border, #dee2e6));
  border-radius: 999px;
  background: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  color: var(--ai-chat-brand-hover);
  cursor: pointer;
  white-space: nowrap;
}

.ai-chat-workspace__new:hover {
  background: var(--ai-chat-brand-soft);
}

.ai-chat-workspace__search,
.ai-chat-workspace__filter {
  width: 100%;
  border: 1px solid var(--epr-border, #dee2e6);
  border-radius: 0.45rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.8rem;
  background: #fff;
}

.ai-chat-workspace__sessions {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ai-chat-workspace__sessions-empty {
  padding: 0.75rem 0.35rem;
  font-size: 0.78rem;
  color: var(--epr-text-muted, #6c757d);
}

.ai-chat-workspace__session-item-wrap {
  position: relative;
  border-radius: 0.55rem;
}

.ai-chat-workspace__session-item-wrap.is-current {
  background: var(--ai-chat-brand-soft);
  border: 1px solid color-mix(in srgb, var(--ai-chat-brand) 35%, var(--epr-border, #dee2e6));
}

.ai-chat-workspace__session-item-wrap.is-archived {
  opacity: 0.72;
}

.ai-chat-workspace__session-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 0.55rem;
  background: transparent;
  padding: 0.45rem 0.55rem 0.35rem;
  cursor: pointer;
}

.ai-chat-workspace__session-item-wrap:hover {
  background: color-mix(in srgb, var(--ai-chat-brand) 8%, #fff);
}

.ai-chat-workspace__session-item.is-current {
  background: transparent;
}

.ai-chat-workspace__session-title {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--epr-text, #212529);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-chat-workspace__session-preview {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.74rem;
  line-height: 1.3;
  color: var(--epr-text-muted, #6c757d);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-chat-workspace__session-meta {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.7rem;
  color: var(--epr-text-muted, #6c757d);
}

.ai-chat-workspace__session-actions {
  display: flex;
  gap: 0.35rem;
  padding: 0 0.55rem 0.4rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.ai-chat-workspace__session-item-wrap:hover .ai-chat-workspace__session-actions,
.ai-chat-workspace__session-item-wrap:focus-within .ai-chat-workspace__session-actions {
  opacity: 1;
  pointer-events: auto;
}

.ai-chat-workspace__session-action {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 0.68rem;
  color: var(--ai-chat-brand, #0d6efd);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ai-chat-workspace__archived-toggle {
  flex: 0 0 auto;
  margin: 0.5rem 0 0;
  padding: 0.35rem 0.15rem 0;
  font-size: 0.74rem;
  color: var(--epr-text-muted, #6c757d);
  border-top: 1px solid var(--epr-border, #dee2e6);
}

.ai-chat-workspace__archived-toggle input {
  margin-right: 0.35rem;
}

.ai-chat-workspace__session-label {
  display: block;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--epr-text, #212529);
}

.ai-chat-workspace__main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-chat-panel--workspace {
  position: static;
  width: 100%;
  max-height: none;
  height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: none;
}

.ai-chat-panel--workspace .ai-chat-panel__header {
  flex-shrink: 0;
}

.ai-chat-panel--workspace .ai-chat-panel__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ai-chat-panel--workspace .ai-chat-panel__quick-prompts,
.ai-chat-panel--workspace .ai-chat-panel__composer {
  flex-shrink: 0;
}

.ai-chat-panel__header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.ai-chat-panel__expand {
  border: 0;
  background: transparent;
  color: var(--epr-text-muted, #6c757d);
  font-size: 1rem;
  line-height: 1;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.45rem;
  cursor: pointer;
}

.ai-chat-panel__expand:hover {
  background: color-mix(in srgb, var(--ai-chat-brand) 10%, #fff);
  color: var(--ai-chat-brand-hover);
}

@media (max-width: 900px) {
  .ai-chat-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(8rem, 28vh) minmax(0, 1fr);
  }

  .ai-chat-workspace__sidebar {
    max-height: none;
  }
}

@import url("epr-report-template.css");

/* Text links only — skip anchors styled as buttons (Bootstrap .btn, lang toggle, …). */
a:not(.btn):not(.epr-btn):not(.dropdown-item):not(.epr-sidebar-link):not(.epr-btl-pill) {
  text-decoration: none !important;
  color: var(--epr-brand-700) !important;
}

.dropdown-item.active,
.dropdown-item:active {
  background: var(--epr-sidebar-active-bg) !important;
  color: var(--epr-brand-700) !important;
}

.dropdown-item:focus,
.dropdown-item:hover {
  background: var(--epr-sidebar-active-bg) !important;
}

.epr-materials-import-aside-sticky {
  position: sticky;
  top: 1rem;
}

.epr-materials-import-aside__heading {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.epr-materials-import-rules__list {
  padding-left: 1.125rem;
  margin-bottom: 0;
}

.epr-materials-import-rules__list li + li {
  margin-top: 0.5rem;
}

.epr-materials-import-steps-wrap {
  border-bottom: 1px solid var(--epr-border, var(--bs-border-color, #dee2e6));
}

.epr-materials-import-steps__track {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.625rem 0.875rem;
  padding: 1rem 1.25rem;
}

.epr-materials-import-steps__step {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--epr-text-secondary, #5c6670);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  transition: color 0.15s ease;
}

.epr-materials-import-steps__step:hover,
.epr-materials-import-steps__step:focus-visible {
  color: var(--epr-text-primary, #1f2933);
}

.epr-materials-import-steps__step.is-active:hover,
.epr-materials-import-steps__step.is-active:focus-visible {
  color: var(--epr-brand-600, #248a47);
}

.epr-materials-import-steps__step:focus-visible {
  outline: var(--epr-focus-ring-width, 2px) solid var(--epr-focus-ring-color, #23a455);
  outline-offset: 3px;
  border-radius: var(--epr-radius-sm, 0.375rem);
}

.epr-materials-import-steps__marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--bs-light, #f8f9fa);
  border: 2px solid var(--bs-border-color, #ced4da);
  color: var(--bs-secondary-color, #6c757d);
  transition:
    width 0.15s ease,
    height 0.15s ease,
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.epr-materials-import-steps__num {
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.epr-materials-import-steps__sep {
  color: var(--bs-secondary-color, #adb5bd);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1;
  user-select: none;
}

.epr-materials-import-steps__step.is-active {
  color: var(--epr-brand-600, #248a47);
  font-weight: 600;
}

.epr-materials-import-steps__step.is-active .epr-materials-import-steps__label {
  color: var(--epr-brand-600, #248a47);
  font-weight: 700;
}

.epr-materials-import-steps__step.is-active .epr-materials-import-steps__marker {
  width: 2rem;
  height: 2rem;
  background: var(--epr-brand-600, #248a47);
  border-color: var(--epr-brand-600, #248a47);
  color: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--epr-brand-500, #2d8a4e) 22%, transparent);
}

.epr-materials-import-steps__step.is-active .epr-materials-import-steps__num {
  font-size: 0.875rem;
}

.epr-materials-import-actions {
  padding-top: var(--epr-space-3);
  margin-top: var(--epr-space-3);
  border-top: 1px solid var(--bs-border-color, #dee2e6);
}

.epr-materials-import-tabs__content .tab-pane > .epr-materials-import-actions {
  padding-left: var(--epr-space-3);
  padding-right: var(--epr-space-3);
  padding-bottom: var(--epr-space-3);
}

.epr-materials-import-results__header {
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
  padding-bottom: var(--epr-space-2);
}

.epr-materials-import-pagination .epr-table-pager__link--chev {
  min-width: 2rem;
}

.epr-materials-import-pagination [data-epr-validate-page-numbers-anchor] {
  display: none;
}

.epr-materials-import-tabs__content .tab-pane > .epr-org-detail__card-body,
.epr-materials-import-tabs__content .tab-pane > #MaterialsImportValidateResults > .epr-materials-import-results,
.epr-materials-import-tabs__content .tab-pane > #MaterialsImportValidateResults > .epr-materials-import-results--empty {
  padding: var(--epr-space-3);
}

.epr-materials-import-dropzone {
  border-color: var(--bs-border-color, #dee2e6) !important;
  background: color-mix(in srgb, var(--bs-secondary-bg, #f8f9fa) 80%, transparent);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.epr-materials-import-dropzone.is-selected {
  border-style: solid !important;
  border-color: color-mix(in srgb, var(--epr-brand-500, #2d8a4e) 45%, var(--bs-border-color, #dee2e6)) !important;
  background: color-mix(in srgb, var(--epr-brand-500, #2d8a4e) 7%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--epr-brand-500, #2d8a4e) 12%, transparent);
}

.epr-materials-import-dropzone__icon {
  width: 3rem;
  height: 3rem;
  background: #fff;
  border: 1px solid var(--bs-border-color, #dee2e6);
  color: var(--epr-brand-600, #248a47);
}

.epr-materials-import-dropzone__icon .epr-nav-ic {
  width: 1.375rem;
  height: 1.375rem;
}

.epr-materials-import-results--empty .epr-org-detail__card-body {
  background: color-mix(in srgb, var(--bs-secondary-bg, #f8f9fa) 60%, transparent);
}

.epr-materials-import-results__placeholder-icon {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--bs-secondary-color, #6c757d);
  opacity: 0.65;
}

.epr-materials-import-results__placeholder-icon .epr-nav-ic {
  width: 100%;
  height: 100%;
}

.epr-materials-import-validate-table thead th {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.epr-import-lines-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--epr-brand-200, #b8dfd0);
  border-radius: 999px;
  background: var(--epr-brand-50, #f0faf5);
  color: var(--epr-brand-700, #1f7a4f);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.epr-import-lines-trigger:hover {
  background: var(--epr-brand-100, #dcf5ea);
  border-color: var(--epr-brand-400, #5cb88a);
  color: var(--epr-brand-800, #155d37);
}

.epr-import-lines-trigger:focus-visible {
  outline: 2px solid var(--epr-brand-500, #2f9d66);
  outline-offset: 2px;
}

.epr-import-lines-trigger__count {
  font-variant-numeric: tabular-nums;
}

.epr-import-lines-trigger__label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.epr-import-lines-trigger__icon {
  display: inline-flex;
  line-height: 0;
}

.epr-import-lines-trigger__icon .epr-nav-ic {
  width: 0.875rem;
  height: 0.875rem;
}

@media (max-width: 991.98px) {
  .epr-materials-import-aside-sticky {
    position: static;
  }
}
.btn-link {
    color: var(--epr-brand-700);
}
.table-light{
    height:40px !important;
}
.select2-dropdown.epr-select2-batch-material-picker {
  min-width: 42rem;
}

.epr-batch-material-picker-head,
.epr-batch-material-picker-row {
  display: grid;
  grid-template-columns: 7rem minmax(8rem, 1.2fr) minmax(8rem, 1fr) minmax(10rem, 1.4fr);
  gap: 0.5rem;
  align-items: center;
  width: 100%;
}

.epr-batch-material-picker-head {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--epr-text-muted, #6c757d);
  border-bottom: 1px solid var(--epr-border-subtle, #dee2e6);
  background: var(--epr-surface-subtle, #f8f9fa);
}

.epr-batch-material-picker-row {
  font-size: 0.8125rem;
  line-height: 1.3;
}

.epr-batch-material-picker-col {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select2-container--default .select2-results__option .epr-batch-material-picker-row {
  pointer-events: none;
}

/* Bảng vật liệu lô (tạo nhiều lô): độ rộng cột — chỉnh tại .epr-batch-materials-col--* */
.epr-popup-form--select2-stable .epr-batch-materials-table {
  --epr-so-row-control-h: 1.85rem;
  table-layout: fixed;
  width: 100%;
  min-width: 42rem;
  font-size: 0.72rem;
}

.epr-popup-form--select2-stable .epr-batch-materials-table th,
.epr-popup-form--select2-stable .epr-batch-materials-table td {
  padding: 0.28rem 0.32rem;
  vertical-align: middle;
  min-width: 0;
}

.epr-popup-form--select2-stable .epr-batch-materials-table thead th {
  white-space: nowrap;
  font-size: 0.58rem;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.epr-popup-form--select2-stable .epr-batch-materials-table .form-select,
.epr-popup-form--select2-stable .epr-batch-materials-table .form-control {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 0.72rem;
  height: var(--epr-so-row-control-h);
  min-height: var(--epr-so-row-control-h);
  padding: 0 0.35rem;
  line-height: calc(var(--epr-so-row-control-h) - 2px);
}

.epr-popup-form--select2-stable .epr-batch-materials-table .select2-container {
  width: 100% !important;
  max-width: 100%;
  min-width: 0;
}

.epr-popup-form--select2-stable .epr-batch-materials-table .select2-container .select2-selection--single {
  height: var(--epr-so-row-control-h) !important;
  min-height: var(--epr-so-row-control-h) !important;
  box-sizing: border-box;
}

.epr-popup-form--select2-stable .epr-batch-materials-table .select2-container .select2-selection__rendered {
  padding-left: 0.35rem;
  padding-right: 1.25rem;
  font-size: 0.72rem;
  line-height: calc(var(--epr-so-row-control-h) - 2px) !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.epr-popup-form--select2-stable .epr-batch-materials-table .select2-container .select2-selection__arrow {
  height: calc(var(--epr-so-row-control-h) - 2px) !important;
  top: 0 !important;
}

.epr-popup-form--select2-stable .epr-batch-materials-table td.text-end .form-control {
  text-align: right;
}

.epr-batch-materials-col--idx {
  width: 1.75rem;
}

.epr-batch-materials-col--code {
  width: 3.25rem;
}

.epr-batch-materials-col--title {
  width: 18%;
}

.epr-batch-materials-col--project {
  width: 24%;
}

.epr-batch-materials-col--material {
  width: 21%;
}

.epr-batch-materials-col--unit {
  width: 4rem;
}

.epr-batch-materials-col--gross {
  width: 3rem;
}

.epr-batch-materials-col--actions {
  width: 1.75rem;
}

.epr-batch-materials-table .epr-batch-item-mat {
  cursor: default;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 0.35rem;
}

.epr-popup-form--rt-config-ph-create .epr-rt-config-ph-create__keys-field .select2-container--default .select2-selection--multiple {
  min-height: 7.5rem;
  align-content: flex-start;
}

.epr-popup-form--rt-config-ph-create .epr-rt-config-ph-create__keys-field .select2-container--default .select2-selection--multiple .select2-selection__rendered {
  min-height: 6.75rem;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;}
/* Map territory labels — Leaflet layer positions via latLngToLayerPoint + zoomanim. */
.epr-map-territory-label-text {
  position: absolute;
  pointer-events: none;
  white-space: nowrap;
  color: #ffffff;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0;
  text-shadow:
    -1px -1px 0 #1e4d72,
    1px -1px 0 #1e4d72,
    -1px 1px 0 #1e4d72,
    1px 1px 0 #1e4d72,
    0 0 3px rgba(0, 32, 64, 0.85);
}

.epr-map-territory-label-text.is-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
}

.epr-map-territory-label-text--reef {
  font-size: 8px;
}

.epr-map-territory-label-text--island {
  font-size: 9px;
}

.epr-map-territory-label-text--archipelago {
  font-size: 10px;
  font-weight: 500;
}