/**
 * Mogav UI standards — additive layer on nexlink theme/layout.
 * Preserves existing markup; upgrades chrome, tables, status, forms, modals, motion.
 */

:root,
html.light-theme,
html.semi-dark,
html.minimal-theme,
html.dark-theme {
  --mogav-status-success: #009966;
  --mogav-status-success-soft: #e8f8f1;
  --mogav-status-warning: #c47a00;
  --mogav-status-warning-soft: #fff4de;
  --mogav-status-danger: #e03131;
  --mogav-status-danger-soft: #fdecec;
  --mogav-status-info: #0ea5e9;
  --mogav-status-info-soft: #e7f6fd;
  --mogav-status-neutral: #5b6b7c;
  --mogav-status-neutral-soft: #eef2f6;
  --mogav-status-primary: var(--haze-primary);
  --mogav-status-primary-soft: var(--haze-primary-soft);
  --mogav-motion: 180ms ease;
  --mogav-section-gap: 1.5rem;
}

/* ------------------------------------------------------------------ */
/* 1) Page chrome — tighten breadcrumb ribbon + content rhythm         */
/* ------------------------------------------------------------------ */

.page-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.page-content > .page-breadcrumb {
  margin-bottom: 0 !important;
}

.page-content > .card {
  /* Theme cards use margin-bottom: 24px; page-content already gaps children — avoid double space */
  margin-bottom: 0 !important;
}

.page-content > .card.radius-10 {
  border: 1px solid var(--haze-border);
  box-shadow: var(--haze-shadow-sm);
  background: var(--haze-surface);
}

/* Space between stacked search + results cards inside tabs (same visual as page-content gap) */
.tab-pane > .card + .card {
  margin-top: 1rem;
}

#pageBreadcrumb.has-page-ribbon {
  padding-bottom: 2px;
}

.mogav-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.mogav-page-header-main {
  min-width: 0;
}

.mogav-page-header-title {
  margin: 0;
  color: var(--haze-heading);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.mogav-page-header-desc {
  margin: 4px 0 0;
  color: var(--haze-muted);
  font-size: .8125rem;
  max-width: 52rem;
}

.mogav-page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Section titles used across register/list cards */
.page-content h6.d-flex.align-items-center.text-primary.fw-bold,
.modal-body h6.d-flex.align-items-center.text-primary.fw-bold,
.offcanvas-body h6.d-flex.align-items-center.text-primary.fw-bold {
  gap: 0;
  letter-spacing: -.01em;
}

.page-content h6.d-flex.align-items-center.text-primary.fw-bold + hr,
.modal-body h6.d-flex.align-items-center.text-primary.fw-bold + hr,
.offcanvas-body h6.d-flex.align-items-center.text-primary.fw-bold + hr {
  margin-top: .65rem !important;
  margin-bottom: 1rem !important;
  opacity: .55;
  border-color: var(--haze-border);
}

.mogav-section-title {
  display: flex;
  align-items: center;
  color: var(--haze-primary);
  font-weight: 600;
  font-size: .8125rem;
  margin: 0;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--haze-border);
}

.mogav-section-title > i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: .5rem;
  padding: .35rem .45rem;
  border-radius: 8px;
  background: var(--haze-primary-soft);
  color: var(--haze-primary);
  font-size: 1.15rem;
}

/* ------------------------------------------------------------------ */
/* 2) Tables — calmer headers, denser rows, sticky Action             */
/* ------------------------------------------------------------------ */

/* View tables: tighter corner radius (reports keep their own rules) */
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body .table-responsive:not(:has(table.report-table)):not(:has(table.timetable-report-table)):not(:has(table.attendance-report-table)):not(:has(table.att-daily-grid)),
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body div.dataTables_wrapper,
html body .table-responsive:not(:has(table.report-table)):not(:has(table.timetable-report-table)):not(:has(table.attendance-report-table)):not(:has(table.att-daily-grid)),
html body div.dataTables_wrapper {
  border-radius: 2px;
}
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body .table-responsive:not(:has(table.report-table)):not(:has(table.timetable-report-table)):not(:has(table.attendance-report-table)):not(:has(table.att-daily-grid)),
html body .table-responsive:not(:has(table.report-table)):not(:has(table.timetable-report-table)):not(:has(table.attendance-report-table)):not(:has(table.att-daily-grid)) {
  overflow: hidden;
}

.table > :not(caption) > * > * {
  padding: .5rem .7rem;
  vertical-align: middle;
}

.table.table-sm > :not(caption) > * > * {
  padding: .4rem .55rem;
}

/* Non-report table headers match page ribbon; slightly shorter header row */
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body .table thead tr.table-success,
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body .table thead tr.table-primary,
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body table.dataTable thead tr.table-success,
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body table.dataTable thead tr.table-primary,
html body .table thead tr.table-success,
html body .table thead tr.table-primary,
html body table.dataTable thead tr.table-success,
html body table.dataTable thead tr.table-primary {
  background: transparent !important;
  height: auto !important;
}

