/* Shared MK application UI: Thai-capable type and one navy/blue palette. */
:root {
  --mk-ui-font: Tahoma, "Leelawadee UI", "Segoe UI", sans-serif;
  --mk-ui-primary: #1b56b0;
  --mk-ui-primary-hover: #16458f;
  --mk-ui-navy: #0d2247;
  --mk-ui-accent: #2b75bd;
  --mk-ui-bg: #f4f7fb;
  --mk-ui-surface: #ffffff;
  --mk-ui-soft: #eaf0f7;
  --mk-ui-text: #263445;
  --mk-ui-muted: #68788c;
  --mk-ui-border: #d7e0eb;

  /* Aliases for the variable names used by legacy and refreshed pages. */
  --accent: #2b75bd !important;
  --accent-color: #2b75bd !important;
  --jsr-primary: #1b56b0 !important;
  --jsr-primary-2: #2b75bd !important;
  --jsr-accent: #2b75bd !important;
  --jsr-bg: #f4f7fb !important;
  --jsr-page-bg: #f4f7fb !important;
  --jsr-card: #ffffff !important;
  --jsr-text: #263445 !important;
  --jsr-muted: #68788c !important;
  --jsr-border: #d7e0eb !important;
  --jsr-sidebar: #0d2247 !important;
  --jsr-topbar: #0d2247 !important;
  --blue: #1b56b0 !important;
  --blue-lt: #2b75bd !important;
  --blue-xlt: #eaf0f7 !important;
  --blue-xxlt: #f4f7fb !important;
  --navy: #0d2247 !important;
  --navy-deep: #091a37 !important;
  --navy-mid: #173a65 !important;
  --primary: #1b56b0 !important;
  --primary-color: #1b56b0 !important;
  --primary-dark: #16458f !important;
  --primary-light: #eaf0f7 !important;
  --ui-primary: #1b56b0 !important;
  --ui-primary-dark: #16458f !important;
  --ui-primary-soft: #eaf0f7 !important;
  --rx-primary: #1b56b0 !important;
  --rx-primary-light: #2b75bd !important;
  --rx-primary-bg: #eaf0f7 !important;
  --tdsr-primary: #1b56b0 !important;
  --tdsr-primary-dark: #16458f !important;
  --tdsr-navy: #0d2247 !important;
  --tdsr-bg: #f4f7fb !important;
  --tdsr-card: #ffffff !important;
  --tdsr-text: #263445 !important;
  --tdsr-border: #d7e0eb !important;
  --cm-primary: #1b56b0 !important;
  --cm-accent: #2b75bd !important;
  --cm-bg: #f4f7fb !important;
  --cm-text: #263445 !important;
  --cm-muted: #68788c !important;
  --cm-border: #d7e0eb !important;
  --rv-primary: #1b56b0 !important;
  --rv-accent: #2b75bd !important;
  --rv-bg: #f4f7fb !important;
  --rv-surface: #ffffff !important;
  --rv-border: #d7e0eb !important;
  --rx-bg: #f4f7fb !important;
  --rx-bg-secondary: #edf2f8 !important;
  --rx-card: #ffffff !important;
  --rx-border: #d7e0eb !important;
  --rx-border-light: #e8edf4 !important;
  --rx-text: #263445 !important;
  --rx-text-light: #47596f !important;
  --rx-text-muted: #68788c !important;
  --bg: #f4f7fb !important;
  --background: #f4f7fb !important;
  --surface: #ffffff !important;
  --surface2: #f7f9fc !important;
  --surface3: #edf2f8 !important;
  --border: #d7e0eb !important;
  --border2: #c5d1df !important;
  --text: #263445 !important;
  --text2: #47596f !important;
  --text3: #68788c !important;
  --muted: #68788c !important;
  --brand1: #1b56b0 !important;
  --brand2: #2b75bd !important;
}

