:root {
  --t: #1aab8b;
  --td: #148f74;
  --tp: #e8f7f4;
  --tm: #c0e8de;
  --tg: rgba(26, 171, 139, .28);
  --bg: #f8fafb;
  --sf: #fff;
  --bd: #dde8e4;
  --tx: #1a1a2e;
  --ts: #4a5568;
  --mu: #8896a8;
  --r1: 10px;
  --r2: 14px;
  --r3: 20px;
  --rp: 999px;
  --s1: 0 2px 10px rgba(26, 171, 139, .09);
  --s2: 0 6px 22px rgba(26, 171, 139, .14);
  --fn: 'Sarabun', sans-serif;
  --tr: .2s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  overflow-x: hidden;
  max-width: 100%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  /* มีอยู่แล้วในไฟล์คุณ ดีอยู่แล้ว */
}

body {
  font-family: var(--fn);
  font-size: 15px;
  line-height: 1.7;
  color: var(--tx);
  background: var(--bg);
  -webkit-font-smoothing: antialiased
}

a {
  text-decoration: none;
  color: inherit
}

img {
  display: block;
  max-width: 100%;
  height: auto
}

/* ============ NAVBAR ============ */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 16px;
  padding: 14px 32px;
  background: rgba(255, 255, 255, .75);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-bottom: 1px solid rgba(255, 255, 255, .4);
  box-shadow: 0 4px 20px rgba(218, 218, 218, .49);
  position: sticky;
  top: 0;
  z-index: 999;
  will-change: transform;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  /* สำคัญ: ให้ flex item ยอม shrink ได้ */
  flex-shrink: 1;
}

.nav-logos {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.nav-logos a {
  display: flex;
  align-items: center;
}

.nav-logos img {
  height: 42px;
  width: auto;
  object-fit: contain;
}

.nav-logo {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--t);
  color: #fff;
  font-size: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px var(--tg);
}

.nav-name {
  min-width: 0;
  overflow: hidden;
}

.nav-name strong {
  display: block;
  font-size: 16px;
  font-weight: 800;
  color: var(--td);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-name span {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #5e5e5e;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 10px;
  background: var(--tp);
  color: var(--td);
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.nav-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--td);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .25s ease;
}

.nav-btn:hover {
  background: rgba(6, 214, 162, .08);
  color: var(--t);
}

.nav-btn i {
  font-size: 14px;
  opacity: .85;
  transition: transform var(--tr);
}

.nav-btn:hover i {
  transform: scale(1.15);
}

.nav-btn::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 0;
  height: 2px;
  background: var(--t);
  border-radius: 999px;
  transition: .25s ease;
}

.nav-btn:hover::after {
  width: 60%;
  left: 20%;
}

.nav-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.25
}

.nav-text strong {
  font-size: .78rem;
  font-weight: 700
}

.nav-text small {
  font-size: .68rem;
  opacity: .8
}

/* Nav dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: rgba(26, 171, 139, .08);
  border: 1px solid rgba(26, 171, 139, .18);
  border-radius: 10px;
  color: var(--td);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--tr);
}

.nav-dropdown-toggle:hover {
  background: rgba(26, 171, 139, .16);
}

.dropdown-arrow {
  font-size: 12px;
  transition: transform var(--tr);
}

.nav-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 280px;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .15);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 1000;
}

.nav-dropdown.open .nav-dropdown-menu {
  display: flex;
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--tx);
  transition: background var(--tr);
}

.nav-dropdown-item:hover {
  background: rgba(20, 143, 116, .1);
}

.nav-dropdown-item i {
  font-size: 18px;
  color: var(--td);
  width: 24px;
  text-align: center;
}

.nav-dropdown-item .nav-text strong {
  font-size: 14px;
  color: var(--tx);
}

.nav-dropdown-item .nav-text small {
  font-size: 12px;
  color: #666;
}

/* dropdown ทำงานด้วยคลาส .open จาก JS (แทน hover เดิม) */
.nav-dropdown-menu {
  display: none;
}

.nav-dropdown.open .nav-dropdown-menu {
  display: flex;
}

.nav-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

