/* EMIES Theme — Teal Safety CYP style | ทอง | ขาว
   โหลดท้ายสุด override main.css + Bootstrap */

:root {
  --emies-dark: #0a3d53;
  --emies-maroon: #0b4f6c;
  --emies-primary: #0b4f6c;
  --emies-primary-2: #01baef;
  --emies-gold: #f7b32b;
  --emies-black: #1b2838;
  --emies-white: #ffffff;
  --emies-border: #d9e3ec;
  --emies-muted: #5c6b7a;

  /* sync Eterna CSS variables */
  --accent-color: #f7b32b;
  --nav-hover-color: #0b4f6c;
  --nav-dropdown-hover-color: #f7b32b;
  --bs-warning: #f7b32b;
  --bs-warning-rgb: 247, 179, 43;
  --bs-primary: #0b4f6c;
  --bs-primary-rgb: 11, 79, 108;
}

/* ===== แก้ scroll แนวนอนเท่านั้น — ไม่แตะ container/grid ===== */
html,
body.index-page {
  overflow-x: hidden;
}

.hero .carousel-inner {
  overflow: hidden;
}

body.index-page .dataTables_wrapper,
body.index-page .table-responsive,
.dataTables_wrapper,
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.dataTables_wrapper {
  width: 100%;
}

.dataTables_wrapper .dataTables_scrollHead,
.dataTables_wrapper .dataTables_scrollBody,
.dataTables_wrapper table.dataTable {
  width: 100% !important;
}

body.index-page div.dt-buttons,
div.dt-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* ===== Tailwind custom color utilities ===== */
.bg-emies-dark { background-color: var(--emies-dark) !important; }
.bg-emies-maroon { background-color: var(--emies-maroon) !important; }
.bg-emies-gold { background-color: var(--emies-gold) !important; }
.text-emies-dark { color: var(--emies-dark) !important; }
.text-emies-maroon { color: var(--emies-maroon) !important; }
.text-emies-gold { color: var(--emies-gold) !important; }
.border-emies-gold { border-color: var(--emies-gold) !important; }

/* ===== Top bar (teal เข้ม + เส้นทอง) ===== */
.dark-background,
.topbar {
  --background-color: var(--emies-dark);
  --default-color: var(--emies-white);
  --heading-color: var(--emies-white);
  --surface-color: var(--emies-dark);
  background-color: var(--emies-dark) !important;
}

.topbar {
  border-bottom: 3px solid var(--emies-gold);
}

.topbar .contact-info i {
  color: var(--emies-gold) !important;
}

.topbar .contact-info a,
.topbar .contact-info span {
  color: var(--emies-white) !important;
}

.topbar a:hover {
  color: var(--emies-gold) !important;
}

.topbar .social-links a {
  color: rgba(255, 255, 255, 0.75) !important;
}

.topbar .social-links a:hover {
  color: var(--emies-gold) !important;
}

/* ===== Navbar / Logo (teal หลัก) ===== */
.header .branding {
  background: var(--emies-white);
}

.logo h1 {
  color: var(--emies-primary) !important;
}

/* Top menu — active = สีหลัก, hover = ทอง */
.navmenu a,
.navmenu a:focus {
  color: var(--emies-primary);
}

.navmenu .active,
.navmenu .active:focus {
  color: var(--emies-primary) !important;
  font-weight: 600;
}

.navmenu li:hover > a,
.navmenu a:hover,
.navmenu a:focus:hover {
  color: var(--emies-gold) !important;
}

.navmenu .dropdown ul a {
  color: var(--emies-primary);
}

.navmenu .dropdown ul a:hover,
.navmenu .dropdown ul li:hover > a {
  color: var(--emies-gold) !important;
}

/* Top menu — ปุ่มเมนูหลัก (หน้าแรก / สรุปการประเมิน / เข้าระบบ) */
.navmenu > ul {
  align-items: center;
  gap: 0.45rem;
}

.navmenu a.nav-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 1.25rem !important;
  border-radius: 999px !important;
  font-weight: 600 !important;
  font-size: 0.9rem;
  line-height: 1;
  border: 2px solid transparent;
  box-sizing: border-box;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.navmenu a.nav-btn-home {
  background: transparent;
  border-color: var(--emies-primary);
  color: var(--emies-primary) !important;
}