html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body .table thead th,
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body .table thead tr.table-success > th,
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body .table thead tr.table-primary > th,
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body .table thead.table-success > tr > th,
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body .table thead.table-light > tr > th,
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body table.dataTable thead th,
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body table.dataTable thead tr.table-success > th,
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body table.dataTable thead tr.table-primary > th,
html body .table thead th,
html body .table thead tr.table-success > th,
html body .table thead tr.table-primary > th,
html body .table thead.table-success > tr > th,
html body .table thead.table-light > tr > th,
html body table.dataTable thead th,
html body table.dataTable thead tr.table-success > th,
html body table.dataTable thead tr.table-primary > th {
  background: var(--page-ribbon-bg, var(--haze-heading)) !important;
  color: var(--page-ribbon-fg, #fff) !important;
  border-bottom: 1px solid var(--page-ribbon-bg, var(--haze-heading)) !important;
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
  padding-top: .75rem !important;
  padding-bottom: .75rem !important;
  height: auto !important;
  line-height: 1.3;
}

/* DataTables sort indicators stay readable on ribbon headers */
table.dataTable thead :is(th, td).sorting,
table.dataTable thead :is(th, td).sorting_asc,
table.dataTable thead :is(th, td).sorting_desc,
table.dataTable thead :is(th, td).sorting_asc_disabled,
table.dataTable thead :is(th, td).sorting_desc_disabled {
  color: var(--page-ribbon-fg, #fff) !important;
}
table.dataTable thead :is(.sorting, .sorting_asc, .sorting_desc)::before,
table.dataTable thead :is(.sorting, .sorting_asc, .sorting_desc)::after {
  color: var(--page-ribbon-fg, #fff) !important;
  opacity: .85;
}

/* Report / printable tables keep light headers and original header height */
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body :is(
  [id$="PrintArea"] table,
  [id*="ReportPrintArea"] table,
  #mbsPrintArea table,
  table.report-table,
  table.table-bordered.report-table,
  table.timetable-report-table,
  table.attendance-report-table,
  table.att-daily-grid
) thead th,
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body :is(
  [id$="PrintArea"] table,
  [id*="ReportPrintArea"] table,
  #mbsPrintArea table,
  table.report-table,
  table.table-bordered.report-table,
  table.timetable-report-table,
  table.attendance-report-table,
  table.att-daily-grid
) thead tr.table-success > th,
html body :is(
  [id$="PrintArea"] table,
  [id*="ReportPrintArea"] table,
  #mbsPrintArea table,
  table.report-table,
  table.table-bordered.report-table,
  table.timetable-report-table,
  table.attendance-report-table,
  table.att-daily-grid
) thead th,
html body :is(
  [id$="PrintArea"] table,
  [id*="ReportPrintArea"] table,
  #mbsPrintArea table,
  table.report-table,
  table.table-bordered.report-table,
  table.timetable-report-table,
  table.attendance-report-table,
  table.att-daily-grid
) thead tr.table-success > th {
  background: #eef2f6 !important;
  color: #1c252e !important;
  border-bottom: 1px solid #000 !important;
  text-transform: none;
  letter-spacing: normal;
  padding-top: 9px !important;
  padding-bottom: 9px !important;
  height: auto !important;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-bg-type: var(--haze-info-soft);
  --bs-table-accent-bg: var(--haze-info-soft);
  background-color: var(--haze-info-soft) !important;
}

html.dark-theme .table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-bg-type: var(--haze-info-soft);
  --bs-table-accent-bg: var(--haze-info-soft);
  background-color: var(--haze-info-soft) !important;
}

.table-hover > tbody > tr:hover > * {
  --bs-table-bg-state: var(--haze-info-soft);
  --bs-table-accent-bg: var(--haze-info-soft);
  background-color: color-mix(in srgb, var(--haze-info) 12%, var(--haze-info-soft)) !important;
}

/* Shared table checkboxes — same look as attendance sheet */
.attendance-check-all,
.mogav-check-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.attendance-check-all .form-check-input {
  margin: 0;
  cursor: pointer;
  width: 1.15rem;
  height: 1.15rem;
}

.attendance-check,
.mogav-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
  user-select: none;
}

.attendance-check .form-check-input {
  margin: 0;
  cursor: pointer;
  width: 1.15rem;
  height: 1.15rem;
}

/* Finance checkboxes — beat layout `.form-check-input { width: 1.5em }` */
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body :is(.mogav-check, .mogav-check-all) .form-check-input,
html body :is(.mogav-check, .mogav-check-all) .form-check-input {
  width: 1.5rem !important;
  height: 1.5rem !important;
  min-width: 1.5rem !important;
  min-height: 1.5rem !important;
  margin: 0 !important;
  cursor: pointer;
}

.attendance-check-present .form-check-input:checked,
.mogav-check-present .form-check-input:checked {
  background-color: #198754 !important;
  border-color: #198754 !important;
}

/* Sticky first Action column inside horizontal scroll (no reserved gutter — avoid idle horizontal scrollbars) */

.mogav-table-actions-first thead th:first-child,
.mogav-table-actions-first tbody td:first-child,
table.mogav-table-actions-first thead th:first-child,
table.mogav-table-actions-first tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--haze-surface);
  box-shadow: 1px 0 0 var(--haze-border);
}