/* ===== Responsive: นี่คือส่วนที่กันการตกหน้าจอจริง ===== */
@media (max-width: 860px) {
  .navbar {
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nav-name span {
    display: none;
    /* ลดรายละเอียดที่ไม่จำเป็นบนจอเล็ก */
  }

  /* เมนูพับเป็นลิ้นชักแนวตั้ง เต็มความกว้าง */
  .nav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    order: 3;
    margin-top: 12px;
    gap: 4px;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-btn {
    width: 100%;
    justify-content: flex-start;
  }

  .nav-dropdown,
  .nav-dropdown-toggle {
    width: 100%;
  }

  .nav-dropdown-menu {
    position: static;
    /* ไม่ลอยทับ ไม่ดันออกขอบจอ */
    box-shadow: none;
    background: rgba(26, 171, 139, .04);
    width: 100%;
  }
}

@media (max-width: 420px) {
  .nav-name strong {
    font-size: 14px;
  }

  .nav-logos img {
    height: 34px;
  }
}

/* ============ HERO ============ */
.hero {
  position: relative;
  background:
    radial-gradient(circle at top left, rgba(26, 171, 139, .15), transparent 35%),
    radial-gradient(circle at bottom right, rgba(0, 180, 216, .12), transparent 40%),
    linear-gradient(135deg, #ffffff 0%, #f6fffd 45%, #dff7f1 100%);
  padding: 70px 80px 100px;
  overflow: hidden;
  isolation: isolate;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(6, 214, 162, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6, 214, 162, .04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 60px;
}

/* Floating decorative boxes */
.hero-inner::before {
  content: '';
  position: absolute;
  width: 140px;
  height: 140px;
  right: 120px;
  top: 40px;
  border-radius: 24px;
  background: rgba(6, 214, 162, .06);
  transform: rotate(15deg);
  z-index: 0;
}

.hero-inner::after {
  content: '';
  position: absolute;
  width: 90px;
  height: 90px;
  left: 50px;
  bottom: 20px;
  border-radius: 18px;
  background: rgba(14, 165, 233, .05);
  transform: rotate(-20deg);
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  flex: 1;
  max-width: 600px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(26, 171, 139, .12);
  color: var(--t);
  border: 1px solid rgba(26, 171, 139, .15);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 18px;
}

.hero h1 {
  font-size: 44px;
  font-weight: 800;
  color: var(--tx);
  line-height: 1.12;
  letter-spacing: -.022em
}

.hero h2 {
  font-size: 42px;
  font-weight: 900;
  background: linear-gradient(135deg, #1aab8b, #00b4d8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -.03em;
}

.hero p,
.hero-desc {
  margin-top: 16px;
  font-size: 15px;
  line-height: 1.82;
  color: var(--ts);
}

.hero-feature {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.hero-feature span {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid rgba(26, 171, 139, .12);
  border-radius: 600px;
  font-size: 13px;
  font-weight: 600;
  color: var(--tx);
}

.hero-feature i {
  color: var(--t);
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  padding: 12px 30px;
  background: var(--t);
  color: #fff;
  border: none;
  border-radius: var(--rp);
  font-family: var(--fn);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--tg);
  transition: background var(--tr), transform var(--tr);
  will-change: transform;
}

.hero-btn:hover {
  background: var(--td);
  transform: translateY(-2px)
}

.hero-btn:active {
  transform: translateY(0)
}

.hero-image-wrap {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  flex: 0 0 42%;
  max-width: 480px;
}

.hero-blob {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(26, 171, 139, .18), transparent 70%);
  filter: blur(10px);
  animation: pulseBlob 6s ease-in-out infinite;
}

.hero-image {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 2;
  margin: 0 auto;
  animation: floatImage 6s ease-in-out infinite;
}

.hero-pattern {
  position: absolute;
  inset: 0;
  opacity: .06;
  background:
    radial-gradient(circle at 20% 20%, #06d6a2 3px, transparent 4px),
    radial-gradient(circle at 80% 30%, #06d6a2 3px, transparent 4px),
    radial-gradient(circle at 60% 80%, #06d6a2 3px, transparent 4px);
  background-size: 180px 180px;
  pointer-events: none;
}

@keyframes floatImage {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-12px);
  }
}

@keyframes pulseBlob {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
  }
}

/* ============ TABS ============ */
.tabs-wrap {
  display: flex;
  justify-content: center;
  padding: 36px 32px 24px
}

.tab-strip {
  display: inline-flex;
  background: #e2f0ec;
  border-radius: var(--rp);
  padding: 5px;
  gap: 4px;
  align-items: center
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 28px;
  border: none;
  border-radius: var(--rp);
  font-family: var(--fn);
  font-size: 14px;
  font-weight: 500;
  color: var(--ts);
  background: transparent;
  cursor: pointer;
  transition: background var(--tr), color var(--tr);
}

.tab-btn i {
  font-size: 13px
}

.tab-btn:hover {
  background: rgba(255, 255, 255, .75);
  color: var(--t)
}

.tab-btn.active {
  background: var(--t);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 10px var(--tg)
}

/* ============ CONTENT / SECTIONS ============ */
.content-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px 88px
}

.section-heading,
.manual-section-title,
.image-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--tx);
  border-left: 4px solid var(--t);
  padding: 6px 0 6px 14px;
  margin: 36px 0 16px;
}