.navmenu a.nav-btn-home.active {
  background: var(--emies-primary);
  border-color: var(--emies-primary);
  color: var(--emies-white) !important;
}

.navmenu li:hover > a.nav-btn-home:not(.active),
.navmenu a.nav-btn-home:hover:not(.active) {
  background: rgba(11, 79, 108, 0.08) !important;
  border-color: var(--emies-primary) !important;
  color: var(--emies-primary) !important;
}

.navmenu li:hover > a.nav-btn-home.active,
.navmenu a.nav-btn-home.active:hover {
  background: var(--emies-gold) !important;
  border-color: var(--emies-gold) !important;
  color: var(--emies-black) !important;
}

.navmenu a.nav-btn-login,
.navmenu a.nav-btn-user {
  background: var(--emies-gold) !important;
  border-color: var(--emies-gold) !important;
  color: var(--emies-black) !important;
  box-shadow: 0 4px 14px rgba(247, 179, 43, 0.32);
}

.navmenu li:hover > a.nav-btn-login,
.navmenu a.nav-btn-login:hover {
  background: #ffc94a !important;
  border-color: #ffc94a !important;
  color: var(--emies-black) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(247, 179, 43, 0.42);
}

.navmenu .dropdown.nav-user-dropdown:hover > a.nav-btn-user,
.navmenu a.nav-btn-user:hover {
  background: #ffc94a !important;
  border-color: #ffc94a !important;
  color: var(--emies-primary) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(247, 179, 43, 0.42);
}

/* User dropdown — ปุ่ม navbar สีทอง (เหมือนเข้าระบบ) + dropdown ขาว */
.navmenu a.nav-btn-user {
  gap: 0.45rem;
  padding: 0 0.9rem 0 0.35rem !important;
  justify-content: flex-start;
  color: var(--emies-primary) !important;
}

.nav-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--emies-primary);
  flex-shrink: 0;
}

.nav-user-name {
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--emies-primary) !important;
}

.navmenu .dropdown.nav-user-dropdown > a .toggle-dropdown {
  font-size: 0.75rem;
  margin-left: 0.15rem;
  color: var(--emies-primary) !important;
}

.navmenu .dropdown.nav-user-dropdown {
  position: relative;
}

.navmenu .dropdown.nav-user-dropdown ul {
  left: 0 !important;
  right: auto !important;
  min-width: 240px;
  padding-top: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--emies-white) !important;
  border: 1px solid var(--emies-border);
  box-shadow: 0 10px 30px rgba(11, 79, 108, 0.15);
}

.navmenu .dropdown.nav-user-dropdown ul li {
  min-width: 0;
  width: 100%;
  text-align: left;
}

.navmenu .dropdown.nav-user-dropdown ul a {
  justify-content: flex-start;
  text-align: left;
  width: 100%;
  white-space: nowrap;
  color: var(--emies-primary) !important;
  font-weight: 500;
}

.navmenu .dropdown.nav-user-dropdown ul a i {
  color: var(--emies-primary) !important;
}

.navmenu .dropdown.nav-user-dropdown ul a:hover,
.navmenu .dropdown.nav-user-dropdown ul li:hover > a {
  background: rgba(11, 79, 108, 0.06) !important;
  color: var(--emies-gold) !important;
}

.navmenu .dropdown.nav-user-dropdown ul a:hover i,
.navmenu .dropdown.nav-user-dropdown ul li:hover > a i {
  color: var(--emies-gold) !important;
}

.navmenu .dropdown.nav-user-dropdown ul .nav-user-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 1rem 1rem 0.75rem;
  background: linear-gradient(135deg, rgba(10, 61, 83, 0.06), rgba(11, 79, 108, 0.03));
  border-bottom: 1px solid var(--emies-border);
  pointer-events: none;
}

.nav-user-avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--emies-primary);
}

.navmenu .dropdown.nav-user-dropdown ul .nav-user-card strong {
  color: var(--emies-primary);
  font-size: 0.95rem;
}