html body { background: var(--mk-ui-bg) !important; color: var(--mk-ui-text) !important; }
body, body *:not(.fa):not(.fas):not(.far):not(.fab):not([class*="fa-"]):not(.glyphicon):not([class^="ti-"]):not([class*=" ti-"]):not([class^="icon-"]):not([class*=" icon-"]):not(.fontastic-icon):not(.fontastic):not(.icon):not(.dashboard):not(.material-icons) {
  font-family: var(--mk-ui-font) !important;
}
body { font-size: 14px; line-height: 1.5; }
body a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link) { color: var(--mk-ui-primary) !important; }
body a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link):hover { color: var(--mk-ui-primary-hover) !important; }

/* One shared navigation tone. */
body .navbar, body .side-navbar, body .sidebar, body .sidebar-wrapper,
body .main-sidebar, body .left-sidebar, body .topbar, body .main-header,
body .navbar-header, body .sidebar-header {
  background: var(--mk-ui-navy) !important;
  border-color: var(--mk-ui-navy) !important;
}
body .navbar a, body .side-navbar a, body .sidebar a, body .sidebar-wrapper a,
body .main-sidebar a, body .left-sidebar a, body .topbar a, body .main-header a {
  color: #edf3fa !important;
}
body .side-navbar .active > a, body .sidebar .active > a,
body .sidebar .nav-link.active, body .navbar .nav-link.active {
  background-color: #173a65 !important;
  color: #ffffff !important;
}