.section-heading {
  margin: 42px 0 20px;
  font-size: 18px
}

.manual-section-title i,
.image-section-title i {
  color: var(--t);
  font-size: 15px
}

.section-heading h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--tx);
  letter-spacing: -.01em;
  margin: 0
}

/* System cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px
}

.sys-card {
  background: var(--sf);
  border-radius: var(--r2);
  border: 1px solid var(--bd);
  padding: 28px 16px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform var(--tr), box-shadow var(--tr), border-color var(--tr);
  will-change: transform;
}

.sys-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--t);
  border-radius: var(--r2) var(--r2) 0 0;
  opacity: 0;
  transition: opacity var(--tr);
}

.sys-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .08), 0 20px 50px rgba(26, 171, 139, .15);
  border-color: var(--tm)
}

.sys-card:hover::before {
  opacity: 1
}

.sys-card:focus-visible {
  outline: 2px solid var(--t);
  outline-offset: 2px
}

.sys-card.disabled {
  opacity: .42;
  pointer-events: none
}

.card-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--t);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  margin-bottom: 14px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(26, 171, 139, .25);
  transition: transform var(--tr), box-shadow var(--tr);
  will-change: transform;
}

.sys-card:hover .card-icon {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(26, 171, 139, .35)
}

.sys-card.disabled .card-icon {
  background: #b0c4c0;
  box-shadow: none
}

.card-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ts);
  line-height: 1.5
}

/* Manual cards */
.manual-card {
  background: var(--sf);
  border-radius: var(--r2);
  border: 1px solid var(--bd);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  height: 100%;
  transition: transform var(--tr), box-shadow var(--tr), border-color var(--tr);
  will-change: transform;
}

.manual-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--s2);
  border-color: var(--tm)
}

.manual-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--tx);
  margin: 0 0 4px;
  line-height: 1.45
}

.manual-sub {
  font-size: 12px;
  color: var(--mu)
}

.icon-bubble {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
}

.icon-info {
  background: var(--t);
  box-shadow: 0 3px 10px rgba(26, 171, 139, .25)
}

.icon-product {
  background: #0284c7;
  box-shadow: 0 3px 10px rgba(2, 132, 199, .25)
}

.icon-budget {
  background: #d97706;
  box-shadow: 0 3px 10px rgba(217, 119, 6, .25)
}

.icon-warehouse {
  background: #0f766e;
  box-shadow: 0 3px 10px rgba(15, 118, 110, .25)
}

.icon-request {
  background: #7c3aed;
  box-shadow: 0 3px 10px rgba(124, 58, 237, .25)
}

.icon-issue {
  background: #dc2626;
  box-shadow: 0 3px 10px rgba(220, 38, 38, .20)
}

.icon-purchase {
  background: #0369a1;
  box-shadow: 0 3px 10px rgba(3, 105, 161, .25)
}

.icon-report {
  background: #059669;
  box-shadow: 0 3px 10px rgba(5, 150, 105, .25)
}

.icon-video {
  background: #6d28d9;
  box-shadow: 0 3px 10px rgba(109, 40, 217, .25)
}

