/* HAI Medical UI - global visual design system (UI only) */
:root {
  --hai-primary: #0f4c81;
  --hai-primary-strong: #0b3a63;
  --hai-secondary: #00a6c8;
  --hai-accent: #20c997;
  --hai-warning: #f59f00;
  --hai-danger: #dc3545;
  --hai-surface: #ffffff;
  --hai-surface-soft: #f4f9ff;
  --hai-border: #dce8f4;
  --hai-text: #1e2a3a;
  --hai-muted: #5f6e81;
  --hai-shadow-sm: 0 8px 18px rgba(15, 76, 129, 0.08);
  --hai-shadow-md: 0 16px 36px rgba(15, 76, 129, 0.12);
  --hai-radius-md: 12px;
  --hai-radius-lg: 16px;
}

html,
body {
  font-family: "Kanit", sans-serif;
  color: var(--hai-text);
}

body {
  background: linear-gradient(180deg, #f3f8ff 0%, #ffffff 240px);
}

.content-wrapper {
  background: transparent;
}

.content-header h1,
.content-header .h1 {
  font-weight: 600;
  color: var(--hai-primary-strong);
}

.card,
.small-box,
.info-box,
.modal-content {
  border-radius: var(--hai-radius-md);
  border: 1px solid var(--hai-border);
  box-shadow: var(--hai-shadow-sm);
}

.card {
  background: var(--hai-surface);
}

.card .card-header {
  background: linear-gradient(180deg, #ffffff 0%, #f9fcff 100%);
  border-bottom: 1px solid var(--hai-border);
  border-radius: var(--hai-radius-md) var(--hai-radius-md) 0 0;
}

.card-title {
  color: var(--hai-primary-strong);
  font-weight: 600;
}

.small-box {
  overflow: hidden;
  border: 0;
}

.small-box .inner h3 {
  font-weight: 700;
}

.small-box .icon {
  color: rgba(255, 255, 255, 0.95);
}

.small-box .icon > i {
  opacity: 0.55;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
}

.small-box.bg-info {
  background: linear-gradient(135deg, #0f4c81, #2b7dbf) !important;
}

.small-box.bg-success {
  background: linear-gradient(135deg, #14866f, #20c997) !important;
}

.small-box.bg-warning {
  background: linear-gradient(135deg, #b67800, #f59f00) !important;
  color: #fff !important;
}

.small-box.bg-danger {
  background: linear-gradient(135deg, #a9323d, #dc3545) !important;
}

.btn {
  border-radius: 10px;
  font-weight: 500;
}

.btn-primary {
  background: linear-gradient(135deg, var(--hai-primary), #2b7dbf);
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(15, 76, 129, 0.24);
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(135deg, var(--hai-primary-strong), #1f6aa7);
  border-color: transparent;
}

.btn-outline-primary {
  border-color: #6ca3d6;
  color: var(--hai-primary);
}

.form-control,
.custom-select,
.select2-container--default .select2-selection--single {
  border-radius: 10px;
  border-color: #c8d9ea;
  min-height: 42px;
  box-shadow: none;
}

.form-control:focus,
.custom-select:focus,
.select2-container--default.select2-container--focus .select2-selection--single {
  border-color: #5ea3e7;
  box-shadow: 0 0 0 0.2rem rgba(15, 76, 129, 0.14);
}

table.table thead th {
  background: #f0f7ff;
  border-bottom: 1px solid #d5e6f7;
  color: var(--hai-primary-strong);
  font-weight: 600;
}

table.table tbody tr:nth-child(even) {
  background: #fbfdff;
}

table.table-hover tbody tr:hover {
  background: #eef6ff;
}

.badge {
  border-radius: 999px;
  padding: 0.38rem 0.62rem;
  font-weight: 500;
}

.modal-header {
  border-bottom: 1px solid var(--hai-border);
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.modal-footer {
  border-top: 1px solid var(--hai-border);
}

.main-header.navbar {
  border-bottom: 1px solid #d9e7f4;
  box-shadow: 0 4px 12px rgba(15, 76, 129, 0.08);
  background: #ffffff !important;
}

.main-header .nav-link {
  color: #2f4b67 !important;
}

.main-sidebar {
  background: linear-gradient(180deg, #0f3f6a 0%, #0d2f50 100%) !important;
}

.main-sidebar .brand-link {
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
}

.main-sidebar .brand-text {
  color: #eff7ff !important;
  font-weight: 500 !important;
}

.main-sidebar .nav-header {
  color: rgba(217, 235, 252, 0.76) !important;
  letter-spacing: 0.3px;
}

.main-sidebar .nav-link {
  border-radius: 10px;
  margin: 2px 8px;
  color: rgba(236, 246, 255, 0.95) !important;
}

.main-sidebar .nav-link .nav-icon {
  color: #7fc8ff !important;
}

.main-sidebar .nav-link:hover {
  background: rgba(59, 155, 233, 0.2) !important;
}

.main-sidebar .nav-link.active {
  background: linear-gradient(135deg, rgba(46, 144, 227, 0.38), rgba(12, 104, 183, 0.42)) !important;
  box-shadow: inset 0 0 0 1px rgba(176, 220, 255, 0.35);
}

.main-sidebar .nav-treeview > .nav-item > .nav-link {
  display: flex;
  align-items: center;
  margin-left: 12px;
  margin-right: 6px;
  padding-top: 0.42rem;
  padding-bottom: 0.42rem;
  color: rgba(176, 208, 232, 0.78) !important;
  font-size: 0.84rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
}

.main-sidebar .nav-treeview > .nav-item > .nav-link .nav-icon,
.main-sidebar .nav-treeview > .nav-item > .nav-link .hai-submenu-icon {
  flex: 0 0 auto;
  color: rgba(146, 188, 220, 0.72) !important;
  font-size: 0.8rem !important;
  width: 1.5rem;
  margin-right: 0.35rem;
}

.main-sidebar .nav-treeview > .nav-item > .nav-link > p {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0 !important;
  display: block;
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.main-sidebar .nav-treeview > .nav-item > .nav-link:hover {
  color: #eaf5ff !important;
  background: rgba(59, 155, 233, 0.14) !important;
}

.main-sidebar .nav-treeview > .nav-item > .nav-link:hover .nav-icon,
.main-sidebar .nav-treeview > .nav-item > .nav-link:hover .hai-submenu-icon {
  color: #9fd4ff !important;
}

.main-sidebar .nav-treeview > .nav-item > .nav-link.active {
  color: #ffffff !important;
  background: rgba(46, 144, 227, 0.28) !important;
  box-shadow: inset 0 0 0 1px rgba(176, 220, 255, 0.22);
}

.main-sidebar .nav-treeview > .nav-item > .nav-link.active .nav-icon,
.main-sidebar .nav-treeview > .nav-item > .nav-link.active .hai-submenu-icon {
  color: #b8e0ff !important;
}

.main-footer {
  border-top: 1px solid #dce8f4;
  color: var(--hai-muted);
}

.hai-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .85rem 1rem;
  background: var(--hai-surface);
}

.hai-footer-notice {
  display: flex;
  flex: 1 1 auto;
  align-items: flex-start;
  gap: .75rem;
  min-width: 0;
}

.hai-footer-icon {
  display: inline-flex;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--hai-primary);
  background: #e8f1ff;
  border-radius: 50%;
}

.hai-footer-copy {
  max-width: 100%;
  margin: 0;
  color: var(--hai-text);
  font-size: .9rem;
  line-height: 1.55;
}

.hai-footer-owner {
  color: var(--hai-primary-strong);
  font-weight: 600;
}

.hai-footer-restriction {
  color: var(--hai-muted);
  font-weight: 500;
}

.hai-footer-version {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--hai-primary-strong);
  white-space: nowrap;
}

/* Assessment/checklist-friendly sections */
.form-section {
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: linear-gradient(180deg, #f8fbff 0%, #f4f9ff 100%);
  border: 1px solid #d8e8f8;
  border-radius: 12px;
}

.form-section-title {
  font-size: 1.08rem;
  font-weight: 600;
  color: #0f4c81;
  margin-bottom: 0.85rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid #cfe2f4;
}

.sub-section {
  margin-top: 0.75rem;
  padding: 0.85rem 0.95rem;
  background: #ffffff;
  border: 1px solid #dfeaf6;
  border-left: 4px solid #78b2e7;
  border-radius: 10px;
}

.sub-section-title {
  font-weight: 600;
  color: #2c4f71;
}

.note-box {
  background-color: #fff9e8;
  border-left: 4px solid #f5c259;
  border-radius: 8px;
}

/* List/report utility */
.card-tools .input-group-text {
  background: #f0f7ff;
  border-color: #cfe0f2;
  color: #36597a;
}

.pagination .page-link {
  border-radius: 8px;
  margin: 0 2px;
  border-color: #d2e2f3;
  color: #174c7f;
}

.pagination .page-item.active .page-link {
  background: linear-gradient(135deg, #0f4c81, #2b7dbf);
  border-color: transparent;
}

body.login-page {
  background:
    radial-gradient(circle at 20% 20%, rgba(0, 166, 200, 0.2), transparent 38%),
    radial-gradient(circle at 78% 14%, rgba(15, 76, 129, 0.23), transparent 42%),
    linear-gradient(160deg, #edf6ff 0%, #f8fcff 45%, #ffffff 100%);
}

.login-box .card {
  border-radius: var(--hai-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(7px);
  box-shadow: var(--hai-shadow-md);
}

.login-box .card-header {
  border-radius: var(--hai-radius-lg) var(--hai-radius-lg) 0 0;
}

.login-box .form-control {
  min-height: 48px;
}

.login-box .btn-primary {
  min-height: 46px;
}

.login-box .input-group-text {
  border-radius: 10px 0 0 10px;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid rgba(15, 76, 129, 0.32);
  outline-offset: 2px;
}

.assessment-progress-shell {
  position: sticky;
  top: 64px;
  z-index: 8;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--hai-surface);
  border: 1px solid var(--hai-border);
  border-radius: var(--hai-radius-md);
  box-shadow: var(--hai-shadow-sm);
}

.assessment-progress-heading,
.assessment-progress-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.assessment-progress-title {
  margin: 0;
  color: var(--hai-primary-strong);
  font-size: 1.08rem;
  font-weight: 600;
}

.assessment-progress-copy,
.assessment-progress-label {
  color: var(--hai-muted);
}

.assessment-progress-label {
  display: block;
  font-size: .875rem;
}

.assessment-progress-grid {
  justify-content: flex-start;
  margin-top: .75rem;
}

.assessment-progress-grid > div {
  min-width: 180px;
}

.assessment-progress-status {
  flex: 0 0 auto;
  padding: .38rem .7rem;
  border-radius: 999px;
  font-weight: 600;
}

.assessment-progress-status.is-incomplete,
.assessment-progress-status.is-error {
  color: #7b5000;
  background: #fff2cf;
}

.assessment-progress-status.is-ready {
  color: var(--hai-primary-strong);
  background: #e8f1ff;
}

.assessment-progress-status.is-complete,
.assessment-progress-status.is-saved {
  color: #0b6b50;
  background: #dff8ef;
}

.assessment-missing-summary {
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid var(--hai-border);
}

.assessment-missing-list {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .75rem;
  list-style: none;
  margin-top: .4rem;
  padding-left: 0;
}

.assessment-missing-list li {
  display: flex;
  align-items: center;
}

.assessment-missing-list button {
  padding: .1rem .15rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--hai-primary);
  line-height: 1.45;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.daily-action-queue {
  margin-bottom: 1.25rem;
  overflow: hidden;
  background: var(--hai-surface);
  border: 1px solid var(--hai-border);
  border-radius: var(--hai-radius-md);
  box-shadow: var(--hai-shadow-sm);
}

.daily-action-header,
.daily-action-row,
.daily-action-empty {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.daily-action-header {
  justify-content: space-between;
  padding: 1rem;
  background: var(--hai-surface-soft);
  border-bottom: 1px solid var(--hai-border);
}

.daily-action-header h2,
.surveillance-section-heading h2 {
  margin: 0;
  color: var(--hai-primary-strong);
  font-size: 1.2rem;
  font-weight: 600;
}

.daily-action-header p,
.surveillance-section-heading p {
  margin: .2rem 0 0;
  color: var(--hai-muted);
}

.daily-action-count {
  flex: 0 0 auto;
  padding: .4rem .7rem;
  color: var(--hai-primary-strong);
  background: #e8f1ff;
  border-radius: 999px;
  font-weight: 600;
}

.daily-action-row {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--hai-border);
}

.daily-action-row:last-child { border-bottom: 0; }

.daily-action-primary,
.daily-action-context {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.daily-action-primary { flex: 1 1 260px; }
.daily-action-context {
  flex: 1 1 240px;
  color: var(--hai-muted);
  font-size: .875rem;
}

.daily-action-empty {
  justify-content: center;
  min-height: 92px;
  padding: 1rem;
  color: var(--hai-muted);
}

.daily-action-empty > div {
  display: flex;
  flex-direction: column;
}

.surveillance-section-heading { margin: 1.5rem 0 .8rem; }

.surveillance-overview .small-box {
  color: var(--hai-text) !important;
  background: var(--hai-surface) !important;
  border: 1px solid var(--hai-border);
  border-top: 3px solid var(--hai-primary);
}

.surveillance-overview .small-box.bg-success { border-top-color: var(--hai-accent); }
.surveillance-overview .small-box.bg-warning { border-top-color: var(--hai-warning); }
.surveillance-overview .small-box.bg-danger { border-top-color: var(--hai-danger); }

.surveillance-overview .small-box .icon {
  color: var(--hai-primary);
  opacity: .16;
}

.report-filter-layout {
  display: grid;
  gap: 1rem;
}

.report-filter-primary,
.report-filter-advanced {
  padding: 1rem;
  background: var(--hai-surface-soft);
  border: 1px solid var(--hai-border);
  border-radius: var(--hai-radius-md);
}

.report-filter-advanced {
  background: var(--hai-surface);
}

.report-filter-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .75rem;
}

.report-filter-heading h2,
.report-filter-advanced h2 {
  margin: 0;
  color: var(--hai-primary-strong);
  font-size: 1.08rem;
  font-weight: 600;
}

.report-filter-heading p {
  margin: .2rem 0 0;
  color: var(--hai-muted);
}

.report-active-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .45rem;
  min-height: 32px;
  padding-top: .75rem;
  color: var(--hai-muted);
  border-top: 1px solid var(--hai-border);
}

.report-filter-chip {
  padding: .3rem .65rem;
  color: var(--hai-primary-strong);
  background: #e8f1ff;
  border: 1px solid #c8d9ea;
  border-radius: 999px;
  font: inherit;
}

.report-filter-chip:hover {
  background: #dcecff;
  border-color: #8fb5d8;
}

.report-filter-advanced[hidden] { display: none !important; }

.main-sidebar :where(a, button, [tabindex]):focus-visible {
  outline-color: #7fc8ff;
}

@media (forced-colors: active) {
  :where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }
}

@media (max-width: 991.98px) {
  .content-header {
    padding-bottom: 0.25rem;
  }

  .content-header .breadcrumb {
    float: none !important;
    margin-top: 0.5rem;
  }
}

@media (max-width: 767.98px) {
  .hai-footer {
    align-items: flex-start;
    padding: .8rem;
  }

  .hai-footer-notice {
    gap: .6rem;
  }

  .hai-footer-icon {
    flex-basis: 32px;
    width: 32px;
    height: 32px;
  }

  .hai-footer-copy {
    font-size: .85rem;
  }

  .main-header .navbar-nav .nav-item.d-none.d-md-flex {
    display: none !important;
  }

  .card,
  .small-box,
  .info-box {
    border-radius: 10px;
  }

  .btn {
    min-height: 40px;
  }

  .form-section {
    padding: 0.85rem;
  }

  .assessment-progress-shell {
    position: static;
    padding: .85rem;
  }

  .assessment-progress-heading,
  .assessment-progress-grid {
    align-items: flex-start;
    flex-direction: column;
  }

  .daily-action-header,
  .daily-action-row,
  .daily-action-empty {
    align-items: flex-start;
    flex-direction: column;
  }

  .daily-action-primary,
  .daily-action-context {
    flex-basis: auto;
    width: 100%;
  }

  .daily-action-row .btn,
  .daily-action-empty .btn {
    width: 100%;
    min-height: 44px;
  }

  .report-filter-heading {
    flex-direction: column;
  }

  .report-filter-heading .btn {
    width: 100%;
    min-height: 44px;
  }
}

.dashboard-chart-column {
  display: flex;
}

.dashboard-chart-column > .card {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.dashboard-chart-body {
  flex: 1;
  height: 220px;
  max-height: 220px;
  min-height: 220px;
  padding: 12px;
  position: relative;
}

.dashboard-pie-wrap {
  height: 100%;
  margin: 0 auto;
  max-width: 250px;
  width: 100%;
}

.dashboard-pathogens-body {
  overflow: hidden;
}

.dashboard-pathogens-chart {
  height: 100%;
}

.dashboard-pathogens-empty {
  align-items: center;
  color: var(--hai-muted);
  display: flex;
  gap: .625rem;
  justify-content: center;
  min-height: 100%;
  text-align: center;
}

.dashboard-pathogens-empty.is-error {
  color: var(--hai-danger);
}

@media (max-width: 575.98px) {
  .dashboard-chart-body {
    height: 250px;
    max-height: 250px;
    min-height: 250px;
  }
}

@media (min-width: 576px) and (max-width: 1199.98px) {
  .dashboard-chart-body {
    height: 240px;
    max-height: 240px;
    min-height: 240px;
  }
}