.navmenu .dropdown ul a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.navmenu .dropdown ul a i {
  font-size: 1rem;
  width: 1.15rem;
  text-align: center;
  color: var(--emies-primary);
  flex-shrink: 0;
}

.navmenu .dropdown:not(.nav-user-dropdown) ul a:hover i,
.navmenu .dropdown:not(.nav-user-dropdown) ul li:hover > a i {
  color: var(--emies-gold);
}

@media (min-width: 1200px) {
  .navmenu .dropdown.nav-user-dropdown ul .nav-user-card {
    display: none;
  }
}

@media (max-width: 1199px) {
  .navmenu .dropdown.nav-user-dropdown > a.nav-btn-user .nav-user-avatar {
    display: none;
  }

  .navmenu .dropdown.nav-user-dropdown > a.nav-btn-user {
    padding: 0 1.25rem !important;
    border-radius: 10px;
    width: 100%;
    justify-content: space-between;
  }
}

@media (min-width: 1200px) {
  .navmenu a,
  .navmenu a:focus {
    color: var(--emies-primary);
  }

  .navmenu .active,
  .navmenu .active:focus {
    color: var(--emies-primary) !important;
  }

  .navmenu li:hover > a {
    color: var(--emies-gold) !important;
  }

  .navmenu .dropdown ul a:hover,
  .navmenu .dropdown ul li:hover > a {
    color: var(--emies-gold) !important;
  }
}

/* ===== Hero — แก้ช่องว่างขาว ===== */
.hero .carousel {
  min-height: 70vh;
}

.hero .carousel-inner {
  min-height: 70vh;
  position: relative;
  overflow: hidden;
}

.hero .carousel-item {
  min-height: 70vh;
}

/* Hero — overlay ไล่สีซ้าย→ขวา: เข้ม ~70% แล้วค่อยจาง + ทองมุมล่างขวา */
.hero .carousel-item::before,
.hero .carousel-item:before {
  background:
    radial-gradient(circle at 94% 92%, rgba(247, 179, 43, 0.38), transparent 42%),
    radial-gradient(circle at 16% 24%, rgba(1, 186, 239, 0.18), transparent 40%),
    linear-gradient(
      to right,
      rgba(10, 61, 83, 0.95) 0%,
      rgba(10, 61, 83, 0.93) 70%,
      rgba(11, 79, 108, 0.62) 82%,
      rgba(11, 79, 108, 0.22) 92%,
      rgba(11, 79, 108, 0.08) 100%
    ) !important;
  z-index: 2;
}

.hero .carousel-inner::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -12%;
  width: min(36vw, 340px);
  height: min(36vw, 340px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(247, 179, 43, 0.32), rgba(247, 179, 43, 0.08) 45%, transparent 68%);
  pointer-events: none;
  z-index: 2;
  animation: heroGlowFloat 8s ease-in-out infinite;
}

@keyframes heroGlowFloat {
  0%, 100% { transform: translate(0, 0); opacity: 0.82; }
  50% { transform: translate(-2%, -2.5%); opacity: 1; }
}

.hero .carousel-item img {
  object-fit: cover;
  background-color: var(--emies-dark);
  filter: brightness(0.75) saturate(0.9);
}

.hero .carousel-item h2,
.hero .carousel-item p {
  color: var(--emies-white) !important;
}