.icon-transfer {
  background: #0891b2;
  box-shadow: 0 3px 10px rgba(8, 145, 178, .25)
}

.icon-opd {
  background: #16a34a;
  box-shadow: 0 3px 10px rgba(22, 163, 74, .25)
}

.icon-ipd {
  background: #9333ea;
  box-shadow: 0 3px 10px rgba(147, 51, 234, .25)
}

/* ============ GALLERY ============ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.gallery-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--bd);
  border-radius: 18px;
  cursor: zoom-in;
  width: 100%;
  aspect-ratio: 16/10;
  box-shadow: var(--s1);
  contain: layout paint;
  transition: box-shadow var(--tr), transform var(--tr);
  will-change: transform;
}

.gallery-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, .25), transparent 50%);
  opacity: 0;
  transition: .3s;
}

.gallery-item:hover::before {
  opacity: 1;
}

.gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--s2)
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--tr);
  will-change: transform;
}

.gallery-item:hover img {
  transform: scale(1.03)
}

.gallery-hover {
  position: absolute;
  inset: 0;
  background: rgba(26, 171, 139, .30);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  opacity: 0;
  transition: opacity var(--tr);
}

.gallery-item:hover .gallery-hover {
  opacity: 1
}

.gallery-caption {
  font-size: 13px;
  font-weight: 500;
  color: var(--ts);
  text-align: center;
  line-height: 1.5;
  margin-top: 6px;
}

@media(min-width:900px) {
  .gallery-grid {
    grid-template-columns: repeat(5, 1fr)
  }
}

@media(max-width:500px) {
  .gallery-grid {
    grid-template-columns: 1fr
  }
}

/* ============ VIDEO GRID ============ */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.video-card {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: var(--r2);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--tr), box-shadow var(--tr), border-color var(--tr);
  will-change: transform;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--s2);
  border-color: var(--tm);
}

.video-thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}

.video-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--tr), opacity var(--tr);
}

.video-card:hover .video-thumb-wrap img {
  transform: scale(1.04);
  opacity: .85;
}

.video-play-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.video-play-btn i {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(220, 38, 38, .9);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
  transition: transform var(--tr), background var(--tr);
}

.video-card:hover .video-play-btn i {
  transform: scale(1.12);
  background: rgba(220, 38, 38, 1);
}

.video-card-body {
  padding: 14px 16px;
}

.video-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--t);
  background: var(--tp);
  border-radius: var(--rp);
  padding: 3px 10px;
  margin-bottom: 8px;
}

.video-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--tx);
  margin: 0;
  line-height: 1.45;
}

@media(max-width: 600px) {
  .video-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ============ MODALS ============ */
.modal-content {
  border: none;
  border-radius: var(--r3);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(26, 171, 139, .18)
}

.modal-header {
  background: var(--t);
  border-bottom: none;
  padding: 14px 20px
}

.modal-header .modal-title {
  color: #fff;
  font-size: 16px;
  font-weight: 600
}

.modal-header .btn-close {
  filter: invert(1) brightness(2);
  opacity: .75
}

.modal-header .btn-close:hover {
  opacity: 1
}

.pdf-body,
.video-body,
.img-body {
  padding: 0
}

.pdf-wrapper {
  height: 72vh
}

.pdf-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block
}

/* Video modal */
.video-modal,
.img-modal,
.image-modal {
  border: none;
  border-radius: 24px;
  overflow: hidden;
  background: #fff;
}

.video-header,
.img-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  background: linear-gradient(135deg, #06d6a2, #0ea5e9);
  color: #fff;
}

