/* งาน EMS ใช้โครงหน้าและสีหลักร่วมกับหน้าหน่วยงานอื่น */
.ems-page { font-family: "Kanit", sans-serif; }
.ems-page h1, .ems-page h2, .ems-page h3 { font-family: "TH Sarabun New", "Kanit", sans-serif; }

.ems-page #topbar .ems-topbar-title {
  color: #111;
  font-family: "TH Sarabun New", sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
}

.ems-page #topbar .ems-topbar-hospital {
  color: #111;
  font-family: "TH Sarabun New", sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
}

.ems-page #navbar ul li a {
  padding-left: 30px;
  font-family: "TH Sarabun New", sans-serif;
  font-size: 1.5em;
  font-weight: 700;
  text-transform: none;
}

.ems-page .appointment-btn {
  margin-left: 25px;
  font-family: "TH Sarabun New", sans-serif;
  font-size: 1.5em;
  font-weight: 700;
}

.ems-page #hero .container { max-width: 800px; }
.ems-page #hero h2 { margin-bottom: 10px; font-size: clamp(2.7rem, 5vw, 4rem); }
.ems-page #hero h2 span { display: block; font-size: .58em; font-weight: 500; }
.ems-page #hero h3 { margin-bottom: 20px; font-size: 2rem; }
.ems-page #hero .btn-get-started { font-family: "TH Sarabun New", sans-serif; font-size: 1.25rem; font-weight: 700; }

.ems-page .ems-section { scroll-margin-top: 110px; }
.ems-page .ems-section .section-title h2 {
  color: #2f2f2f;
  font-size: clamp(2.35rem, 4vw, 3.5rem);
  text-transform: none;
}

