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: baseline;
  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-mark {
  color: var(--epr-brand-700);
  font-family: var(--epr-font-display);
  font-weight: 700;
  font-size: inherit;
  letter-spacing: inherit;
}

.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ữ — giống prototype `epr-lang-toggle`: một khối viền, hai nút liền */
.epr-topbar-lang {
  display: inline-flex;
  align-items: stretch;
  padding: 0;
  gap: 0;
  border-radius: var(--epr-radius-sm);
  overflow: hidden;
  background: var(--epr-surface);
  border: 1px solid var(--epr-border);
}

.epr-topbar-lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 1.75rem;
  padding: 0.1rem 0.35rem;
  margin: 0;
  border: none;
  border-radius: 0;
  font-size: 0.6875rem;
  font-weight: var(--epr-font-weight-semibold);
  line-height: 1.15;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--epr-neutral-700);
  background: var(--epr-surface);
  transition:
    color 0.12s ease,
    background-color 0.12s ease;
}

.epr-topbar-lang-btn:hover {
  color: var(--epr-text-primary);
  background: var(--epr-neutral-100);
}

.epr-topbar-lang-btn.is-active {
  color: var(--grac-green-800);
  background: var(--grac-green-50);
  box-shadow: none;
}

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

.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;
}

/* 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;
  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-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-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;
}

.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-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;
}

.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;
}

.epr-main-inner.is-loading {
  opacity: 0.65;
  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,
.form-select:focus {
  border-color: var(--epr-brand-600);
  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;
}

.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);
}

@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;
}

/* 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-primary);
  font-size: var(--epr-card-title-size);
  line-height: var(--epr-card-title-line-height);
  font-weight: var(--epr-card-title-weight);
}

.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-template-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-role-templates-workspace .epr-template__summary {
  display: none;
}

.tpl-page.tpl-role-templates-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(2) {
  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-template-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-data-table tbody td {
  vertical-align: middle;
}

/* 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) {
  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):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):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 danh sách master */
.epr-actions-dropdown {
  position: relative;
  z-index: 1;
}

.epr-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: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;
}

.epr-actions-dropdown__menu {
  /*min-width: 11rem;*/
  font-size: var(--epr-font-size-sm);
}

/* Hover mục thường (không áp dụng Xóa — tránh đè .text-danger !important của Bootstrap) */
.epr-actions-dropdown__menu .dropdown-item:not(.epr-dropdown-item--delete):hover,
.epr-actions-dropdown__menu .dropdown-item:not(.epr-dropdown-item--delete):focus {
  background-color: var(--epr-neutral-100, #f3f4f6);
  color: var(--bs-dropdown-link-color, #212529);
}

.epr-actions-dropdown__menu .dropdown-item:not(.epr-dropdown-item--delete):active,
.epr-actions-dropdown__menu .dropdown-item:not(.epr-dropdown-item--delete).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 {
  color: #dc2626;
}

.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 button.dropdown-item.epr-dropdown-item--delete:hover,
.epr-actions-dropdown__menu button.dropdown-item.epr-dropdown-item--delete:focus {
  background-color: #dc2626;
  color: #fff;
}

.epr-actions-dropdown__menu .dropdown-item.epr-dropdown-item--delete:active,
.epr-actions-dropdown__menu button.dropdown-item.epr-dropdown-item--delete:active {
  background-color: #b91c1c;
  color: #fff;
}

.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-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,
.form-select:focus-visible,
input:not([type="checkbox"]):not([type="radio"]):focus-visible,
textarea:focus-visible,
select:focus-visible {
  border-color: var(--epr-brand-600);
  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-primary);
  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;
  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);
}

.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;
}

/* Chi tiết tổ chức — mỗi khối là một card (panel) tách bạch */
.epr-org-detail--stack {
  display: flex;
  flex-direction: column;
  gap: var(--epr-space-4);
}

.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__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-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__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);
}

.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-org-detail__value-link {
  text-decoration: none;
  font-weight: 600;
}

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

.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;
}

/* 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;
}

.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;
}

/* 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);
}

.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;
}

.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--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 {
  flex: 1 1 auto;
  min-height: 0;
}

.epr-template--master-list .epr-template__content > *:not(.epr-master-list-table-card) {
  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);
}

.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));
}

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;
}

html.epr-popup-html-root.epr-select2-open,
html.epr-popup-html-root.epr-select2-open body.epr-popup-body {
  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: visible !important;
}

.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;
}

/* 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);
}

/* 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__footer {
  margin: 0;
  background: var(--epr-neutral-100, #f4f6f8);
  border-top: 1px solid var(--epr-border, #e2e5e9);
}

/* 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-main .select2-container,
.epr-popup-body .select2-container {
  display: block;
  min-width: 0;
}

.epr-main .select2-container--default .select2-selection--single {
  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%;
}

.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 {
  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 body, z-index cao; iframe nới height khi mở (epr-components.js) */
body.epr-popup-body .select2-dropdown {
  z-index: 10500;
}

body.epr-popup-body .select2-dropdown.epr-select2-popup-compact .select2-results__options {
  max-height: 8.5rem;
}

/* ---- 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__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__lang {
  display: inline-flex;
  border: 1px solid #e2e5e9;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #fff;
}

.epr-login__lang-seg {
  display: inline-block;
  padding: 0.45rem 1rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--epr-text-primary, #2c3338);
  text-decoration: none;
  border-right: 1px solid #e2e5e9;
  line-height: 1.2;
}

.epr-login__lang-seg:last-child {
  border-right: 0;
}

.epr-login__lang-seg:hover {
  color: var(--grac-green-800, #1a6b3f);
  background: rgba(211, 231, 218, 0.45);
}

.epr-login__lang-seg.is-active {
  background: var(--grac-green-50, #e8f5ea);
  color: var(--grac-green-900, #155d37);
}

.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;
}

/* 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;
}