.video-title-wrap,
.img-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.video-icon,
.img-icon {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.video-label,
.img-label {
  display: block;
  font-size: .75rem;
  opacity: .85;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.video-title,
.img-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.video-header .btn-close,
.img-header .btn-close {
  background-color: rgba(255, 255, 255, .15);
  border-radius: 50%;
  padding: 10px;
}

.btn-close-white {
  filter: brightness(0) invert(1);
  opacity: 1;
}

.video-body,
.img-body {
  padding: 20px;
  background: #f8fafc;
}

.video-wrapper {
  border-radius: var(--r1);
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .12);
}

.video-footer,
.img-footer {
  background: linear-gradient(135deg, #00b4d8, #0ea5e9);
  border-top: 1px solid #edf2f7;
  padding: 14px 20px;
}

.custom-footer,
.img-custom-footer {
  background: #f5fbf9;
  border-top: 1px solid var(--bd);
  padding: 12px 20px;
  justify-content: center;
}

.footer-text,
.img-footer-text {
  font-size: 12px;
  color: var(--mu);
  line-height: 1.7;
  text-align: center;
  width: 100%;
}

.custom-close-btn {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .25s ease;
}

.custom-close-btn:hover {
  background: #ffffff;
  color: #06d6a2;
  transform: rotate(90deg);
}

/* Image viewport (zoom/drag) */
.img-body {
  display: flex;
  align-items: center;
  justify-content: center;
}

#imgViewport {
  position: relative;
  overflow: hidden;
  max-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfeff 50%, #f8fafc 100%);
  cursor: grab;
  user-select: none;
  contain: layout paint;
  border-radius: var(--r1);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .12);
}

#imgViewport::before {
  content: "";
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(6, 214, 162, .15), transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#imgViewport:active {
  cursor: grabbing;
}

#modalImage {
  max-width: 100%;
  max-height: 75vh;
  position: relative;
  z-index: 1;
  transition: transform .1s;
  transform-origin: center;
  will-change: transform;
}

#imgDragOverlay {
  position: absolute;
  inset: 0;
}

.zoom-bar {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 8px 20px rgba(6, 214, 162, .20);
}

.z-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--t);
  color: #fff;
  transition: background var(--tr);
}

.z-btn:hover {
  background: var(--td);
}

.z-pct {
  color: var(--td);
  font-size: 12px;
  min-width: 38px;
  text-align: center;
  font-family: var(--fn);
}

.img-cap {
  background: linear-gradient(135deg, #06d6a2, #00b4d8);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}

.copyright-text {
  color: #fff;
  font-size: .82rem;
  line-height: 1.6;
  text-align: center;
}

/* ============ BACK TO TOP ============ */
#backToTop {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 52px;
  height: 52px;
  opacity: 0;
  visibility: hidden;
  z-index: 999;
  cursor: pointer;
  transition: opacity var(--tr), visibility var(--tr);
  will-change: opacity;
}

#backToTop.show {
  opacity: 1;
  visibility: visible
}

.btt-svg {
  position: absolute;
  inset: 0;
  width: 52px;
  height: 52px
}

.btt-track {
  fill: none;
  stroke: var(--tm);
  stroke-width: 3
}

.btt-ring {
  fill: none;
  stroke: var(--t);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 138;
  stroke-dashoffset: 138;
  transition: stroke-dashoffset .4s ease
}

.btt-inner-btn {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--t);
  box-shadow: var(--s1);
  transition: background var(--tr);
}

.btt-inner-btn svg {
  width: 20px;
  height: 20px
}

.btt-inner-btn:hover {
  background: var(--td)
}

/* ============ FOOTER ============ */
.site-footer {
  background: var(--sf);
  border-top: 1px solid var(--bd);
  text-align: center;
  padding: 28px 24px
}

.site-footer p,
.footer-bottom {
  font-size: 13px;
  color: var(--mu);
  line-height: 1.85
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center
}

.footer-copy {
  font-size: 12px;
  color: var(--mu);
  font-family: monospace
}

/* ============ PAGE LOADER ============ */
#page-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(120deg, #fff 0%, #d0ece7 100%);
  transition: opacity .6s ease, visibility .6s ease;
}

#page-loader.hide {
  opacity: 0;
  visibility: hidden
}

.loader-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--tm);
  border-top-color: var(--t);
  animation: spin .9s linear infinite;
  will-change: transform;
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

#loaderMsg {
  margin-top: 18px;
  font-size: 14px;
  color: var(--ts);
  font-family: var(--fn)
}

/* ============ SCROLLBAR / FOCUS ============ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px
}

::-webkit-scrollbar-track {
  background: transparent
}

::-webkit-scrollbar-thumb {
  background: var(--tm);
  border-radius: 99px
}

::-webkit-scrollbar-thumb:hover {
  background: var(--t)
}

:focus-visible {
  outline: 2px solid var(--t);
  outline-offset: 3px
}

@media(prefers-reduced-motion:reduce) {

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important
  }
}

/* ============ RESPONSIVE ============ */
@media(max-width:960px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr)
  }

  .hero-inner {
    gap: 32px;
  }
}