.mogav-table-actions-first thead th:first-child {
  z-index: 3;
  background: var(--page-ribbon-bg, var(--haze-heading)) !important;
  color: var(--page-ribbon-fg, #fff) !important;
}

.mogav-table-actions-first tbody tr:hover td:first-child {
  background: var(--haze-primary-soft);
}

html.dark-theme .mogav-table-actions-first thead th:first-child {
  background: var(--page-ribbon-bg, var(--haze-primary)) !important;
  color: var(--page-ribbon-fg, #fff) !important;
}

html.dark-theme .mogav-table-actions-first tbody td:first-child {
  background: var(--haze-surface);
}

/* ---------------------------------------------------------------------------
 * Table row kebab actions (system-wide)
 * - No fill / border / caret
 * - Visible in light & dark
 * - Menu stacks above the table
 * --------------------------------------------------------------------------- */
html body table .btn-group > .btn.btn-sm[data-bs-toggle="dropdown"],
html body table .btn-group > .btn.btn-sm.dropdown-toggle[data-bs-toggle="dropdown"],
html body table .mbs-action-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 2rem;
  min-height: 2rem;
  padding: .2rem !important;
  background: transparent !important;
  background-color: transparent !important;
  border: 0 !important;
  border-color: transparent !important;
  border-radius: .35rem;
  box-shadow: none !important;
  outline: 0 !important;
  color: var(--haze-heading, #02335B) !important;
  line-height: 1 !important;
}
html body table .btn-group > .btn.btn-sm[data-bs-toggle="dropdown"]::after,
html body table .btn-group > .btn.btn-sm.dropdown-toggle[data-bs-toggle="dropdown"]::after,
html body table .mbs-action-btn::after {
  display: none !important;
  content: none !important;
  border: 0 !important;
}
html body table .btn-group > .btn.btn-sm[data-bs-toggle="dropdown"]:is(:hover, :focus, :focus-visible, :active, .active, .show, [aria-expanded="true"]),
html body table .btn-group > .btn.btn-sm.dropdown-toggle[data-bs-toggle="dropdown"]:is(:hover, :focus, :focus-visible, :active, .active, .show, [aria-expanded="true"]),
html body table .mbs-action-btn:is(:hover, :focus, :focus-visible, :active, .active, .show, [aria-expanded="true"]) {
  background: transparent !important;
  background-color: transparent !important;
  border: 0 !important;
  border-color: transparent !important;
  box-shadow: none !important;
  outline: 0 !important;
  color: var(--haze-primary, #0080FF) !important;
}
html body table .btn-group > .btn.btn-sm[data-bs-toggle="dropdown"] i,
html body table .btn-group > .btn.btn-sm.dropdown-toggle[data-bs-toggle="dropdown"] i,
html body table .mbs-action-btn i {
  display: block;
  font-size: 1.25rem;
  line-height: 1;
  margin: 0;
  color: inherit !important;
  opacity: 1 !important;
  visibility: visible !important;
}
html.dark-theme body table .btn-group > .btn.btn-sm[data-bs-toggle="dropdown"],
html.dark-theme body table .btn-group > .btn.btn-sm.dropdown-toggle[data-bs-toggle="dropdown"],
html.dark-theme body table .mbs-action-btn {
  color: var(--haze-heading, #F2F6FA) !important;
}
html.dark-theme body table .btn-group > .btn.btn-sm[data-bs-toggle="dropdown"]:is(:hover, :focus, :focus-visible, :active, .active, .show, [aria-expanded="true"]),
html.dark-theme body table .btn-group > .btn.btn-sm.dropdown-toggle[data-bs-toggle="dropdown"]:is(:hover, :focus, :focus-visible, :active, .active, .show, [aria-expanded="true"]),
html.dark-theme body table .mbs-action-btn:is(:hover, :focus, :focus-visible, :active, .active, .show, [aria-expanded="true"]) {
  color: var(--haze-primary, #4DA3FF) !important;
}

/* Keep kebab menus above table chrome / clipped scroll areas */
html body .table-responsive:has(.dropdown-menu.show),
html body .table-responsive:has(.btn-group.show) {
  overflow: visible !important;
}
html body table tbody tr:has(.dropdown-menu.show),
html body table tbody tr:has(.btn-group.show) {
  position: relative;
  z-index: 20;
}
html body table td .btn-group,
html body table td .dropdown {
  position: static;
}
html body table td .dropdown-menu {
  z-index: 2000 !important;
}

/* Compact table action buttons (same look as timetable Remove, with label) */
.mogav-action-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  flex: 0 0 auto;
  width: auto !important;
  min-width: 0 !important;
  min-height: 30px !important;
  height: auto !important;
  padding: .3rem .7rem !important;
  margin: 0;
  border-radius: 8px !important;
  font-size: .72rem !important;
  font-weight: 600 !important;
  letter-spacing: .01em;
  line-height: 1;
  box-shadow: none !important;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.mogav-action-btn i {
  font-size: .95rem;
  line-height: 1;
  margin: 0;
}

.mogav-action-btn span {
  display: inline-block;
  line-height: 1;
}

.mogav-action-btn.is-view,
.mogav-action-btn.is-primary {
  border: 1px solid color-mix(in srgb, var(--haze-primary) 45%, var(--haze-border)) !important;
  background: color-mix(in srgb, var(--haze-primary) 10%, var(--haze-surface)) !important;
  color: var(--haze-primary) !important;
}

.mogav-action-btn.is-view:hover,
.mogav-action-btn.is-view:focus-visible,
.mogav-action-btn.is-primary:hover,
.mogav-action-btn.is-primary:focus-visible {
  background: var(--haze-primary) !important;
  border-color: var(--haze-primary) !important;
  color: #fff !important;
  outline: none;
  box-shadow: none !important;
}

.mogav-action-btn.is-cancel,
.mogav-action-btn.is-danger {
  border: 1px solid color-mix(in srgb, var(--haze-danger, #c6283d) 45%, var(--haze-border)) !important;
  background: color-mix(in srgb, var(--haze-danger, #c6283d) 10%, var(--haze-surface)) !important;
  color: var(--haze-danger, #c6283d) !important;
}

.mogav-action-btn.is-cancel:hover,
.mogav-action-btn.is-cancel:focus-visible,
.mogav-action-btn.is-danger:hover,
.mogav-action-btn.is-danger:focus-visible {
  background: var(--haze-danger, #c6283d) !important;
  border-color: var(--haze-danger, #c6283d) !important;
  color: #fff !important;
  outline: none;
  box-shadow: none !important;
}

html.dark-theme .mogav-action-btn.is-cancel,
html.dark-theme .mogav-action-btn.is-danger {
  background: color-mix(in srgb, var(--haze-danger, #c6283d) 14%, var(--haze-surface)) !important;
  border-color: color-mix(in srgb, var(--haze-danger, #c6283d) 40%, var(--haze-border)) !important;
  color: #ff8b8b !important;
}

/* DataTables chrome */
div.dataTables_wrapper div.dataTables_length select,
div.dataTables_wrapper div.dataTables_filter input {
  border-radius: var(--haze-control-radius);
  border-color: var(--haze-border);
}

div.dataTables_wrapper .dataTables_length,
div.dataTables_wrapper .dataTables_filter {
  margin-bottom: .5rem;
}

div.dataTables_wrapper .dataTables_info,
div.dataTables_wrapper .dataTables_paginate {
  padding-top: .75rem;
  color: var(--haze-muted);
  font-size: .8rem;
}

/* ------------------------------------------------------------------ */
/* 3) Shared status badges                                             */
/* ------------------------------------------------------------------ */

.mogav-status,
.badge.mogav-status,
.badge:has(> i.bx) {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .28rem .55rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: .01em;
  line-height: 1.2;
  border: 0;
}

.mogav-status > i.bx,
.badge > i.bx {
  font-size: .95em;
  line-height: 1;
  flex: 0 0 auto;
}

.mogav-status-success,
.badge.mogav-status-success { background: var(--mogav-status-success-soft) !important; color: var(--mogav-status-success) !important; }
.mogav-status-warning,
.badge.mogav-status-warning { background: var(--mogav-status-warning-soft) !important; color: var(--mogav-status-warning) !important; }
.mogav-status-danger,
.badge.mogav-status-danger { background: var(--mogav-status-danger-soft) !important; color: var(--mogav-status-danger) !important; }
.mogav-status-info,
.badge.mogav-status-info { background: var(--mogav-status-info-soft) !important; color: var(--mogav-status-info) !important; }
.mogav-status-neutral,
.badge.mogav-status-neutral { background: var(--mogav-status-neutral-soft) !important; color: var(--mogav-status-neutral) !important; }
.mogav-status-primary,
.badge.mogav-status-primary { background: var(--mogav-status-primary-soft) !important; color: var(--mogav-status-primary) !important; }

/* Align legacy light badges with the shared palette */
.badge.bg-light-success.text-success { background: var(--mogav-status-success-soft) !important; color: var(--mogav-status-success) !important; }
.badge.bg-light-warning.text-warning { background: var(--mogav-status-warning-soft) !important; color: var(--mogav-status-warning) !important; }
.badge.bg-light-danger.text-danger { background: var(--mogav-status-danger-soft) !important; color: var(--mogav-status-danger) !important; }
.badge.bg-light-info.text-info { background: var(--mogav-status-info-soft) !important; color: var(--mogav-status-info) !important; }
.badge.bg-light-primary.text-primary { background: var(--mogav-status-primary-soft) !important; color: var(--mogav-status-primary) !important; }
.badge.bg-light-secondary.text-secondary,
.badge.bg-light-dark.text-dark { background: var(--mogav-status-neutral-soft) !important; color: var(--mogav-status-neutral) !important; }

html.dark-theme {
  --mogav-status-success-soft: rgba(0, 153, 102, .18);
  --mogav-status-warning-soft: rgba(196, 122, 0, .18);
  --mogav-status-danger-soft: rgba(224, 49, 49, .18);
  --mogav-status-info-soft: rgba(14, 165, 233, .18);
  --mogav-status-neutral-soft: rgba(197, 208, 220, .12);
}

/* ------------------------------------------------------------------ */
/* 4) Empty + loading states                                           */
/* ------------------------------------------------------------------ */

.mogav-empty,
.mogav-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: .5rem;
  padding: 2.25rem 1.25rem;
  color: var(--haze-muted);
}

.mogav-empty > i,
.mogav-loading > i {
  font-size: 1.75rem;
  color: var(--haze-soft);
  opacity: .9;
}

.mogav-empty-title {
  margin: 0;
  color: var(--haze-heading);
  font-size: .95rem;
  font-weight: 600;
}

.mogav-empty-desc {
  margin: 0;
  max-width: 28rem;
  font-size: .8125rem;
  color: var(--haze-muted);
}

.mogav-loading-dots {
  display: inline-flex;
  gap: 5px;
  margin-top: .25rem;
}

.mogav-loading-dots > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--haze-primary);
  opacity: .35;
  animation: mogav-pulse 1s ease-in-out infinite;
}

.mogav-loading-dots > span:nth-child(2) { animation-delay: .15s; }
.mogav-loading-dots > span:nth-child(3) { animation-delay: .3s; }

@keyframes mogav-pulse {
  0%, 100% { opacity: .25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}

td .mogav-empty,
td .mogav-loading {
  padding: 1.5rem .75rem;
}

/* ------------------------------------------------------------------ */
/* 5) Forms + modal action footers                                     */
/* ------------------------------------------------------------------ */

.page-content .form-label {
  font-size: .8rem;
  font-weight: 500;
  color: var(--haze-heading);
  margin-bottom: .35rem;
}

.page-content .form-control,
.page-content .form-select,
.modal .form-control,
.modal .form-select {
  border-radius: var(--haze-control-radius);
  border-color: var(--haze-border);
  min-height: 38px;
}

.mogav-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--haze-border);
}

.mogav-form-actions .btn-light,
.modal-footer .btn-light,
.offcanvas .border-top.p-3 .btn-light,
.mogav-modal-actions .btn-light {
  background: var(--haze-surface-2);
  border-color: var(--haze-border);
  color: var(--haze-heading);
}

.mogav-form-actions .btn-light:hover,
.modal-footer .btn-light:hover,
.offcanvas .border-top.p-3 .btn-light:hover {
  background: var(--haze-surface-3);
  border-color: var(--haze-border-strong);
}

.modal-footer,
.offcanvas .border-top.p-3,
.mogav-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--haze-border);
  background: var(--haze-surface);
}

.modal-header,
.offcanvas-header {
  border-bottom-color: var(--haze-border);
}

.modal-header .modal-title,
.offcanvas-header .offcanvas-title {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--haze-heading);
  font-weight: 600;
  font-size: 1rem;
}

.modal-header .modal-title > i,
.offcanvas-header .offcanvas-title > i {
  color: var(--haze-primary);
  font-size: 1.2rem;
}

/* Compact solid icon actions (same shape as MBS remove buttons) */
.mogav-icon-action {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 34px;
  height: 34px;
  padding: 0 !important;
  margin: 0 auto;
  border: 0 !important;
  border-radius: 8px;
  line-height: 1 !important;
  box-shadow: none !important;
}

.mogav-icon-action i {
  display: block;
  font-size: 1.1rem;
  line-height: 1;
  margin: 0;
  padding: 0;
}

.mogav-icon-action-primary {
  background: var(--haze-primary, #0d3b66) !important;
  color: #fff !important;
}

.mogav-icon-action-primary:hover,
.mogav-icon-action-primary:focus {
  filter: brightness(0.92);
  color: #fff !important;
}

.mogav-icon-action-danger {
  background: var(--mogav-status-danger, #e03131) !important;
  color: #fff !important;
}

.mogav-icon-action-danger:hover,
.mogav-icon-action-danger:focus {
  background: #c6283d !important;
  color: #fff !important;
}

/* Deleted Activities — View Deleted Record (key/value snapshot) */
.deleted-record-view-table {
  border-collapse: collapse;
  width: 100%;
  margin: 0;
}

.deleted-record-view-table > :not(caption) > * > * {
  border-width: 1px;
}

.deleted-record-view-table th,
.deleted-record-view-table td {
  padding: .55rem .75rem;
  vertical-align: middle;
  font-size: .9rem;
  border: 1px solid var(--haze-border, #dee2e6) !important;
}

.deleted-record-view-table th {
  width: 32%;
  min-width: 140px;
  background: var(--haze-primary, #0d3b66) !important;
  color: #fff !important;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.deleted-record-view-table td {
  background: var(--haze-surface, #fff) !important;
  color: var(--haze-text, #212529) !important;
  word-break: break-word;
}

html.dark-theme body .deleted-record-view-table th {
  background: #1a4a75 !important;
  color: #fff !important;
}

/* Quiet secondary / loud primary / clear danger */
.btn.btn-outline-danger,
.btn.btn-danger {
  font-weight: 500;
}

/* ------------------------------------------------------------------ */
/* 6) Sidebar clarity (additive; keeps rail trial)                     */
/* ------------------------------------------------------------------ */

html:is(.light-theme, .semi-dark, .minimal-theme) body .dreams-menu-panel .metismenu > li > a {
  margin-inline: 8px;
  padding-block: .55rem;
}

html:is(.light-theme, .semi-dark, .minimal-theme) body .dreams-menu-panel .metismenu li.mm-active > a,
html:is(.light-theme, .semi-dark, .minimal-theme) body .dreams-menu-panel .metismenu li > a.active {
  box-shadow: 0 1px 2px rgb(2 51 91 / 8%);
}

html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body .dreams-module-list {
  gap: 6px;
}

html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body .sidebar-wrapper .menu-label {
  margin-top: .65rem;
  margin-bottom: .25rem;
  opacity: .85;
}

/* ------------------------------------------------------------------ */
/* 7) Responsive helpers                                               */
/* ------------------------------------------------------------------ */

@media (max-width: 991.98px) {
  .mogav-page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .mogav-page-header-actions {
    width: 100%;
  }

  .mogav-page-header-actions .btn {
    flex: 1 1 auto;
  }

  .table-responsive {
    margin-inline: -4px;
    padding-inline: 4px;
  }

  /* Stack filter rows above tables more comfortably */
  .card-body .row.g-2.mb-3 > [class*="col-"] {
    margin-bottom: 2px;
  }
}

@media (max-width: 575.98px) {
  .nav-tabs .nav-link {
    padding: .5rem .65rem;
    font-size: .8rem;
  }

  .nav-tabs .tab-title {
    display: none;
  }

  .nav-tabs .tab-icon {
    margin: 0 !important;
  }

  .mogav-form-actions,
  .modal-footer,
  .mogav-modal-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .mogav-form-actions .btn,
  .modal-footer .btn,
  .mogav-modal-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ------------------------------------------------------------------ */
/* 8) Light motion                                                     */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: no-preference) {
  .page-content > .card,
  .tab-pane.fade.show {
    animation: mogav-fade-up var(--mogav-motion) both;
  }

  .btn,
  .nav-link,
  .sidebar-wrapper .metismenu a,
  .dreams-module-list :is(button, a),
  .badge {
    transition: background-color var(--mogav-motion), color var(--mogav-motion), border-color var(--mogav-motion), box-shadow var(--mogav-motion), transform var(--mogav-motion);
  }

  .btn:active:not(:disabled) {
    transform: translateY(1px);
  }

  .lobibox-notify,
  .iziToast {
    animation-duration: var(--mogav-motion) !important;
  }
}

@keyframes mogav-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------------ */
/* 9) Brand consistency — radii, cards, tabs                           */
/* ------------------------------------------------------------------ */

.card.radius-10 {
  border-radius: var(--haze-radius) !important;
}

.nav-tabs {
  border-bottom-color: var(--haze-border);
  gap: 2px;
}

.nav-tabs .nav-link {
  border: 0;
  border-radius: 8px 8px 0 0;
  color: var(--haze-muted);
  font-weight: 500;
}

.nav-tabs .nav-link:hover {
  color: var(--haze-primary);
  background: var(--haze-primary-soft);
}

.nav-tabs .nav-link.active {
  color: var(--haze-primary);
  background: transparent;
  box-shadow: inset 0 -2px 0 var(--haze-primary);
}

.btn {
  border-radius: var(--haze-control-radius);
}

.btn i[style*="font-size"] {
  line-height: 1;
}

/* Staff directory cards — slightly clearer hover */
.staff-directory-card {
  border: 1px solid var(--haze-border);
  transition: border-color var(--mogav-motion), box-shadow var(--mogav-motion);
}

.staff-directory-card:hover {
  border-color: var(--haze-border-strong);
  box-shadow: var(--haze-shadow-sm);
}

.staff-directory-card__avatar {
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  object-fit: cover;
}

/* Idle session warning countdown */
#mogavIdleCountdown {
  color: var(--haze-primary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* All SweetAlert2 dialogs: top-center (not viewport middle) */
.swal2-container.swal2-top {
  align-items: flex-start !important;
  justify-content: center !important;
  padding-top: 1.25rem !important;
}

.swal2-container.swal2-top > .swal2-popup,
.swal2-popup.mogav-swal,
.swal2-popup.mogav-idle-swal {
  margin-top: 0 !important;
}

/* Soft media placeholders — photos & missing files */
img.mogav-avatar,
.mogav-avatar {
  object-fit: cover;
  background: #e8eef4;
  vertical-align: middle;
}

.mogav-avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  color: #fff;
  flex-shrink: 0;
  user-select: none;
  vertical-align: middle;
}

.mogav-avatar-teal { background: #0d9488; }
.mogav-avatar-slate { background: #64748b; }
.mogav-avatar-indigo { background: #4f46e5; }
.mogav-avatar-amber { background: #d97706; }
.mogav-avatar-rose { background: #e11d48; }
.mogav-avatar-cyan { background: #0891b2; }

.mogav-file-missing {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--mogav-status-neutral);
  font-size: 0.875rem;
}

.mogav-file-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
}

/* User activity details modal */
.mogav-activity-modal .modal-header,
.mogav-activity-modal .offcanvas-header {
  align-items: flex-start;
  padding-bottom: 0.25rem;
}

.mogav-activity-modal .modal-body,
.mogav-activity-modal .offcanvas-body {
  padding-top: 0.75rem;
}

.mogav-activity-details {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mogav-activity-hero {
  padding: 1rem 1.1rem;
  border: 1px solid var(--haze-border);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--haze-surface-2) 0%, var(--haze-surface) 100%);
}

.mogav-activity-hero-main {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.mogav-activity-hero-action {
  flex-shrink: 0;
  padding-top: 0.15rem;
}

.mogav-activity-hero-title {
  color: var(--haze-heading);
  font-weight: 700;
  line-height: 1.35;
}

.mogav-activity-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  color: var(--mogav-status-neutral);
  font-size: 0.875rem;
}

.mogav-activity-hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.mogav-activity-hero-meta i {
  font-size: 1rem;
  color: var(--haze-primary);
}

.mogav-activity-chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.mogav-activity-chip {
  border: 1px solid var(--haze-border);
  border-radius: 10px;
  background: var(--haze-surface);
  padding: 0.7rem 0.8rem;
  min-width: 0;
}

.mogav-activity-chip span {
  display: block;
  color: var(--mogav-status-neutral);
  font-size: 0.75rem;
  margin-bottom: 0.2rem;
}

.mogav-activity-chip strong {
  display: block;
  color: var(--haze-heading);
  font-size: 0.9rem;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mogav-activity-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.mogav-activity-payload {
  border: 1px solid var(--haze-border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--haze-surface);
  min-width: 0;
}

.mogav-activity-payload-before {
  border-top: 3px solid var(--mogav-status-warning);
}

.mogav-activity-payload-after {
  border-top: 3px solid var(--mogav-status-success);
}

.mogav-activity-payload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--haze-border);
  background: var(--haze-surface-2);
  font-weight: 650;
  color: var(--haze-heading);
  font-size: 0.875rem;
}

.mogav-activity-payload-body {
  margin: 0;
  padding: 0.85rem;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--haze-heading);
  background: transparent;
  border: 0;
  border-radius: 0;
}

.mogav-activity-payload-body.is-empty {
  color: var(--mogav-status-neutral);
  font-style: italic;
}

.mogav-activity-context {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.mogav-activity-context-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  border: 1px solid var(--haze-border);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  background: var(--haze-surface);
  min-width: 0;
}

.mogav-activity-context-item > i {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--mogav-status-primary-soft, var(--haze-primary-soft));
  color: var(--haze-primary);
  font-size: 1.15rem;
  flex-shrink: 0;
}

.mogav-activity-context-item span {
  display: block;
  color: var(--mogav-status-neutral);
  font-size: 0.75rem;
  margin-bottom: 0.15rem;
}

.mogav-activity-context-item strong {
  display: block;
  color: var(--haze-heading);
  font-size: 0.875rem;
  font-weight: 600;
  word-break: break-word;
}

@media (max-width: 767.98px) {
  .mogav-activity-chips,
  .mogav-activity-compare,
  .mogav-activity-context {
    grid-template-columns: 1fr;
  }
}

/* Change Password modal — profile strip only; header/footer use shared modal styles */
#changePasswordModal .change-password-modal__profile {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1rem;
  padding: 12px;
  border: 1px solid var(--haze-border);
  border-radius: 10px;
  background: var(--haze-surface-2);
}

#changePasswordModal .change-password-modal__avatar,
#changePasswordModal .change-password-modal__avatar.mogav-avatar {
  width: 56px !important;
  height: 56px !important;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

#changePasswordModal .change-password-modal__profile-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#changePasswordModal .change-password-modal__fullname {
  display: block;
  color: var(--haze-heading);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#changePasswordModal .change-password-modal__username {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--haze-primary);
  font-size: 0.85rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#changePasswordModal .change-password-modal__role {
  display: block;
  color: var(--haze-muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#changePasswordModal .input-icon > span {
  left: 0.95rem;
  color: var(--haze-muted);
  pointer-events: none;
}

#changePasswordModal .input-icon .form-control {
  padding-left: 2.55rem;
}

#changePasswordModal .btn-toggle-password {
  color: var(--haze-muted);
  z-index: 2;
}

#changePasswordModal .btn-toggle-password:hover {
  color: var(--haze-primary);
}

/* Customers list: only scroll horizontally when content truly overflows */
.customers-table-wrap.table-responsive {
  overflow-x: auto;
  scrollbar-gutter: auto;
}
.customers-table-wrap .dataTables_wrapper {
  width: 100%;
  max-width: 100%;
  overflow: visible;
}
.customers-table-wrap table.dataTable {
  width: 100% !important;
  margin: 0 !important;
}

/* Qaran list avatars — compact square thumbnails beside names */
.table-avatar-name {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-width: 0;
  max-width: 100%;
  vertical-align: middle;
}
.table-avatar-name > span,
.table-avatar-name > .table-avatar-label {
  min-width: 0;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}
.table-avatar,
img.table-avatar,
img.rounded-circle.table-avatar,
.mogav-avatar.table-avatar,
.mogav-avatar-initials.table-avatar {
  width: 36px;
  height: 36px;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: .4rem;
  background: var(--haze-surface-2, #e8eef4);
  border: 1px solid var(--haze-border, #D5DEE8);
  vertical-align: middle;
}
.mogav-avatar-initials.table-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1;
}

.popover.customer-id-attachment-popover {
  --bs-popover-max-width: 520px;
  --bs-popover-header-padding-x: .75rem;
  --bs-popover-header-padding-y: .7rem;
  --bs-popover-body-padding-x: .5rem;
  --bs-popover-body-padding-y: .5rem;
  --bs-popover-border-radius: 8px;
  max-width: 520px;
  font-size: 11px;
  line-height: 1.25;
  z-index: 1090;
  background: var(--haze-surface, #fff);
  color: var(--haze-text, #1f2937);
  border: 1px solid var(--haze-border, #D5DEE8);
  box-shadow: 0 10px 24px rgba(2, 35, 91, .14);
}
.popover.customer-id-attachment-popover .popover-arrow::before,
.popover.customer-id-attachment-popover .popover-arrow::after {
  border-top-color: var(--haze-surface, #fff);
}
.popover.customer-id-attachment-popover .popover-header {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin: 0;
  padding: var(--bs-popover-header-padding-y) var(--bs-popover-header-padding-x);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--haze-heading, #02335B);
  background: var(--haze-surface-2, #F0F5FA);
  border-bottom: 1px solid var(--haze-border, #D5DEE8);
  border-top-left-radius: calc(8px - 1px);
  border-top-right-radius: calc(8px - 1px);
}
.popover.customer-id-attachment-popover .popover-header span {
  font-size: 13px;
  line-height: 1.3;
}
.popover.customer-id-attachment-popover .popover-header i {
  font-size: 14px;
  line-height: 1;
  color: var(--haze-primary, #0080FF);
}
.popover.customer-id-attachment-popover .popover-body {
  padding: var(--bs-popover-body-padding-y) var(--bs-popover-body-padding-x);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  background: var(--haze-surface, #fff);
  color: var(--haze-muted, #6B7C8F);
  font-size: 11px;
  line-height: 1.25;
}
.customer-id-attachment-popover-img {
  display: block;
  width: 500px;
  max-width: 100%;
  height: 400px;
  object-fit: contain;
  background: var(--haze-surface-2, #F0F5FA);
}
.customer-id-attachment-popover-frame {
  display: block;
  width: 500px;
  max-width: 100%;
  height: 400px;
  background: var(--haze-surface-2, #F0F5FA);
}
html.dark-theme .popover.customer-id-attachment-popover {
  background: var(--haze-surface, #0f172a);
  border-color: var(--haze-border, #334155);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .35);
}
html.dark-theme .popover.customer-id-attachment-popover .popover-header {
  color: var(--haze-text, #e2e8f0);
  background: var(--haze-surface-2, #1e293b);
  border-bottom-color: var(--haze-border, #334155);
}
html.dark-theme .popover.customer-id-attachment-popover .popover-body {
  background: var(--haze-surface, #0f172a);
}

/* Attachment preview triggers — compact ribbon (matches page-title ribbon) */
.btnPreviewCustomerIdAttachment,
.mogav-file-preview-btn,
.attachment-preview-ribbon {
  --attachment-ribbon-height: 20px;
  --attachment-ribbon-tail: 7px;
  --attachment-ribbon-bg: var(--haze-primary, #0080FF);
  --attachment-ribbon-fg: #fff;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  height: var(--attachment-ribbon-height);
  margin: 1px var(--attachment-ribbon-tail) 6px 0;
  padding: 0 .5rem 0 .45rem;
  border: 0 !important;
  border-radius: 0 !important;
  background: var(--attachment-ribbon-bg) !important;
  color: var(--attachment-ribbon-fg) !important;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none !important;
  box-shadow: 1px 1px 0 rgba(2, 35, 91, .14);
  cursor: pointer;
  vertical-align: middle;
}
.btnPreviewCustomerIdAttachment:hover,
.btnPreviewCustomerIdAttachment:focus,
.btnPreviewCustomerIdAttachment:focus-visible,
.mogav-file-preview-btn:hover,
.mogav-file-preview-btn:focus,
.attachment-preview-ribbon:hover,
.attachment-preview-ribbon:focus {
  background: var(--haze-heading, #02335B) !important;
  color: #fff !important;
  box-shadow: 1px 1px 0 rgba(2, 35, 91, .18);
  outline: none;
}
.btnPreviewCustomerIdAttachment:hover::after,
.btnPreviewCustomerIdAttachment:focus::after,
.mogav-file-preview-btn:hover::after,
.mogav-file-preview-btn:focus::after,
.attachment-preview-ribbon:hover::after,
.attachment-preview-ribbon:focus::after {
  border-left-color: var(--haze-heading, #02335B);
}
.btnPreviewCustomerIdAttachment i,
.mogav-file-preview-btn i,
.attachment-preview-ribbon i {
  font-size: 11px;
  line-height: 1;
  color: inherit !important;
  opacity: .95;
}
.btnPreviewCustomerIdAttachment::after,
.mogav-file-preview-btn::after,
.attachment-preview-ribbon::after {
  content: "";
  position: absolute;
  top: 0;
  right: calc(-1 * var(--attachment-ribbon-tail));
  width: 0;
  height: 0;
  border-style: solid;
  border-width: calc(var(--attachment-ribbon-height) / 2) 0 calc(var(--attachment-ribbon-height) / 2) var(--attachment-ribbon-tail);
  border-color: transparent transparent transparent var(--attachment-ribbon-bg);
}
.btnPreviewCustomerIdAttachment::before,
.mogav-file-preview-btn::before,
.attachment-preview-ribbon::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 4px 4px 0;
  border-color: transparent rgba(0, 0, 0, .28) transparent transparent;
}
html.dark-theme .btnPreviewCustomerIdAttachment,
html.dark-theme .mogav-file-preview-btn,
html.dark-theme .attachment-preview-ribbon {
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .28);
}

/* Manage Privileges + User Privileges — keep switch + Granted/Revoked on one line */
:is(#privilegesTable, #userPrivilegePermissionsTable) .form-check.form-switch {
  padding-left: 0;
  min-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  margin: 0;
}
:is(#privilegesTable, #userPrivilegePermissionsTable) .form-check.form-switch .form-check-input {
  margin-left: 0;
  float: none;
  position: static;
  flex: 0 0 auto;
}
:is(#privilegesTable, #userPrivilegePermissionsTable) .form-check.form-switch :is(
  .lblPrivilegePermissionCaption,
  .lblUserPrivilegePermissionCaption,
  .lblUserPrivilegePermissionHeader,
  .form-check-label
) {
  margin: 0;
  padding: 0;
  white-space: nowrap;
  line-height: 1.2;
}

/* Privileges thead: keep column titles readable on ribbon in light + dark */
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body :is(#privilegesTable, #userPrivilegePermissionsTable) thead th,
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body :is(#privilegesTable, #userPrivilegePermissionsTable) thead th :is(
  .form-check-label,
  .lblPrivilegePermissionCaption,
  .lblUserPrivilegePermissionCaption,
  .lblUserPrivilegePermissionHeader,
  small,
  span,
  a,
  strong
) {
  color: var(--page-ribbon-fg, #fff) !important;
}
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body :is(#privilegesTable, #userPrivilegePermissionsTable) tbody td :is(
  .form-check-label,
  .lblPrivilegePermissionCaption,
  .lblUserPrivilegePermissionCaption,
  small
) {
  color: var(--haze-text) !important;
}

/* Privileges switches — theme-aware tracks that stay visible on ribbon + body */
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body :is(#privilegesTable, #userPrivilegePermissionsTable) .form-switch .form-check-input {
  width: 2.4em !important;
  height: 1.2em !important;
  margin-left: 0 !important;
  background-repeat: no-repeat;
  background-position: left center;
  background-size: contain;
  transition: background-position .15s ease-in-out, background-color .15s ease, border-color .15s ease;
}
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body :is(#privilegesTable, #userPrivilegePermissionsTable) .form-switch .form-check-input:focus {
  box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--haze-primary) 25%, transparent);
}

/* Body row switches */
html:is(.light-theme, .semi-dark, .minimal-theme) body :is(#privilegesTable, #userPrivilegePermissionsTable) tbody .form-switch .form-check-input:not(:checked) {
  background-color: var(--haze-surface) !important;
  border-color: var(--haze-border-strong) !important;
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba(2,51,91,.55)'/%3e%3c/svg%3e");
  background-image: var(--bs-form-switch-bg) !important;
}
html.dark-theme body :is(#privilegesTable, #userPrivilegePermissionsTable) tbody .form-switch .form-check-input:not(:checked) {
  background-color: var(--haze-surface-3) !important;
  border-color: var(--haze-border-strong) !important;
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba(242,246,250,.75)'/%3e%3c/svg%3e");
  background-image: var(--bs-form-switch-bg) !important;
}
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body :is(#privilegesTable, #userPrivilegePermissionsTable) tbody .form-switch .form-check-input:checked {
  background-color: var(--haze-primary) !important;
  border-color: var(--haze-primary) !important;
  background-position: right center;
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
  background-image: var(--bs-form-switch-bg) !important;
}

/* Header switches sit on the page ribbon — keep contrast in both themes */
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body :is(#privilegesTable, #userPrivilegePermissionsTable) thead .form-switch .form-check-input:not(:checked) {
  background-color: color-mix(in srgb, #fff 22%, transparent) !important;
  border-color: color-mix(in srgb, #fff 65%, transparent) !important;
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
  background-image: var(--bs-form-switch-bg) !important;
}
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body :is(#privilegesTable, #userPrivilegePermissionsTable) thead .form-switch .form-check-input:checked {
  background-color: #fff !important;
  border-color: #fff !important;
  background-position: right center;
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2302335B'/%3e%3c/svg%3e");
  background-image: var(--bs-form-switch-bg) !important;
}
html.dark-theme body :is(#privilegesTable, #userPrivilegePermissionsTable) thead .form-switch .form-check-input:checked {
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%230080FF'/%3e%3c/svg%3e");
  background-image: var(--bs-form-switch-bg) !important;
}
html:is(.light-theme, .dark-theme, .semi-dark, .minimal-theme) body :is(#privilegesTable, #userPrivilegePermissionsTable) thead .form-switch .form-check-input:focus {
  box-shadow: 0 0 0 .2rem color-mix(in srgb, #fff 35%, transparent);
}

/* Avatar upload forms — photo picker sits beside fields, no empty photo column */
.mogav-avatar-form__hero {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  width: 100%;
}
.mogav-avatar-form__hero-fields {
  flex: 1 1 auto;
  min-width: 0;
}
.mogav-avatar-form__hero-fields > .row {
  --bs-gutter-y: .75rem;
}
.mogav-avatar-field {
  flex: 0 0 auto;
  width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
}
.mogav-avatar-form__hero--lg {
  gap: 1.15rem;
}
.mogav-avatar-form__hero--lg .mogav-avatar-field {
  width: 210px;
}
.mogav-avatar-form__hero--lg .mogav-avatar-picker {
  width: 210px;
  height: 210px;
  border-radius: 16px;
}
.mogav-avatar-form__hero--lg .mogav-avatar-picker__caption {
  font-size: 12px;
  padding: .45rem .3rem .5rem;
}
.mogav-avatar-form__hero--lg .mogav-avatar-picker__caption i {
  font-size: 15px;
}
.mogav-avatar-form__hero--lg .mogav-avatar-picker__hint {
  font-size: 11px;
}
.mogav-avatar-form__hero--xl {
  gap: 1.35rem;
}
.mogav-avatar-form__hero--xl .mogav-avatar-field {
  width: 280px;
}
.mogav-avatar-form__hero--xl .mogav-avatar-picker {
  width: 280px;
  height: 280px;
  border-radius: 18px;
}
.mogav-avatar-form__hero--xl .mogav-avatar-picker__caption {
  font-size: 13px;
  padding: .5rem .35rem .55rem;
}
.mogav-avatar-form__hero--xl .mogav-avatar-picker__caption i {
  font-size: 17px;
}
.mogav-avatar-form__hero--xl .mogav-avatar-picker__hint {
  font-size: 12px;
}
.mogav-avatar-picker {
  position: relative;
  display: block;
  width: 160px;
  height: 160px;
  margin: 0;
  padding: 0;
  border: 2px solid var(--haze-border, #D5DEE8);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  background: var(--haze-surface-2, #F0F5FA) !important;
  box-shadow: none !important;
  line-height: 0;
  color: #fff;
}
.mogav-avatar-picker:hover,
.mogav-avatar-picker:focus-within {
  border-color: var(--haze-primary, #0080FF);
}
.mogav-avatar-picker.btn-primary {
  background: var(--haze-surface-2, #F0F5FA) !important;
  border-color: var(--haze-border, #D5DEE8) !important;
  color: #fff !important;
}
.mogav-avatar-picker.bg-success,
.mogav-avatar-picker.bg-success.text-white {
  background: var(--haze-surface-2, #F0F5FA) !important;
  border-color: #009966 !important;
  color: #fff !important;
}
.mogav-avatar-picker__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mogav-avatar-picker__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgb(2 51 91 / 78%) 0%, rgb(2 51 91 / 8%) 58%, transparent 100%);
  pointer-events: none;
}
.mogav-avatar-picker.bg-success .mogav-avatar-picker__shade {
  background: linear-gradient(to top, rgb(0 153 102 / 78%) 0%, rgb(0 153 102 / 10%) 58%, transparent 100%);
}
.mogav-avatar-picker__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: .4rem .3rem .45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  flex-wrap: wrap;
  color: #fff !important;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  pointer-events: none;
}
.mogav-avatar-picker__caption i {
  font-size: 14px;
}
.mogav-avatar-picker__caption small {
  font-size: 10px;
  color: inherit !important;
}
.mogav-avatar-picker__hint {
  display: block;
  width: 100%;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  color: var(--haze-muted, #6B7C8F);
}
html.dark-theme .mogav-avatar-picker,
html.dark-theme .mogav-avatar-picker.btn-primary {
  background: var(--haze-surface-3, #1e293b) !important;
  border-color: var(--haze-border, #334155) !important;
}
@media (max-width: 575.98px) {
  .mogav-avatar-form__hero {
    flex-direction: column;
    align-items: stretch;
  }
  .mogav-avatar-field {
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: .75rem;
  }
  .mogav-avatar-picker__hint {
    text-align: left;
    width: auto;
  }
}