/* ปุ่มเลื่อนซ้าย/ขวา hero */
.hero .carousel-control-prev,
.hero .carousel-control-next {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  top: 42%;
  opacity: 1;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  backdrop-filter: blur(8px);
  z-index: 10;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.hero .carousel-control-prev {
  left: 20px;
}

.hero .carousel-control-next {
  right: 20px;
}

.hero .carousel-control-prev:hover,
.hero .carousel-control-next:hover {
  background: var(--emies-gold);
  border-color: var(--emies-gold);
  opacity: 1;
}

.hero .carousel-control-prev-icon,
.hero .carousel-control-next-icon {
  background-image: none !important;
  width: auto;
  height: auto;
  font-size: 28px;
  line-height: 1;
  color: var(--emies-white);
  filter: none;
}

.hero .carousel-control-prev-icon::before {
  content: "\2039";
  font-weight: 700;
}

.hero .carousel-control-next-icon::before {
  content: "\203A";
  font-weight: 700;
}

.hero .carousel-control-prev:hover .carousel-control-prev-icon,
.hero .carousel-control-next:hover .carousel-control-next-icon {
  color: var(--emies-black);
}

/* Featured cards — เลื่อนขึ้นทับขอบล่าง hero เล็กน้อย (ไม่ทับข้อความ) */
.hero {
  overflow: visible;
  padding-bottom: 0;
}

.hero .carousel-container {
  inset: 72px 48px 48px 48px !important;
  text-align: center;
}

.hero .featured {
  margin-top: -2.5rem !important;
  padding-top: 0;
  padding-bottom: 2rem;
  position: relative;
  z-index: 5;
}

.hero .featured .row {
  --bs-gutter-x: 1rem;
}

@media (min-width: 992px) {
  .hero .carousel-container {
    inset: 90px 64px 56px 64px !important;
  }

  .hero .featured {
    margin-top: -3.5rem !important;
  }
}

@media (min-width: 1200px) {
  .hero .featured {
    margin-top: -4rem !important;
  }
}

.hero .carousel-item h2 span {
  color: var(--emies-gold) !important;
}

.hero .btn-get-started {
  background: var(--emies-black) !important;
  border: 2px solid var(--emies-black) !important;
  color: var(--emies-white) !important;
}

.hero .btn-get-started:hover {
  background: var(--emies-gold) !important;
  border-color: var(--emies-gold) !important;
  color: var(--emies-black) !important;
}

/* Featured cards — override main.css พื้นขาว */
.hero .featured-item.bg-danger {
  background-color: #dc3545 !important;
}

.hero .featured-item.bg-warning {
  background-color: var(--emies-gold) !important;
}

.hero .featured-item.bg-success {
  background-color: #28a745 !important;
}

.hero .featured-item.bg-primary {
  background-color: #0d6efd !important;
}

.hero .featured-item.bg-danger h4 a,
.hero .featured-item.bg-danger p,
.hero .featured-item.bg-danger .icon i,
.hero .featured-item.bg-success h4 a,
.hero .featured-item.bg-success p,
.hero .featured-item.bg-success .icon i,
.hero .featured-item.bg-primary h4 a,
.hero .featured-item.bg-primary p,
.hero .featured-item.bg-primary .icon i {
  color: var(--emies-white) !important;
}

.hero .featured-item.bg-warning h4 a,
.hero .featured-item.bg-warning p,
.hero .featured-item.bg-warning .icon i {
  color: var(--emies-black) !important;
}

/* hover ยังคงสีเดิม */
.hero .featured-item.bg-danger:hover h4 a,
.hero .featured-item.bg-danger:hover p,
.hero .featured-item.bg-danger:hover .icon i,
.hero .featured-item.bg-success:hover h4 a,
.hero .featured-item.bg-success:hover p,
.hero .featured-item.bg-success:hover .icon i,
.hero .featured-item.bg-primary:hover h4 a,
.hero .featured-item.bg-primary:hover p,
.hero .featured-item.bg-primary:hover .icon i {
  color: var(--emies-white) !important;
}

.hero .featured-item.bg-warning:hover h4 a,
.hero .featured-item.bg-warning:hover p,
.hero .featured-item.bg-warning:hover .icon i {
  color: var(--emies-black) !important;
}

.hero .featured-item:hover:before {
  background: rgba(0, 0, 0, 0.12) !important;
}

/* Featured cards — มุมโค้ง + shadow แบบ dms_v2 */
.hero .featured-item {
  border-radius: 15px !important;
  overflow: hidden;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
  padding: 22px 14px 20px !important;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hero .featured-item p {
  width: 100%;
  max-width: none;
  font-size: 15px;
  line-height: 1.5;
}

.hero .featured-item p .featured-lead {
  display: inline-block;
  white-space: nowrap;
}

.hero .featured-item p .featured-lead-wide {
  white-space: normal;
}

.hero .featured-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.hero .featured-item:before {
  border-radius: 15px;
}

/* ===== Small box — มุมโค้ง แบบ dms_v2 ===== */
.small-box {
  border-radius: 15px !important;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: block;
}

.small-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.small-box .inner {
  padding: 30px 20px;
}

/* ตัวหนังสือใน small-box: ขาว — ยกเว้น warning = ดำ */
.small-box.bg-danger .inner,
.small-box.bg-danger .inner h3,
.small-box.bg-danger .inner p,
.small-box.bg-success .inner,
.small-box.bg-success .inner h3,
.small-box.bg-success .inner p,
.small-box.bg-primary .inner,
.small-box.bg-primary .inner h3,
.small-box.bg-primary .inner p {
  color: var(--emies-white) !important;
}

.small-box.bg-danger .icon,
.small-box.bg-danger .icon i,
.small-box.bg-success .icon,
.small-box.bg-success .icon i,
.small-box.bg-primary .icon,
.small-box.bg-primary .icon i {
  color: var(--emies-white) !important;
}

.small-box.bg-danger .small-box-footer,
.small-box.bg-success .small-box-footer,
.small-box.bg-primary .small-box-footer {
  color: var(--emies-white) !important;
}

.small-box.bg-danger .inner sup,
.small-box.bg-success .inner sup,
.small-box.bg-primary .inner sup {
  color: var(--emies-white) !important;
}

.badge.bg-danger,
.badge.bg-success,
.badge.bg-primary {
  color: var(--emies-white) !important;
}

.small-box-footer {
  border-radius: 0 0 15px 15px;
}

/* ===== Cards / Widget — มุมโค้ง แบบ dms_v2 ===== */
.card,
.card-widget {
  border-radius: 15px !important;
  border: none !important;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.card-header {
  border-radius: 15px 15px 0 0 !important;
  border-bottom: none;
}

.card-widget .widget-user-header {
  border-radius: 15px 15px 0 0;
}

.card-footer {
  border-radius: 0 0 15px 15px;
}

/* ===== Tailwind-like utilities (ใช้ร่วมกับ class ใน HTML) ===== */
.rounded-xl { border-radius: 15px !important; }
.rounded-2xl { border-radius: 1rem !important; }
.rounded-3xl { border-radius: 1.5rem !important; }
.shadow-soft { box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1) !important; }
.shadow-soft-lg { box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15) !important; }

/* ===== Frontend content links — primary default, gold hover ===== */
/* ใช้เฉพาะ #main, page-title, section.content (ไม่รวม topbar/navbar/footer/hero) */
#main a:not(.btn):not([class*="btn-"]):not(.small-box-footer):not(.paginate_button):not(.page-link),
.page-title a:not(.btn):not([class*="btn-"]),
section.content a:not(.btn):not([class*="btn-"]):not(.paginate_button):not(.page-link) {
  color: var(--emies-primary);
  text-decoration: none;
  transition: color 0.25s ease;
}

#main a:not(.btn):not([class*="btn-"]):not(.small-box-footer):not(.paginate_button):not(.page-link):hover,
#main a:not(.btn):not([class*="btn-"]):not(.small-box-footer):not(.paginate_button):not(.page-link):focus-visible,
.page-title a:not(.btn):not([class*="btn-"]):hover,
.page-title a:not(.btn):not([class*="btn-"]):focus-visible,
section.content a:not(.btn):not([class*="btn-"]):not(.paginate_button):not(.page-link):hover,
section.content a:not(.btn):not([class*="btn-"]):not(.paginate_button):not(.page-link):focus-visible {
  color: var(--emies-gold);
  text-decoration: none;
}

/* ===== Section header ===== */
.section-header h3 {
  color: var(--emies-maroon);
}

/* ===== Small box ===== */
.small-box.bg-warning {
  background-color: var(--emies-gold) !important;
}

.small-box.bg-warning .inner,
.small-box.bg-warning .inner h3,
.small-box.bg-warning .inner p {
  color: var(--emies-black) !important;
}

.small-box.bg-warning .icon {
  color: var(--emies-black) !important;
}

.bg-warning,
.badge.bg-warning {
  background-color: var(--emies-gold) !important;
  border-color: var(--emies-gold) !important;
  color: var(--emies-black) !important;
}

.text-warning {
  color: var(--emies-gold) !important;
}

/* ===== Widget cards — ตัวหนังสือ header สีขาว ===== */
.widget-user-header,
.widget-user-header .widget-user-username,
.widget-user-header .widget-user-desc {
  color: var(--emies-white) !important;
}

.widget-user-header.bg-info {
  background-color: var(--emies-maroon) !important;
}

.widget-user-header.bg-primary {
  background-color: #0d6efd !important;
}

/* ===== Footer (teal เข้ม + ทอง) ===== */
#footer.footer.dark-background,
.footer.dark-background {
  background-color: var(--emies-dark) !important;
  color: var(--emies-white);
}

.footer.dark-background .sitename h4,
.footer.dark-background .footer-about h4,
.footer.dark-background .credits a {
  color: var(--emies-gold) !important;
}

.footer.dark-background h4 {
  color: var(--emies-white);
}

.footer-about .sitename h4,
.footer-top .col-lg-4 > h4 {
  position: relative;
  display: inline-block;
  padding-bottom: 0.65rem;
  margin-bottom: 0.85rem;
}

.footer-about .sitename h4::after,
.footer-top .col-lg-4 > h4::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: var(--emies-gold);
  border-radius: 2px;
}