@media(max-width:768px) {
  .hero {
    padding: 52px 24px 72px
  }

  .hero-inner {
    flex-direction: column;
    text-align: center;
  }

  .hero-content {
    max-width: 100%;
  }

  .hero-feature {
    justify-content: center;
  }

  .hero h1 {
    font-size: 32px
  }

  .hero h2 {
    font-size: 27px
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px
  }

  .content-wrap {
    padding: 0 16px 64px
  }

  .tabs-wrap {
    padding: 28px 16px 18px
  }

  .nav-links {
    gap: 4px
  }

  .nav-text small {
    display: none
  }
}

@media(max-width:600px) {
  .navbar {
    padding: 10px 14px;
    gap: 10px
  }

  .nav-name strong {
    font-size: .82rem
  }

  .nav-logo {
    width: 38px;
    height: 38px;
    font-size: 17px
  }

  .nav-btn {
    padding: 8px 12px;
    gap: 7px
  }

  .nav-text strong {
    font-size: .72rem
  }

  .hero h1 {
    font-size: 26px
  }

  .hero h2 {
    font-size: 22px
  }

  .hero-btn {
    width: 100%;
    justify-content: center
  }

  .card-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px
  }

  .sys-card {
    padding: 22px 10px 18px
  }

  .card-icon {
    width: 50px;
    height: 50px;
    font-size: 18px
  }

  .card-label {
    font-size: 12px
  }
}

@media(max-width:400px) {
  .nav-links {
    gap: 3px
  }

  .nav-btn {
    padding: 7px 10px
  }

  .nav-text {
    display: none
  }
}


.doc-card-container {
  display: grid;
  gap: 20px;
}

/* Card */
.doc-card {
  display: flex;
  gap: 20px;
  background: #ffffff;
  padding: 20px;
  border-radius: 14px;
  border: 1px solid #d9e7f7;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
  transition: 0.25s;
}

/* Hover effect */
.doc-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

/* Icon Box */
.doc-icon {
  width: 65px;
  height: 65px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 26px;
}

/* Title */
.doc-title {
  margin: 0 0 6px;
  font-weight: 600;
  color: #003f7f;
}

/* Description */
.doc-body p {
  margin: 0;
  line-height: 1.55;
  color: #58708c;
}

/* Responsive */
@media (max-width: 768px) {
  .doc-card {
    flex-direction: column;
    text-align: center;
  }

  .doc-icon {
    margin: 0 auto;
  }
}

.doc-card {
  display: flex;
  gap: 20px;
  background: #ffffff;
  padding: 20px;
  border-radius: 14px;
  border: 1px solid #d9e7f7;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
  transition: 0.25s;
}

/* ❗ ป้องกันไอคอนโดนบีบ */
.doc-icon {
  width: 65px;
  min-width: 65px;
  /* สำคัญมาก – ล็อกไม่ให้โดนบีบ */
  height: 65px;
  border-radius: 16px;
  flex-shrink: 0;
  /* ห้ามบีบ */

  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 26px;
}

/* เนื้อหา */
.doc-body {
  flex: 1;
  /* ให้ส่วนข้อความเป็นตัวขยายแทน */
}

.doc-body p {
  margin: 0;
  line-height: 1.55;
  color: #58708c;
  text-align: justify;
}

/* ปุ่มดาวน์โหลด */
.download-btn {
  margin-top: 12px;
  display: inline-block;
  background: #007bff;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  transition: 0.2s;
  text-decoration: none;
}

.download-btn:hover {
  background: #0056c9;
  color: #fff;
}


/* สีพิเศษ */
.bg-purple {
  background: #6f42c1 !important;
}

.bg-purple-light {
  background: #b388ff !important;
}

.bg-orange {
  background: #fd7e14 !important;
}

.bg-pink {
  background: #ff6fa8 !important;
}

.bg-brown {
  background: #8d6e63 !important;
}

.bg-primary-light {
  background: #4da3ff !important;
}

.bg-cyan {
  background: #17a2b8 !important;
}