/* Shared primary actions; keep success, warning and destructive actions distinct. */
body .btn-primary, body .btn-info, body .btn-outline-primary:hover,
body .btn-outline-info:hover, body .nav-pills .nav-link.active,
body .page-item.active .page-link, body .pagination .active a,
body .bg-primary, body .label-primary, body .badge-primary,
body .progress-bar:not(.bg-success):not(.bg-danger):not(.bg-warning) {
  background: var(--mk-ui-primary) !important;
  border-color: var(--mk-ui-primary) !important;
  color: #ffffff !important;
}
body .btn-primary:hover, body .btn-info:hover, body .btn-outline-primary:hover,
body .btn-outline-info:hover { background: var(--mk-ui-primary-hover) !important; border-color: var(--mk-ui-primary-hover) !important; }
body .btn:not(.btn-primary):not(.btn-info):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-secondary):not(.btn-light):not(.btn-dark):not(.btn-link):not(.btn-outline-primary):not(.btn-outline-info):not(.btn-outline-success):not(.btn-outline-danger):not(.btn-outline-warning):not(.btn-outline-secondary),
body button:not(.close):not(.btn-primary):not(.btn-info):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-secondary):not(.btn-light):not(.btn-dark):not(.btn-link):not(.btn-outline-primary):not(.btn-outline-info):not(.btn-outline-success):not(.btn-outline-danger):not(.btn-outline-warning):not(.btn-outline-secondary),
body input[type="submit"], body input[type="button"] {
  background: var(--mk-ui-primary) !important;
  border-color: var(--mk-ui-primary) !important;
  color: #ffffff !important;
}
body .btn-secondary, body .btn-default, body .btn-light, body .btn-outline-secondary {
  background: #edf2f7 !important; border-color: #cbd6e2 !important; color: #34465c !important;
}
body .btn-success, body .bg-success, body .badge-success, body .label-success { background: #238653 !important; border-color: #238653 !important; color: #ffffff !important; }
body .btn-danger, body .bg-danger, body .badge-danger, body .label-danger { background: #c2413a !important; border-color: #c2413a !important; color: #ffffff !important; }
body .btn-warning, body .bg-warning, body .badge-warning, body .label-warning { background: #b7791f !important; border-color: #b7791f !important; color: #ffffff !important; }
body .btn-outline-primary { color: var(--mk-ui-primary) !important; border-color: var(--mk-ui-primary) !important; background-color: transparent !important; }
body .btn-outline-primary:hover { color: #ffffff !important; }
body .text-primary { color: var(--mk-ui-primary) !important; }

/* Consistent page surfaces and table headers. */
body .card, body .panel, body .box, body .content-card, body .report-card,
body .modal-content { background-color: var(--mk-ui-surface) !important; border-color: var(--mk-ui-border) !important; }
body .card-header:not(.bg-primary):not(.bg-success):not(.bg-danger):not(.bg-warning),
body .panel-heading:not(.bg-primary):not(.bg-success):not(.bg-danger):not(.bg-warning),
body .box-header:not(.bg-primary):not(.bg-success):not(.bg-danger):not(.bg-warning) {
  background: var(--mk-ui-soft) !important; border-color: var(--mk-ui-border) !important; color: var(--mk-ui-navy) !important;
}
body .page-header, body .page-title, body .content-title { color: var(--mk-ui-navy) !important; }
body table:not(.table-dark), body .table:not(.table-dark) { border-color: var(--mk-ui-border) !important; }
body table:not(.table-dark) thead th, body .table:not(.table-dark) thead th {
  background: var(--mk-ui-navy) !important; border-color: var(--mk-ui-navy) !important; color: #ffffff !important;
}
body table:not(.table-dark) td, body .table:not(.table-dark) td { border-color: var(--mk-ui-border) !important; }
body .form-control, body input[type="text"], body input[type="email"],
body input[type="password"], body input[type="number"], body input[type="date"],
body input[type="search"], body select, body textarea {
  background: #ffffff !important; color: var(--mk-ui-text) !important; border-color: var(--mk-ui-border) !important; border-radius: 5px;
}
body .form-control:focus, body input:focus, body select:focus, body textarea:focus {
  border-color: var(--mk-ui-accent) !important; box-shadow: 0 0 0 3px rgba(27,86,176,.16) !important;
}
body .alert-success { background: #e8f5ee !important; border-color: #b7dfc8 !important; color: #17663b !important; }
body .alert-warning { background: #fff5df !important; border-color: #f1d28f !important; color: #805500 !important; }
body .alert-danger { background: #fff0ef !important; border-color: #edc0bc !important; color: #96332d !important; }
body .alert-info { background: #eaf3fb !important; border-color: #bfd4e9 !important; color: #245477 !important; }

/* Align page banners, tab states, and common dashboard tiles. */
body .page-head, body .dashboard-header, body .page-titlebar {
  background: var(--mk-ui-navy) !important;
  border-color: var(--mk-ui-navy) !important;
  color: #ffffff !important;
}
body .page-head h1, body .page-head h2, body .page-head h3,
body .dashboard-header h1, body .dashboard-header h2, body .dashboard-header h3,
body .page-titlebar h1, body .page-titlebar h2, body .page-titlebar h3 { color: #ffffff !important; }
body .section-title, body .section-heading {
  background: var(--mk-ui-soft) !important;
  border-color: var(--mk-ui-border) !important;
  color: var(--mk-ui-navy) !important;
}
body .nav-tabs .nav-link.active { color: var(--mk-ui-primary) !important; border-color: var(--mk-ui-border) var(--mk-ui-border) #ffffff !important; }
body .stat-card, body .kpi-card, body .metric-card, body .summary-card,
body .dashboard-card, body .info-box:not(.bg-success):not(.bg-danger):not(.bg-warning) {
  background: #ffffff !important;
  border-color: var(--mk-ui-border) !important;
  color: var(--mk-ui-text) !important;
}


/* High contrast navigation: dark chrome always uses readable light text. */
html body header.header nav.navbar {
  background: #0b1f40 !important;
  color: #ffffff !important;
  border-color: #173a65 !important;
}
html body header.header nav.navbar .navbar-brand,
html body header.header nav.navbar .navbar-brand *,
html body header.header nav.navbar .navbar-header > a,
html body header.header nav.navbar .nav-menu > li > a,
html body header.header nav.navbar .nav-menu > fieldset,
html body header.header nav.navbar .nav-menu > fieldset *,
html body header.header nav.navbar .navbar-text,
html body header.header nav.navbar .nav-link,
html body header.header nav.navbar .notification,
html body header.header nav.navbar .logout {
  color: #ffffff !important;
}
html body header.header nav.navbar .nav-menu > li > a:hover,
html body header.header nav.navbar .navbar-brand:hover {
  color: #d9eaff !important;
}
html body header.header nav.navbar .dropdown-menu {
  background: #ffffff !important;
  border-color: #d7e0eb !important;
}
html body header.header nav.navbar .dropdown-menu .dropdown-item,
html body header.header nav.navbar .dropdown-menu .dropdown-item * {
  color: #263445 !important;
}
html body header.header nav.navbar .dropdown-menu .dropdown-item:hover {
  background: #eaf0f7 !important;
  color: #0d2247 !important;
}

html body nav.side-navbar {
  background: #0d2247 !important;
  color: #d9e7f7 !important;
  border-color: #173a65 !important;
}
html body nav.side-navbar .sidebar-header .title h1,
html body nav.side-navbar .sidebar-header .title h2,
html body nav.side-navbar .sidebar-header .title h3,
html body nav.side-navbar .sidebar-header .title p,
html body nav.side-navbar span.heading {
  color: #d9e7f7 !important;
}
html body nav.side-navbar span.heading { color: #9fb7d4 !important; }
html body nav.side-navbar ul li a,
html body nav.side-navbar ul li li a,
html body nav.side-navbar ul li a:visited {
  background: transparent !important;
  color: #d9e7f7 !important;
  border-left-color: transparent !important;
}
html body nav.side-navbar ul li > a:hover,
html body nav.side-navbar ul li li > a:hover {
  background: #173a65 !important;
  color: #ffffff !important;
  border-left-color: #78b7ff !important;
}
html body nav.side-navbar ul li.active > a,
html body nav.side-navbar ul li li.active > a,
html body nav.side-navbar ul li.active > a:hover {
  background: #1b56b0 !important;
  color: #ffffff !important;
  border-left-color: #9bcaff !important;
}
html body nav.side-navbar ul li.active > a *,
html body nav.side-navbar ul li > a:hover * {
  color: #ffffff !important;
}
html body table.dataTable thead th:after,
html body table.dataTable thead th:before {
  color: rgba(255,255,255,.75) !important;
}


/* Dashboard sidebar contrast: make inactive labels readable at a glance. */
html body .page .page-content nav.side-navbar {
  background-color: #edf3fa !important;
  background-image: none !important;
  border-right: 1px solid #c8d5e5 !important;
  color: #142b4a !important;
}
html body .page .page-content nav.side-navbar .sidebar-header,
html body .page .page-content nav.side-navbar .sidebar-header .title,
html body .page .page-content nav.side-navbar .sidebar-header .title * {
  color: #142b4a !important;
}
html body .page .page-content nav.side-navbar span.heading {
  color: #506986 !important;
  font-weight: 700 !important;
}
html body .page .page-content nav.side-navbar ul li > a,
html body .page .page-content nav.side-navbar ul li ul li > a,
html body .page .page-content nav.side-navbar ul li > a:visited {
  color: #17365f !important;
  -webkit-text-fill-color: #17365f !important;
  font-weight: 500 !important;
  background-color: transparent !important;
  border-left-color: transparent !important;
}
html body .page .page-content nav.side-navbar ul li > a *,
html body .page .page-content nav.side-navbar ul li ul li > a * {
  color: #17365f !important;
  -webkit-text-fill-color: #17365f !important;
}
html body .page .page-content nav.side-navbar ul li > a:hover,
html body .page .page-content nav.side-navbar ul li ul li > a:hover {
  color: #102b50 !important;
  background-color: #d6e4f4 !important;
  border-left-color: #1b56b0 !important;
}
html body .page .page-content nav.side-navbar ul li.active > a,
html body .page .page-content nav.side-navbar ul li ul li.active > a,
html body .page .page-content nav.side-navbar ul li.active > a * {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  background-color: #1b56b0 !important;
  border-left-color: #78b7ff !important;
}


/* Light brand panel and expanded submenu backgrounds for reliable contrast. */
html body .page .page-content nav.side-navbar .sidebar-header {
  background-color: #e2ebf5 !important;
  background-image: none !important;
  border-bottom: 1px solid #c8d5e5 !important;
}
html body .page .page-content nav.side-navbar ul li > ul,
html body .page .page-content nav.side-navbar ul li > ul.collapse,
html body .page .page-content nav.side-navbar ul li > ul.list-unstyled {
  background-color: #e2ebf5 !important;
  background-image: none !important;
}
html body .page .page-content nav.side-navbar ul li ul li > a,
html body .page .page-content nav.side-navbar ul li ul li > a:visited {
  background-color: #e2ebf5 !important;
  color: #17365f !important;
  -webkit-text-fill-color: #17365f !important;
}
html body .page .page-content nav.side-navbar ul li ul li > a:hover {
  background-color: #cddcf0 !important;
  color: #102b50 !important;
  -webkit-text-fill-color: #102b50 !important;
}
html body .page .page-content nav.side-navbar ul li ul li.active > a,
html body .page .page-content nav.side-navbar ul li ul li.active > a * {
  background-color: #1b56b0 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}


/* Keep sidebar counters on the same line and readable against each badge color. */
html body nav.side-navbar ul li > a p.badge {
  display: inline-flex !important;
  float: none !important;
  position: relative !important;
  top: -1px;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  min-width: 16px;
  min-height: 16px;
  margin: 0 0 0 4px !important;
  padding: 2px 5px !important;
  border-radius: 4px;
  font-size: 9px !important;
  line-height: 1.1 !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
}
html body nav.side-navbar ul li > a p.badge-danger {
  background-color: #bd2638 !important; border-color: #bd2638 !important;
  color: #ffffff !important; -webkit-text-fill-color: #ffffff !important;
}
html body nav.side-navbar ul li > a p.badge-warning {
  background-color: #9a5b00 !important; border-color: #9a5b00 !important;
  color: #ffffff !important; -webkit-text-fill-color: #ffffff !important;
}
html body nav.side-navbar ul li > a p.badge-success {
  background-color: #176b3c !important; border-color: #176b3c !important;
  color: #ffffff !important; -webkit-text-fill-color: #ffffff !important;
}
html body nav.side-navbar ul li > a p.badge-primary,
html body nav.side-navbar ul li > a p.badge-info {
  background-color: #1b56b0 !important; border-color: #1b56b0 !important;
  color: #ffffff !important; -webkit-text-fill-color: #ffffff !important;
}

/* Let wide report tables scroll inside the content instead of stretching the page. */
html body .page-content { min-width: 0; max-width: 100vw; overflow-x: hidden; }
html body .page-content > .content-inner,
html body .page-content > .content-inner.active {
  flex: 1 1 0% !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-x: hidden;
}
html body .content-inner .container-fluid { min-width: 0; max-width: 100%; }
html body .tdsr-main-container { min-width: 0; max-width: 100%; }
html body .tdsr-table-wrapper {
  width: 100%; max-width: 100%; min-width: 0;
  overflow-x: auto !important; overflow-y: visible;
  overscroll-behavior-x: contain;
}
html body .tdsr-table {
  width: max-content !important;
  min-width: 100% !important;
  table-layout: auto;
}
html body .tdsr-table thead th {
  background: #0d2247 !important; color: #ffffff !important;
  border-color: #0d2247 !important; font-weight: 700 !important;
}
html body .tdsr-table tbody td { color: #263445 !important; }
html body .tdsr-table tbody tr:nth-child(even) td { background-color: #f4f7fb; }
html body .tdsr-table tbody td.tdsr-name-cell {
  background-color: #eaf0f7 !important; color: #142b4a !important; font-weight: 700 !important;
}
html body .tdsr-header { color: #0d2247 !important; font-weight: 700 !important; }
html body .tdsr-main-container .text-muted,
html body .tdsr-main-container .monitor-audit-note,
html body .tdsr-main-container .ci-legend { color: #4a5d73 !important; }
html body .tdsr-number-btn:hover { transform: none !important; }