.footer-about .sitename h4::after {
  max-width: 80px;
}

.footer.dark-background .social-links a:hover {
  color: var(--emies-gold) !important;
  border-color: var(--emies-gold) !important;
}

.footer .copyright {
  border-top: 2px solid var(--emies-gold);
  padding-top: 20px;
}

/* Scroll to top */
.scroll-top {
  background: var(--emies-gold) !important;
  color: var(--emies-black) !important;
}

.scroll-top:hover {
  background: var(--emies-maroon) !important;
  color: var(--emies-white) !important;
}

/* ===== Table header ===== */
.table thead {
  background-color: var(--emies-maroon);
  color: var(--emies-white);
}

.table thead th {
  border: none;
}

/* ===== Map + Select2 (school search) ===== */
.section-map .card-body {
  padding: 24px !important;
}

.map-toolbar {
  margin-bottom: 16px;
}

.map-search-label,
.map-legend-label {
  display: block;
  font-weight: 600;
  color: var(--emies-maroon);
  margin-bottom: 8px;
}

.map-legend .badge {
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
}

.map-legend .badge img {
  vertical-align: middle;
}

/* Select2 — มุมโค้ง + border แบบ dms_v2 */
.section-map .map-toolbar .select2-container {
  width: 100% !important;
  margin-bottom: 0;
}