.ems-policy-grid { display: grid; grid-template-columns: 1fr minmax(280px, 440px); align-items: start; gap: 32px; }
.ems-lead { margin-bottom: 24px; font-size: 1.15rem; line-height: 1.7; font-weight: 400; }
.ems-info-card { margin-bottom: 14px; padding: 20px 24px; border: 1px solid #dcebed; border-left: 4px solid #3fbbc0; border-radius: 8px; background: #fff; }
.ems-info-card h3 { margin: 0 0 8px; color: #277d83; font-size: 1.8rem; font-weight: 700; }
.ems-info-card h3 i { margin-right: 6px; font-size: 1.1rem; }
.ems-info-card p { margin: 0; line-height: 1.75; }
.ems-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 14px; margin: 0; padding: 0; list-style: none; }
.ems-values strong { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; margin-right: 5px; border-radius: 50%; color: #fff; background: #3fbbc0; font-weight: 600; }
.ems-policy-note { margin: 14px 0 0; color: #64767d; font-size: .9rem; }
.ems-poster { margin: 0; padding: 10px; border: 1px solid #dcebed; border-radius: 10px; background: #fff; box-shadow: 0 5px 22px rgba(0, 0, 0, .08); text-align: center; }
.ems-poster img { display: block; width: 100%; height: auto; border-radius: 5px; }
.ems-poster figcaption { padding: 12px 5px 2px; color: #64767d; font-size: .88rem; }

.ems-organization-chart { width: min(100%, 620px); margin: 0 auto; padding: 12px; border: 1px solid #dcebed; border-radius: 10px; background: #fff; box-shadow: 0 5px 22px rgba(0, 0, 0, .08); text-align: center; }
.ems-organization-chart a { display: block; cursor: zoom-in; }
.ems-organization-chart img { display: block; width: 100%; height: auto; border-radius: 5px; }
.ems-organization-chart figcaption { padding: 12px 5px 2px; color: #64767d; font-size: .88rem; }
.ems-organization-chart figcaption i { margin-right: 4px; color: #3fbbc0; }

.ems-empty { display: flex; align-items: center; gap: 20px; min-height: 130px; padding: 26px 30px; border: 1px dashed #b8d5d9; border-radius: 8px; background: #fff; color: #536a7a; }
.ems-empty i { color: #3fbbc0; font-size: 2rem; }
.ems-empty p { margin: 0; font-size: 1.08rem; }

.ems-document { display: flex; align-items: center; gap: 20px; padding: 24px; border: 1px solid #dcebed; border-radius: 8px; box-shadow: 0 5px 20px rgba(0, 0, 0, .06); }
.ems-document-icon { display: flex; align-items: center; justify-content: center; flex: 0 0 64px; height: 64px; border-radius: 8px; background: #ecf8f9; color: #3fbbc0; font-size: 2rem; }
.ems-document-copy { flex: 1 1 auto; }
.ems-document h3 { margin: 0 0 6px; color: #2f2f2f; font-size: 1.8rem; font-weight: 700; }
.ems-document p { margin: 0 0 5px; line-height: 1.6; }
.ems-document small { color: #64767d; }
.ems-document-link { flex: 0 0 auto; padding: 10px 18px; border-radius: 4px; background: #3fbbc0; color: #fff; font-weight: 500; white-space: nowrap; }
.ems-document-link:hover { background: #65c9cd; color: #fff; }

.ems-wi-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 18px; scroll-margin-top: 110px; }
.ems-wi-search { position: relative; flex: 1 1 620px; max-width: 720px; }
.ems-wi-search > i { position: absolute; top: 50%; left: 18px; color: #3fbbc0; font-size: 1.15rem; transform: translateY(-50%); pointer-events: none; }
.ems-wi-search input { width: 100%; min-height: 52px; padding: 12px 50px 12px 50px; border: 1px solid #b8d5d9; border-radius: 10px; outline: none; background: #fff; color: #2f2f2f; font-size: 1rem; transition: border-color .2s ease, box-shadow .2s ease; }
.ems-wi-search input::placeholder { color: #7a8c94; }
.ems-wi-search input:focus { border-color: #3fbbc0; box-shadow: 0 0 0 4px rgba(63, 187, 192, .15); }
.ems-wi-search button { position: absolute; top: 50%; right: 10px; display: grid; width: 34px; height: 34px; padding: 0; place-items: center; border: 0; border-radius: 50%; background: #edf6f7; color: #536a7a; transform: translateY(-50%); }
.ems-wi-search button:hover, .ems-wi-search button:focus-visible { background: #dcebed; color: #277d83; }
.ems-wi-search button[hidden], .ems-wi-pagination[hidden], .ems-wi-pagination button[hidden] { display: none; }
.ems-wi-count { flex: 0 0 auto; margin: 0; color: #536a7a; font-size: .95rem; }
.ems-wi-list { display: grid; gap: 12px; }
.ems-wi-item { display: grid; grid-template-columns: 42px 54px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 18px 20px; border: 1px solid #dcebed; border-radius: 10px; background: #fff; box-shadow: 0 4px 16px rgba(44, 73, 100, .06); transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.ems-wi-item:hover { border-color: #b8dfe1; box-shadow: 0 8px 24px rgba(44, 73, 100, .1); transform: translateY(-1px); }
.ems-wi-item[hidden] { display: none; }
.ems-wi-number { color: #92a4aa; font-size: .84rem; font-weight: 600; letter-spacing: .05em; }
.ems-wi-file-icon { display: grid; width: 54px; height: 54px; place-items: center; border-radius: 10px; background: #fff0f0; color: #cf4545; font-size: 1.75rem; }
.ems-wi-copy { min-width: 0; }
.ems-wi-copy h3 { margin: 0 0 5px; color: #2f2f2f; font-family: "Kanit", sans-serif; font-size: 1.05rem; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.ems-wi-copy p { margin: 0; color: #71838b; font-size: .86rem; }
.ems-wi-actions { display: flex; align-items: center; gap: 8px; }
.ems-wi-read, .ems-wi-open { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 7px; border: 1px solid #3fbbc0; border-radius: 7px; font: inherit; font-size: .93rem; font-weight: 500; transition: background-color .2s ease, color .2s ease, border-color .2s ease; }
.ems-wi-read { padding: 9px 17px; background: #3fbbc0; color: #fff; }
.ems-wi-read:hover, .ems-wi-read:focus-visible { border-color: #277d83; background: #277d83; }
.ems-wi-open { width: 42px; background: #fff; color: #277d83; }
.ems-wi-open:hover, .ems-wi-open:focus-visible { background: #ecf8f9; color: #277d83; }
.ems-wi-pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 20px; }
.ems-wi-pagination .btn { min-width: 44px; min-height: 44px; }
.ems-wi-pagination [aria-current="page"] { border-color: #277d83; background: #277d83; color: #fff; }
.ems-wi-no-results { padding: 44px 24px; border: 1px dashed #b8d5d9; border-radius: 10px; background: #fff; text-align: center; }
.ems-wi-no-results[hidden] { display: none; }
.ems-wi-no-results > i { display: block; margin-bottom: 10px; color: #3fbbc0; font-size: 2rem; }
.ems-wi-no-results h3 { margin: 0 0 6px; color: #38535e; font-size: 1.8rem; }
.ems-wi-no-results p { margin: 0; color: #71838b; }

.ems-pdf-modal .modal-dialog { height: calc(100vh - 28px); margin-top: 14px; margin-bottom: 14px; }
.ems-pdf-modal .modal-content { height: 100%; overflow: hidden; border: 0; border-radius: 14px; }
.ems-pdf-modal .modal-header { padding: 14px 20px; border-bottom-color: #dcebed; }
.ems-pdf-modal-label { display: block; margin-bottom: 2px; color: #3fbbc0; font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.ems-pdf-modal .modal-title { max-width: min(76vw, 960px); overflow: hidden; color: #2f2f2f; font-family: "Kanit", sans-serif; font-size: 1.05rem; font-weight: 500; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.ems-pdf-modal .modal-body { min-height: 0; padding: 0; background: #4b5563; }
.ems-pdf-modal iframe { display: block; width: 100%; height: 100%; min-height: 460px; border: 0; background: #f1f3f4; }
.ems-pdf-modal .modal-footer { justify-content: space-between; gap: 12px; padding: 10px 18px; border-top-color: #dcebed; color: #64767d; font-size: .86rem; }
.ems-pdf-new-tab { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }

.ems-kpi-dashboards { margin-bottom: 32px; }
.ems-kpi-dashboard-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.ems-kpi-dashboard-heading h3 { margin: 0 0 4px; color: #277d83; font-size: 2rem; font-weight: 700; }
.ems-kpi-dashboard-heading h3 i { margin-right: 6px; font-size: 1.3rem; }
.ems-kpi-dashboard-heading p { margin: 0; color: #64767d; }
.ems-kpi-dashboard-tabs { gap: 8px; margin-bottom: 14px; }
.ems-kpi-dashboard-tabs .nav-link { padding: 9px 18px; border: 1px solid #b8dfe1; border-radius: 50px; color: #277d83; background: #fff; font-weight: 600; }
.ems-kpi-dashboard-tabs .nav-link:hover { border-color: #3fbbc0; background: #ecf8f9; }
.ems-kpi-dashboard-tabs .nav-link.active { border-color: #3fbbc0; background: #3fbbc0; color: #fff; }
.ems-kpi-dashboard-content { overflow: hidden; border: 1px solid #dcebed; border-radius: 12px; background: #fff; box-shadow: 0 5px 22px rgba(44, 73, 100, .1); }
.ems-kpi-dashboard-frame { background: #0a0f1e; }
.ems-kpi-dashboard-frame iframe { display: block; width: 100%; height: 720px; border: 0; background: #0a0f1e; }
.ems-kpi-dashboard-actions { padding: 12px 16px; border-top: 1px solid #dcebed; text-align: right; }
.ems-kpi-dashboard-actions a { display: inline-flex; align-items: center; gap: 6px; color: #277d83; font-weight: 600; }
.ems-kpi-dashboard-actions a:hover { color: #3fbbc0; }

.ems-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.ems-kpi-card { margin: 0; padding: 8px; border: 1px solid #dcebed; border-radius: 10px; background: #fff; box-shadow: 0 5px 18px rgba(44, 73, 100, .1); text-align: center; }
.ems-kpi-card a { display: block; overflow: hidden; border-radius: 6px; background: #edf6f7; cursor: zoom-in; }
.ems-kpi-card img { display: block; width: 100%; height: 350px; object-fit: contain; object-position: center; }
.ems-kpi-card figcaption { padding: 10px 6px 3px; color: #465c68; font-size: .95rem; }
.ems-kpi-documents { margin-top: 24px; }
.ems-kpi-document h3 { overflow-wrap: anywhere; }

.ems-section-intro { max-width: 780px; margin: 10px auto 0; color: #64767d; font-family: "Kanit", sans-serif; font-size: 1rem; line-height: 1.7; text-align: center; }
.ems-activity-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; color: #64767d; font-size: .92rem; }
.ems-activity-summary span:first-child { color: #38535e; font-weight: 500; }
.ems-activity-summary i { margin-right: 5px; color: #3fbbc0; }
.ems-activity-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.ems-activity-card { display: flex; min-width: 0; min-height: 285px; padding: 24px; flex-direction: column; border: 1px solid #dcebed; border-radius: 12px; background: #fff; box-shadow: 0 5px 18px rgba(44, 73, 100, .08); transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.ems-activity-card:hover { border-color: #b8dfe1; box-shadow: 0 10px 28px rgba(44, 73, 100, .13); transform: translateY(-3px); }
.ems-activity-card.is-collapsed { display: none; }
.ems-activity-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; color: #71838b; font-size: .8rem; }
.ems-activity-type { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 50px; background: #e8f6f7; color: #277d83; font-weight: 600; }
.ems-activity-type.is-video { background: #fff0f0; color: #c74444; }
.ems-activity-type i { font-size: .95rem; }
.ems-activity-meta time, .ems-activity-date { text-align: right; }
.ems-activity-copy { flex: 1 1 auto; }
.ems-activity-copy h3 { margin: 0 0 10px; color: #2f2f2f; font-family: "TH Sarabun New", "Kanit", sans-serif; font-size: 1.65rem; font-weight: 700; line-height: 1.2; }
.ems-activity-copy p { display: -webkit-box; margin: 0 0 22px; overflow: hidden; color: #5e737d; font-size: .91rem; line-height: 1.7; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.ems-activity-link { display: inline-flex; align-items: center; align-self: flex-start; gap: 7px; margin-top: auto; color: #277d83; font-size: .9rem; font-weight: 600; }
.ems-activity-link:hover, .ems-activity-link:focus-visible { color: #3fbbc0; }
.ems-activity-more { margin-top: 28px; text-align: center; }
.ems-activity-more button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 9px; padding: 10px 22px; border: 1px solid #3fbbc0; border-radius: 50px; background: #fff; color: #277d83; font: inherit; font-size: .93rem; font-weight: 600; transition: background-color .2s ease, color .2s ease; }
.ems-activity-more button:hover, .ems-activity-more button:focus-visible { background: #3fbbc0; color: #fff; }

.ems-highlights-slider { padding: 8px 0 48px; }
.ems-highlights-slider .swiper-slide { height: auto; }
.ems-highlight-card { position: relative; display: block; height: 100%; overflow: hidden; border: 5px solid #fff; border-radius: 10px; background: #edf6f7; box-shadow: 0 5px 18px rgba(44, 73, 100, .13); }
.ems-highlight-card img { display: block; width: 100%; height: 220px; object-fit: contain; object-position: center; background: #edf6f7; }
.ems-highlight-zoom { position: absolute; right: 10px; bottom: 10px; display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; background: rgba(39, 125, 131, .9); color: #fff; font-size: 1rem; opacity: 0; transform: translateY(5px); transition: opacity .25s ease, transform .25s ease; }
.ems-highlight-card:hover .ems-highlight-zoom, .ems-highlight-card:focus .ems-highlight-zoom { opacity: 1; transform: translateY(0); }
.ems-highlights-slider .swiper-button-prev, .ems-highlights-slider .swiper-button-next { width: 38px; height: 38px; margin-top: -38px; border: 0; border-radius: 50%; background: #3fbbc0; color: #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .15); }
.ems-highlights-slider .swiper-button-prev::after, .ems-highlights-slider .swiper-button-next::after { font-size: 1rem; font-weight: 700; }
.ems-highlights-slider .swiper-button-prev { left: 10px; }
.ems-highlights-slider .swiper-button-next { right: 10px; }
.ems-highlights-slider .swiper-pagination { bottom: 8px; }
.ems-highlights-slider .swiper-pagination-bullet-active { background: #3fbbc0; }

@media (max-width: 991px) {
  .ems-policy-grid { grid-template-columns: 1fr; }
  .ems-poster { width: min(100%, 560px); margin: 0 auto; }
  .ems-wi-item { grid-template-columns: 38px 50px minmax(0, 1fr); }
  .ems-wi-file-icon { width: 50px; height: 50px; }
  .ems-wi-actions { grid-column: 3; }
  .ems-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ems-activity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ems-page #navbar.navbar-mobile ul li a { font-size: 1.5rem; padding: 10px 20px; }
}

@media (max-width: 640px) {
  .ems-page #topbar .ems-topbar-title { font-size: 1.25rem; }
  .ems-page #topbar .ems-topbar-hospital { display: none; }
  .ems-page #hero .container { margin-left: 18px; margin-right: 18px; }
  .ems-page #hero h2 { font-size: 2.4rem; }
  .ems-page #hero h3 { font-size: 1.6rem; }
  .ems-values { grid-template-columns: 1fr; }
  .ems-document { align-items: flex-start; flex-wrap: wrap; }
  .ems-document-link { margin-left: 84px; }
  .ems-wi-toolbar { align-items: stretch; flex-direction: column; gap: 10px; }
  .ems-wi-search { flex-basis: auto; max-width: none; }
  .ems-wi-count { padding-left: 2px; }
  .ems-wi-item { grid-template-columns: 44px minmax(0, 1fr); gap: 12px; padding: 16px; }
  .ems-wi-number { display: none; }
  .ems-wi-file-icon { width: 44px; height: 44px; font-size: 1.45rem; }
  .ems-wi-actions { grid-column: 1 / -1; }
  .ems-wi-read { flex: 1 1 auto; }
  .ems-pdf-modal .modal-dialog { width: 100%; height: 100%; margin: 0; }
  .ems-pdf-modal .modal-content { border-radius: 0; }
  .ems-pdf-modal .modal-title { max-width: 74vw; }
  .ems-pdf-modal .modal-footer { align-items: flex-start; flex-direction: column; }
  .ems-kpi-grid { grid-template-columns: 1fr; }
  .ems-kpi-card { width: min(100%, 360px); margin: 0 auto; }
  .ems-kpi-card img { height: 440px; }
  .ems-kpi-dashboard-tabs .nav-link { width: 100%; }
  .ems-kpi-dashboard-frame iframe { height: 600px; }
  .ems-activity-summary { align-items: flex-start; flex-direction: column; gap: 5px; }
  .ems-activity-grid { grid-template-columns: 1fr; }
  .ems-activity-card { min-height: 0; padding: 21px; }
  .ems-highlight-card img { height: 210px; }
}