.section-map .select2-container--default .select2-selection--single {
  border: 2px solid #e0e0e0 !important;
  border-radius: 8px !important;
  min-height: 44px;
  padding: 6px 12px;
  background: var(--emies-white);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.section-map .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 28px;
  color: #333;
  padding-left: 0;
}

.section-map .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 42px;
  right: 8px;
}

.section-map .select2-container--default.select2-container--open .select2-selection--single,
.section-map .select2-container--default.select2-container--focus .select2-selection--single {
  border-color: var(--emies-primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(11, 79, 108, 0.15);
}

.select2-dropdown {
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background-color: var(--emies-primary);
  color: var(--emies-white);
}

/* ===== DataTables (frontend) — Safety CYP teal theme ===== */
#main .dataTables_wrapper,
.dataTables_wrapper {
  color: var(--emies-black);
}

#main table.dataTable thead th,
#main table.dataTable thead td,
table.dataTable thead th,
table.dataTable thead td,
.table thead th {
  background: linear-gradient(135deg, var(--emies-dark), var(--emies-primary)) !important;
  color: var(--emies-white) !important;
  border: none !important;
  font-weight: 600;
  vertical-align: middle;
}

#main table.dataTable tbody tr:hover,
table.dataTable.display tbody tr:hover,
table.dataTable.stripe tbody tr.odd:hover,
table.dataTable.stripe tbody tr.even:hover {
  background-color: rgba(11, 79, 108, 0.06) !important;
}

#main table.dataTable tbody td,
table.dataTable tbody td {
  border-color: var(--emies-border);
  vertical-align: middle;
}

table.table-align-left thead th,
table.table-align-left tbody td,
table.table-align-left.dataTable thead th,
table.table-align-left.dataTable tbody td,
table.table-align-left.dataTable th.dt-center,
table.table-align-left.dataTable td.dt-center {
  text-align: left !important;
  vertical-align: top;
}

table.table-align-left thead th:first-child,
table.table-align-left tbody td:first-child {
  text-align: center !important;
  vertical-align: middle;
}

.signature-tabs {
  gap: 0.5rem;
  border-bottom: 1px solid var(--emies-border);
  padding-bottom: 0.75rem;
}

.signature-tabs .nav-link {
  color: var(--emies-primary);
  background: rgba(11, 79, 108, 0.06);
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  padding: 0.55rem 1rem;
}

.signature-tabs .nav-link:hover {
  color: var(--emies-dark);
  background: rgba(11, 79, 108, 0.12);
}

.signature-tabs .nav-link.active {
  color: var(--emies-white);
  background: linear-gradient(135deg, var(--emies-dark), var(--emies-primary));
  border-color: var(--emies-primary);
}

.signature-tab-badge {
  margin-left: 0.35rem;
  background: rgba(255, 255, 255, 0.22);
  color: inherit;
  font-weight: 600;
}

.signature-tabs .nav-link:not(.active) .signature-tab-badge {
  background: var(--emies-gold);
  color: var(--emies-dark);
}

.signature-detail .js-best-modal,
.js-best-modal:not(.btn) {
  color: var(--emies-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.js-best-modal:not(.btn):hover {
  color: var(--emies-dark);
}

.signature-level-badges a.badge {
  margin-left: 0.2rem;
  color: #fff !important;
}

.widget-user-2 .nav-link > a {
  color: inherit;
  font-weight: 600;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--emies-border);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  color: var(--emies-black);
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
  border-color: var(--emies-primary);
  box-shadow: 0 0 0 0.2rem rgba(11, 79, 108, 0.12);
  outline: none;
}

.dataTables_wrapper .dataTables_info {
  color: var(--emies-muted);
  padding-top: 0.75rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 8px !important;
  border: 1px solid var(--emies-border) !important;
  color: var(--emies-primary) !important;
  margin-left: 0.2rem;
  padding: 0.35rem 0.75rem !important;
  background: var(--emies-white) !important;
  background-image: none !important;
  box-shadow: none !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: rgba(11, 79, 108, 0.08) !important;
  background-image: none !important;
  border-color: var(--emies-primary) !important;
  color: var(--emies-primary) !important;
  box-shadow: none !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:active {
  background: rgba(11, 79, 108, 0.14) !important;
  background-image: none !important;
  box-shadow: none !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:active {
  background: var(--emies-primary) !important;
  background-image: none !important;
  border-color: var(--emies-primary) !important;
  color: var(--emies-white) !important;
  box-shadow: none !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active {
  color: var(--emies-muted) !important;
  background: #f8f9fa !important;
  background-image: none !important;
  border-color: var(--emies-border) !important;
  box-shadow: none !important;
}

/* Bootstrap 4 pagination (DataTables bootstrap renderer) */
.dataTables_wrapper .pagination {
  gap: 0.2rem;
}

.dataTables_wrapper .pagination .page-item .page-link {
  color: var(--emies-primary) !important;
  border: 1px solid var(--emies-border) !important;
  border-radius: 8px !important;
  padding: 0.35rem 0.75rem;
  box-shadow: none !important;
}

.dataTables_wrapper .pagination .page-item .page-link:hover {
  color: var(--emies-primary) !important;
  background-color: rgba(11, 79, 108, 0.08) !important;
  border-color: var(--emies-primary) !important;
}

.dataTables_wrapper .pagination .page-item.active .page-link {
  background-color: var(--emies-primary) !important;
  border-color: var(--emies-primary) !important;
  color: var(--emies-white) !important;
}

.dataTables_wrapper .pagination .page-item.disabled .page-link {
  color: var(--emies-muted) !important;
  background-color: #f8f9fa !important;
  border-color: var(--emies-border) !important;
}

div.dt-buttons .btn,
div.dt-buttons button.dt-button,
div.dt-buttons a.dt-button {
  background: var(--emies-primary) !important;
  border: 1px solid var(--emies-primary) !important;
  color: var(--emies-white) !important;
  border-radius: 8px !important;
  font-size: 0.875rem;
  padding: 0.4rem 0.85rem;
  margin-right: 0.35rem;
  margin-bottom: 0.35rem;
  box-shadow: none !important;
}

div.dt-buttons .btn:hover,
div.dt-buttons button.dt-button:hover,
div.dt-buttons a.dt-button:hover {
  background: #083d54 !important;
  border-color: #083d54 !important;
  color: var(--emies-white) !important;
}

div.dt-buttons .btn:focus,
div.dt-buttons button.dt-button:focus,
div.dt-buttons a.dt-button:focus {
  box-shadow: 0 0 0 0.2rem rgba(11, 79, 108, 0.25) !important;
}

table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
  background-color: var(--emies-primary);
  border-color: var(--emies-primary);
  box-shadow: none;
}

table.dataTable > tbody > tr.child ul.dtr-details > li {
  border-bottom-color: var(--emies-border);
}

table.dataTable > tbody > tr.child span.dtr-title {
  color: var(--emies-primary);
  font-weight: 600;
}

.gmap3,
#map_canvas {
  border-radius: 15px !important;
  overflow: hidden;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  border: none !important;
  margin-top: 0 !important;
}

/* ===== Preloader off ===== */
#preloader {
  display: none !important;
}

@media (min-width: 769px) and (max-width: 1024px) {
  .hero .featured {
    margin-top: -2.5rem !important;
  }
}

@media (max-width: 768px) {
  .hero .carousel,
  .hero .carousel-inner,
  .hero .carousel-item {
    min-height: 58vh;
  }

  .hero .carousel-container {
    inset: 56px 16px 24px 16px !important;
  }

  .hero .carousel-inner::after {
    width: min(55vw, 280px);
    height: min(55vw, 280px);
    right: 0;
    bottom: -8%;
    opacity: 0.65;
  }

  .hero .carousel-item h2 {
    font-size: 1.35rem !important;
    line-height: 1.35;
    margin-bottom: 12px !important;
  }

  .hero .carousel-item p {
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 12px;
    max-width: 100% !important;
  }

  .hero .btn-get-started {
    font-size: 14px;
    padding: 8px 24px;
    margin-top: 4px;
  }

  .hero .carousel-control-prev,
  .hero .carousel-control-next {
    width: 38px;
    height: 38px;
    top: auto;
    bottom: 18px;
    transform: none;
    backdrop-filter: none;
  }

  .hero .carousel-control-prev {
    left: 12px;
  }

  .hero .carousel-control-next {
    right: 12px;
  }

  .hero .carousel-control-prev-icon,
  .hero .carousel-control-next-icon {
    font-size: 22px;
  }

  .hero .featured {
    margin-top: 0 !important;
    padding-top: 0.75rem;
    padding-bottom: 1.25rem;
  }

  .hero .featured .row {
    --bs-gutter-x: 0.65rem;
    --bs-gutter-y: 0.65rem;
  }

  .hero .featured-item {
    padding: 14px 10px !important;
  }

  .hero .featured-item .icon {
    margin-bottom: 6px;
  }

  .hero .featured-item .icon i {
    font-size: 1.35rem !important;
  }

  .hero .featured-item h4 {
    font-size: 0.8rem;
    margin-bottom: 6px;
    line-height: 1.3;
  }

  .hero .featured-item p {
    font-size: 0.7rem;
    line-height: 1.35;
    margin-bottom: 0;
  }

  .hero .featured-item p .featured-lead {
    white-space: normal;
  }

  .section-header h3 {
    font-size: 1.35rem;
  }

  .section-header p {
    font-size: 0.9rem;
  }

  .footer .footer-top {
    text-align: center;
  }

  .footer .footer-about,
  .footer .footer-about p {
    text-align: center;
  }

  .footer .social-links {
    justify-content: center;
  }

  .footer .footer-contact p {
    font-size: 0.875rem;
    line-height: 1.6;
  }

  .navmenu a.nav-btn {
    width: fit-content;
    margin: 0.25rem 0;
  }
}

@media (hover: none) {
  .hero .featured-item:hover,
  .small-box:hover,
  .card:hover {
    transform: none;
  }
}
