/* ============================================================
   pb_website — เทศบาลเมืองพิบูลมังสาหาร
   Design system: "เมืองริมมูล" (river-city theme)
   ============================================================ */

:root {
  --c-primary: #1773cf;        /* ฟ้า — โทนหลัก (ขาว-ฟ้า) */
  --c-primary-deep: #135aa8;
  --c-dark: #0c3c72;           /* กรมท่า — หัวข้อ/footer */
  --c-darker: #082a52;
  --c-accent: #f59e0b;         /* ทอง — จุดเน้น (FAB/ไฮไลต์) */
  --c-accent-soft: #fde68a;
  --c-bg: #f1f7ff;             /* ขาวอมฟ้าอ่อน */
  --c-surface: #ffffff;
  --c-text: #1e293b;
  --c-muted: #64748b;
  --c-line: #e2e8f0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 10px rgba(13, 60, 114, 0.08);
  --shadow-md: 0 10px 30px rgba(13, 60, 114, 0.13);
  --shadow-lg: 0 18px 50px rgba(13, 60, 114, 0.18);
  --font-display: 'Prompt', sans-serif;
  --font-body: 'Sarabun', 'Prompt', sans-serif;
  --fs-base: 1rem;
}

html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  color: var(--c-text);
  background: var(--c-bg);
  overflow-x: hidden;
}
h1, h2, h3, h4, h5, h6, .btn, .nav-link { font-family: var(--font-display); }
a { text-decoration: none; }
img { max-width: 100%; }

/* Font-size accessibility (ก- ก ก+) — ปรับที่ html เพื่อให้ทุกหน่วย rem ทั้งหน้า scale ตามจริง */
html[data-fontscale="-1"] { font-size: 93.75%; }   /* 15px */
html[data-fontscale="1"]  { font-size: 106.25%; }  /* 17px */
html[data-fontscale="2"]  { font-size: 112.5%; }   /* 18px */

/* High-contrast mode */
body.high-contrast { filter: contrast(1.15) saturate(0.9); }
body.high-contrast .hero-overlay { background: rgba(0, 0, 0, 0.45); }

.skip-link {
  position: absolute; top: 0; left: 0; z-index: 2000;
  background: var(--c-accent); color: #442c02; padding: .5rem 1rem;
}

/* ============ Topbar ============ */
.topbar {
  background: #ffffff; color: #14335c;
  padding: .3rem 0; font-size: .85rem; position: relative; z-index: 1051;
  border-bottom: 1px solid rgba(12, 47, 92, 0.1);
}
.topbar-link { color: #274a7a; font-size: .85rem; }
.topbar-link:hover { color: #0c2f5c; }
.font-size-controls { display: inline-flex; border-radius: 999px; overflow: hidden; border: 1px solid rgba(12, 47, 92, 0.28); }
.font-size-controls button {
  background: transparent; color: #0c3c72; border: 0;
  padding: .1rem .55rem; font-size: .8rem; line-height: 1.4;
}
.font-size-controls button:hover { background: var(--c-primary); color: #fff; }
.contrast-toggle {
  background: transparent; border: 1px solid rgba(12, 47, 92, 0.28); color: #0c3c72;
  border-radius: 50%; width: 26px; height: 26px; font-size: .8rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.contrast-toggle:hover { background: var(--c-primary); color: #fff; }

/* ============ Header / Nav ============ */
.site-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 1050;
  box-shadow: var(--shadow-sm);
  padding: .6rem 0;
  transition: padding .25s ease, box-shadow .25s ease;
}
.site-header.shrink { padding: .25rem 0; box-shadow: var(--shadow-md); }
.brand { display: flex; align-items: center; gap: .7rem; color: var(--c-dark); min-width: 0; }
.brand-logo img, .brand-logo svg { width: 46px; height: 46px; transition: width .25s, height .25s; }
.site-header.shrink .brand-logo img, .site-header.shrink .brand-logo svg { width: 38px; height: 38px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-family: var(--font-display); font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--c-muted); font-size: .72rem; letter-spacing: .04em; }

.main-nav { flex-shrink: 0; }
.main-nav > ul { display: flex; flex-wrap: nowrap; gap: .25rem; margin: 0; padding: 0; list-style: none; }
.main-nav a, .main-nav button {
  display: inline-flex; align-items: center; gap: .15rem;
  font-family: var(--font-display); font-weight: 500; font-size: .95rem;
  color: var(--c-dark); background: none; border: 0;
  padding: .55rem .8rem; border-radius: 999px; transition: all .2s;
  white-space: nowrap;
}

/* จอ laptop แคบ (992–1199px): เมนูกระชับ — ซ่อนไอคอน/ชื่ออังกฤษ กันเมนูตกบรรทัด */
@media (min-width: 992px) and (max-width: 1199.98px) {
  .site-header .container { gap: .6rem !important; }
  .brand-logo img, .brand-logo svg { width: 40px; height: 40px; }
  .brand-text strong { font-size: .9rem; max-width: 220px; }
  .brand-text small { display: none; }
  .main-nav > ul { gap: .1rem; }
  .main-nav > ul > li > a, .main-nav > ul > li > button {
    font-size: .86rem; padding: .5rem .55rem;
  }
  .main-nav > ul > li > a > i:not(.chev),
  .main-nav > ul > li > button > i:not(.chev) { display: none; }
}
.main-nav a:hover, .main-nav button:hover,
.main-nav .has-mega:hover > button { background: var(--c-primary); color: #fff; }
.main-nav .chev { font-size: .65rem; transition: transform .2s; }
.main-nav .has-mega:hover .chev { transform: rotate(180deg); }

/* Mega menu */
.has-mega { position: static; }
.mega-panel {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--c-surface);
  border-top: 3px solid var(--c-primary);
  box-shadow: var(--shadow-lg);
  padding: 1.6rem 0 1.8rem;
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
}
.has-mega:hover .mega-panel, .has-mega:focus-within .mega-panel {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.mega-heading {
  font-size: .8rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--c-primary); border-bottom: 2px solid var(--c-line);
  padding-bottom: .5rem; margin-bottom: .7rem;
}
.mega-links { list-style: none; margin: 0; padding: 0; }
.mega-links a {
  display: flex; align-items: center; gap: .35rem;
  padding: .32rem 0; color: var(--c-text); font-size: .92rem;
  font-family: var(--font-body); border-radius: 0; background: none !important;
}
.mega-links a i { font-size: .6rem; color: var(--c-accent); transition: transform .2s; }
.mega-links a:hover { color: var(--c-primary); }
.mega-links a:hover i { transform: translateX(4px); }

/* ปุ่มเมนูมือถือ — รวม user menu ไว้ในปุ่มเดียว (avatar + hamburger) */
.mobile-menu-btn {
  background: var(--c-primary); color: #fff; border: 0;
  min-width: 44px; height: 44px; border-radius: 999px; font-size: 1.4rem;
  display: inline-flex; align-items: center; justify-content: center;
  gap: .35rem; padding: 0 .6rem; flex-shrink: 0;
}
.mmb-avatar {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.65); flex-shrink: 0;
}
.mmb-avatar-txt {
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; color: var(--c-primary);
  font-family: var(--font-display); font-weight: 600; font-size: .85rem;
}
/* ============ Mobile offcanvas — "แม่น้ำยามค่ำ" ============ */
/* z-index สูงกว่า sticky header (1050/1051) — แก้บั๊กเมนูมุดใต้ header */
.mobile-menu.offcanvas {
  z-index: 2100;
  width: min(330px, 88vw);
  border: 0; border-radius: 22px 0 0 22px;
  color: #e6f3f6;
  background:
    radial-gradient(360px 200px at 100% 0%, rgba(245, 158, 11, 0.22), transparent 65%),
    radial-gradient(300px 300px at 0% 100%, rgba(23, 115, 207, 0.35), transparent 70%),
    linear-gradient(165deg, #082a52 0%, #0c3c72 60%, #0e4a86 100%);
  box-shadow: -18px 0 60px rgba(3, 20, 28, 0.55);
  overflow: hidden;
}
.offcanvas-backdrop { z-index: 2090; }
.offcanvas-backdrop.show { opacity: .62; backdrop-filter: blur(2px); }

/* ประกายคลื่นพื้นหลัง */
.mm-glow {
  position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1.5px);
  background-size: 26px 26px;
  opacity: .5;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 55%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 55%);
}

/* หัวเมนู */
.mm-header {
  position: relative;
  display: flex; align-items: center; gap: .7rem;
  padding: 1.05rem 1.1rem .95rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.mm-brand { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.mm-brand img {
  width: 42px; height: 42px; object-fit: contain; flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}
.mm-brand-text { min-width: 0; line-height: 1.25; }
.mm-brand-text strong {
  display: block; font-family: var(--font-display); font-size: .92rem; color: #fdfaf2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mm-brand-text small {
  color: #8fc2d0; font-size: .66rem; letter-spacing: .05em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}
.mm-close {
  margin-left: auto; flex-shrink: 0;
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12); color: #fdfaf2;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, transform .25s;
}
.mm-close:hover { background: rgba(255, 255, 255, 0.28); transform: rotate(90deg); }

.mm-body { position: relative; padding: 1rem 1rem 1.2rem; display: flex; flex-direction: column; }

/* บัตรผู้ใช้ */
.mm-user {
  display: flex; align-items: center; gap: .65rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px; padding: .7rem .8rem; margin-bottom: 1rem;
  backdrop-filter: blur(4px);
}
.mm-avatar {
  width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.35);
}
.mm-avatar-txt {
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--c-accent), #b45309);
  color: #fff; font-family: var(--font-display); font-weight: 700;
}
.mm-user-info { flex: 1; min-width: 0; line-height: 1.3; }
.mm-user-info strong {
  display: block; font-family: var(--font-display); font-size: .88rem; color: #fdfaf2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mm-user-info small { color: #8fc2d0; font-size: .72rem; }
.mm-user-btn {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: rgba(255, 255, 255, 0.1); color: #cfe9ef;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .85rem; transition: all .2s;
}
.mm-user-btn:hover { background: rgba(255, 255, 255, 0.25); color: #fff; }
.mm-user-btn.danger { color: #fda4af; }
.mm-user-btn.danger:hover { background: rgba(244, 63, 94, 0.25); color: #fecdd3; }

/* ปุ่มเข้าสู่ระบบ (ยังไม่ล็อกอิน) */
.mm-login {
  display: flex; align-items: center; gap: .6rem;
  background: linear-gradient(180deg, #fbbf24, #f59e0b);
  color: #43290a; font-family: var(--font-display); font-weight: 700; font-size: .92rem;
  border-radius: 16px; padding: .85rem 1rem; margin-bottom: 1rem;
  box-shadow: 0 10px 24px rgba(245, 158, 11, 0.35), 0 1px 0 rgba(255, 255, 255, 0.55) inset;
  transition: transform .2s, box-shadow .2s;
}
.mm-login:hover { color: #43290a; transform: translateY(-2px); box-shadow: 0 14px 30px rgba(245, 158, 11, 0.45), 0 1px 0 rgba(255, 255, 255, 0.55) inset; }
.mm-login i:first-child { font-size: 1.25rem; }

/* เมนูหลัก — แถวใหญ่แตะง่าย */
.mm-nav { display: flex; flex-direction: column; gap: .3rem; }
.mm-link {
  display: flex; align-items: center; gap: .75rem;
  min-height: 52px; padding: .55rem .7rem;
  border-radius: 14px; color: #dceef3;
  font-family: var(--font-display); font-weight: 500; font-size: .95rem;
  transition: background .2s, color .2s;
  position: relative;
}
.mm-link:hover, .mm-link:focus-visible { background: rgba(255, 255, 255, 0.08); color: #fff; }
.mm-link.active {
  background: rgba(103, 232, 249, 0.12); color: #a5f3fc;
  box-shadow: inset 3px 0 0 var(--c-accent);
}
.mm-ico {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: rgba(255, 255, 255, 0.1);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.05rem; color: #7dd3e8;
  transition: transform .2s, background .2s;
}
.mm-link:hover .mm-ico { transform: scale(1.08); background: rgba(255, 255, 255, 0.18); }
.mm-link.active .mm-ico { background: rgba(103, 232, 249, 0.2); color: #a5f3fc; }
.mm-chev { margin-left: auto; font-size: .7rem; color: rgba(255, 255, 255, 0.35); transition: transform .2s, color .2s; }
.mm-link:hover .mm-chev { transform: translateX(3px); color: #fff; }

/* หัวข้อกลุ่ม */
.mm-label {
  display: flex; align-items: center; gap: .5rem;
  margin: 1.1rem .2rem .55rem;
  font-family: var(--font-display); font-weight: 600; font-size: .72rem;
  letter-spacing: .12em; color: var(--c-accent-soft);
}
.mm-label span {
  width: 22px; height: 3px; border-radius: 2px; flex-shrink: 0;
  background: linear-gradient(90deg, var(--c-accent), transparent);
}

/* ตารางบริการแบบแอป */
.mm-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .55rem; }
.mm-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .4rem; min-height: 84px; text-align: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px; padding: .7rem .4rem;
  color: #dceef3; font-family: var(--font-display); font-size: .78rem; line-height: 1.3;
  transition: transform .2s, background .2s, border-color .2s;
}
.mm-tile i { font-size: 1.45rem; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3)); }
.mm-tile:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}

/* ท้ายเมนู */
.mm-footer {
  margin-top: auto; padding-top: 1.2rem;
  display: flex; flex-direction: column; gap: .55rem; align-items: center;
}
.mm-call {
  display: inline-flex; align-items: center; gap: .5rem;
  width: 100%; justify-content: center;
  border: 1.5px solid rgba(255, 255, 255, 0.25); border-radius: 999px;
  color: #e6f3f6; font-family: var(--font-display); font-size: .88rem;
  padding: .6rem 1rem; transition: all .2s;
}
.mm-call:hover { border-color: var(--c-accent); color: var(--c-accent-soft); background: rgba(245, 158, 11, 0.1); }
.mm-copy { color: rgba(255, 255, 255, 0.4); font-size: .68rem; text-align: center; }

/* Entrance: ไล่จังหวะรายการตอนเปิดเมนู */
.mobile-menu .mm-item { opacity: 0; transform: translateX(26px); }
.mobile-menu.show .mm-item {
  opacity: 1; transform: none;
  transition: opacity .4s cubic-bezier(.22, 1, .36, 1), transform .4s cubic-bezier(.22, 1, .36, 1);
}
.mobile-menu.show .mm-item:nth-child(1),
.mobile-menu.show .mm-user, .mobile-menu.show .mm-login { transition-delay: .05s; }
.mobile-menu.show .mm-nav .mm-item:nth-child(1) { transition-delay: .1s; }
.mobile-menu.show .mm-nav .mm-item:nth-child(2) { transition-delay: .15s; }
.mobile-menu.show .mm-nav .mm-item:nth-child(3) { transition-delay: .2s; }
.mobile-menu.show .mm-nav .mm-item:nth-child(4) { transition-delay: .25s; }
.mobile-menu.show .mm-label { transition-delay: .3s; }
.mobile-menu.show .mm-grid { transition-delay: .35s; }
.mobile-menu.show .mm-footer { transition-delay: .42s; }
@media (prefers-reduced-motion: reduce) {
  .mobile-menu .mm-item { opacity: 1; transform: none; transition: none; }
}

/* ============ Hero ============ */
.hero {
  position: relative; min-height: min(88vh, 720px);
  display: flex; align-items: center;
  overflow: hidden; color: #123a63;
}
.hero-scene { position: absolute; inset: 0; }
.hero-scene svg { width: 100%; height: 100%; display: block; }
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(240, 247, 255, 0.6) 0%, rgba(240, 247, 255, 0.18) 46%, transparent 72%);
}
.hero-content { position: relative; z-index: 2; padding: 6rem 0 7rem; }
.hero-text { max-width: 640px; }
.hero-eyebrow {
  display: inline-flex; align-items: center;
  background: rgba(255, 255, 255, 0.8); backdrop-filter: blur(6px);
  border: 1px solid rgba(12, 47, 92, 0.14); color: #0c3c72;
  padding: .35rem .9rem; border-radius: 999px; font-size: .85rem;
  box-shadow: 0 2px 8px rgba(13, 60, 114, 0.1);
}
.hero h1 {
  font-size: clamp(1.9rem, 4.5vw, 3.4rem);
  font-weight: 800; margin: .9rem 0 .4rem; color: #0c2f5c;
  text-shadow: 0 1px 12px rgba(255, 255, 255, 0.55);
}
.hero-slogan {
  font-size: clamp(1rem, 2vw, 1.3rem);
  color: #1c4a86; font-family: var(--font-display); font-weight: 500;
  text-shadow: 0 1px 8px rgba(255, 255, 255, 0.5);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1.4rem 0; }
.btn-hero-primary {
  background: var(--c-accent); color: #442c02; font-weight: 600;
  border-radius: 999px; padding: .65rem 1.5rem; border: 0;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
  transition: transform .2s, box-shadow .2s;
}
.btn-hero-primary:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(245, 158, 11, 0.55); color: #442c02; }
.btn-hero-ghost {
  background: rgba(255, 255, 255, 0.85); color: var(--c-primary-deep); font-weight: 600;
  border: 1px solid rgba(12, 47, 92, 0.18);
  border-radius: 999px; padding: .65rem 1.5rem;
  backdrop-filter: blur(6px); transition: all .2s;
}
.btn-hero-ghost:hover { background: #fff; color: var(--c-primary); box-shadow: var(--shadow-sm); }
.hero-search {
  display: flex; align-items: center; max-width: 480px;
  background: rgba(255, 255, 255, 0.95); border-radius: 999px;
  padding: .3rem .4rem .3rem 1.1rem; box-shadow: var(--shadow-md);
}
.hero-search i { color: var(--c-muted); }
.hero-search input {
  flex: 1; border: 0; outline: 0; background: none;
  padding: .5rem .8rem; font-size: .95rem; min-width: 0;
}
.hero-search button {
  background: var(--c-primary); color: #fff; border: 0;
  border-radius: 999px; padding: .5rem 1.3rem; font-family: var(--font-display);
  transition: background .2s;
}
.hero-search button:hover { background: var(--c-primary-deep); }
.hero-scroll-hint {
  position: absolute; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
  z-index: 2; display: flex; flex-direction: column; align-items: center;
  color: rgba(12, 47, 92, 0.55); font-size: .75rem; gap: .1rem;
  animation: bob 2.2s ease-in-out infinite;
}
.hero-scroll-hint i { font-size: 1.2rem; }
@keyframes bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 8px); } }

/* ============ Quick services ============ */
.quick-services { margin-top: -3.4rem; position: relative; z-index: 3; padding-bottom: 1rem; }
.qs-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 991px) { .qs-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 479px) { .qs-grid { grid-template-columns: 1fr 1fr; gap: .7rem; } }
.qs-card {
  position: relative; display: flex; flex-direction: column; gap: .15rem;
  background: var(--c-surface); border-radius: var(--radius);
  padding: 1.1rem 1.2rem 1rem; color: var(--c-text);
  box-shadow: var(--shadow-sm); border: 1px solid var(--c-line);
  overflow: hidden; transition: transform .25s ease, box-shadow .25s ease;
}
.qs-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); color: var(--c-text); }
.qs-icon {
  width: 46px; height: 46px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem; color: #fff; margin-bottom: .5rem;
  transition: transform .25s ease;
}
.qs-card:hover .qs-icon { transform: scale(1.12) rotate(-6deg); }
.qs-label { font-family: var(--font-display); font-weight: 600; font-size: .95rem; }
.qs-desc { font-size: .78rem; color: var(--c-muted); }
.qs-arrow {
  position: absolute; right: .9rem; top: .9rem; color: var(--c-line);
  transition: color .2s, transform .2s;
}
.qs-card:hover .qs-arrow { color: var(--c-primary); transform: translateX(3px); }
.qs-rose .qs-icon { background: linear-gradient(135deg, #f43f5e, #be123c); }
.qs-amber .qs-icon { background: linear-gradient(135deg, #f59e0b, #b45309); }
.qs-teal .qs-icon { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.qs-violet .qs-icon { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.qs-blue .qs-icon { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.qs-green .qs-icon { background: linear-gradient(135deg, #22c55e, #15803d); }
.qs-cyan .qs-icon { background: linear-gradient(135deg, #06b6d4, #1773cf); }
.qs-orange .qs-icon { background: linear-gradient(135deg, #fb923c, #c2410c); }

/* ============ Sections ============ */
.section { padding: 3.5rem 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: .5rem; margin-bottom: 1.6rem;
}
.section-title {
  font-size: clamp(1.35rem, 2.6vw, 1.8rem); font-weight: 700; color: var(--c-dark);
  display: flex; align-items: center; gap: .55rem; margin: 0;
}
.section-title i { color: var(--c-accent); font-size: .9em; }
.section-sub { color: var(--c-muted); font-size: .92rem; }
.section-head.light .section-title, .section-head.light .section-sub { color: #fff; }
.section-more {
  color: var(--c-primary); font-family: var(--font-display); font-weight: 500; font-size: .92rem;
}
.section-more i { transition: transform .2s; }
.section-more:hover i { transform: translateX(4px); }
.section-more.light { color: var(--c-accent-soft); }

/* ============ Featured news ============ */
.featured-swiper { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-md); }
.featured-card { display: block; position: relative; color: #fff; }
.featured-card img { width: 100%; height: 420px; object-fit: cover; display: block; }
.featured-card-body {
  position: absolute; inset: auto 0 0 0; padding: 2.2rem 1.6rem 2.6rem;
  background: linear-gradient(transparent, rgba(8, 42, 82, 0.92));
}
.featured-card h3 { font-size: 1.25rem; font-weight: 600; margin: .55rem 0 .35rem; color: #fff; }
.featured-card p { color: #e2e8f0; font-size: .9rem; margin: 0 0 .5rem; }
.featured-meta { font-size: .8rem; color: #cbd5e1; }
.badge-type {
  display: inline-block; background: var(--c-accent); color: #442c02;
  font-size: .72rem; font-weight: 600; font-family: var(--font-display);
  padding: .2rem .65rem; border-radius: 999px;
}
.featured-swiper .swiper-pagination-bullet { background: #fff; opacity: .5; }
.featured-swiper .swiper-pagination-bullet-active { opacity: 1; background: var(--c-accent); }

/* ============ Executives ============ */
.exec-stack { display: flex; flex-direction: column; gap: 1rem; height: 100%; }
.exec-card {
  display: flex; gap: .9rem; align-items: flex-start;
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm);
}
.exec-avatar {
  flex: 0 0 56px; width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c-primary), var(--c-dark));
  color: #fff; font-size: 1.7rem;
  display: flex; align-items: center; justify-content: center;
}
.exec-card strong { display: block; font-family: var(--font-display); font-size: .95rem; color: var(--c-dark); }
.exec-pos { display: block; color: var(--c-primary); font-size: .8rem; font-weight: 600; margin-top: .1rem; }
.exec-quote { font-size: .84rem; color: var(--c-muted); margin: .45rem 0 0; }
.exec-more {
  margin-top: auto; text-align: center; display: block;
  background: var(--c-bg); border: 1px dashed var(--c-primary);
  color: var(--c-primary); border-radius: var(--radius);
  padding: .7rem; font-family: var(--font-display); font-size: .9rem;
  transition: all .2s;
}
.exec-more:hover { background: var(--c-primary); color: #fff; border-style: solid; }

/* ============ Stats band ============ */
.stats-band {
  background:
    radial-gradient(1100px 380px at 85% -50%, rgba(255, 255, 255, 0.5), transparent),
    linear-gradient(120deg, #A4BBF5, #94aef2);
  color: #274a7a; padding: 3.2rem 0;
  position: relative; overflow: hidden;
}
.stat-item { display: flex; flex-direction: column; align-items: center; gap: .15rem; }
.stat-icon { font-size: 1.9rem; color: #c2740a; margin-bottom: .35rem; }
.stat-value { font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; line-height: 1; color: #0c2f5c; }
.stat-suffix { font-family: var(--font-display); font-size: 1rem; color: #2c4f80; }
.stat-label { color: #2c4f80; font-size: .9rem; margin-top: .25rem; }

/* ============ News hub ============ */
.news-tabs { gap: .4rem; border: 0; flex-wrap: wrap; }
.news-tabs .nav-link {
  border: 1px solid var(--c-line); border-radius: 999px;
  color: var(--c-muted); font-weight: 500; font-size: .9rem;
  padding: .45rem 1rem; background: var(--c-surface);
}
.news-tabs .nav-link.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.news-tab-content { margin-top: 1.1rem; }
.news-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.news-list a {
  display: flex; align-items: center; gap: .95rem;
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--radius-sm); padding: .75rem .95rem;
  color: var(--c-text); transition: all .2s;
}
.news-list a:hover { border-color: var(--c-primary); box-shadow: var(--shadow-sm); transform: translateX(4px); }
.news-date-chip {
  flex: 0 0 58px; text-align: center;
  background: var(--c-bg); border-radius: var(--radius-sm);
  padding: .35rem .2rem; line-height: 1.15;
}
.news-date-chip strong { display: block; font-family: var(--font-display); font-size: 1.2rem; color: var(--c-primary); }
.news-date-chip small { font-size: .68rem; color: var(--c-muted); }
.news-list-body { min-width: 0; }
.news-list-title {
  display: block; font-weight: 500; font-size: .95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.news-list-meta { font-size: .76rem; color: var(--c-muted); }
.news-go { margin-left: auto; color: var(--c-line); transition: color .2s; }
.news-list a:hover .news-go { color: var(--c-primary); }
.news-list.compact .news-list-title { white-space: normal; font-size: .88rem; }

/* ============ Event panel ============ */
.event-panel {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow-sm);
  height: 100%; display: flex; flex-direction: column;
}
.event-panel-title { font-size: 1.05rem; font-weight: 600; color: var(--c-dark); margin-bottom: 1rem; }
.event-list { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .8rem; }
.event-list li { display: flex; gap: .8rem; align-items: flex-start; }
.event-date {
  flex: 0 0 52px; text-align: center;
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-deep));
  color: #fff; border-radius: var(--radius-sm); padding: .35rem .2rem; line-height: 1.15;
}
.event-date strong { display: block; font-family: var(--font-display); font-size: 1.15rem; }
.event-date small { font-size: .66rem; opacity: .85; }
.event-title { display: block; font-weight: 500; font-size: .9rem; line-height: 1.35; }
.event-meta { display: block; font-size: .76rem; color: var(--c-muted); margin-top: .15rem; }
.btn-event-all {
  margin-top: auto; background: var(--c-dark); color: #fff; border-radius: 999px;
  font-family: var(--font-display); font-size: .9rem; padding: .6rem 1rem;
  text-align: center; transition: background .2s;
}
.btn-event-all:hover { background: var(--c-primary); color: #fff; }
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-list a { display: block; padding: .45rem .2rem; color: var(--c-text); border-bottom: 1px dashed var(--c-line); }
.toc-list a:hover { color: var(--c-primary); }

/* ============ Gallery ============ */
.gallery-section { background: var(--c-surface); }
.gallery-swiper { padding: 0 3rem 1rem; }
.gallery-card { display: block; position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.gallery-card img { width: 100%; height: 250px; object-fit: cover; transition: transform .4s ease; display: block; }
.gallery-card:hover img { transform: scale(1.06); }
.gallery-caption {
  position: absolute; inset: auto 0 0 0; color: #fff;
  background: linear-gradient(transparent, rgba(8, 42, 82, 0.9));
  padding: 1.6rem .9rem .7rem; line-height: 1.3;
}
.gallery-caption strong { display: block; font-size: .85rem; font-weight: 500; }
.gallery-caption small { font-size: .72rem; opacity: .8; }
.gallery-swiper .swiper-button-prev, .gallery-swiper .swiper-button-next {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--c-surface); box-shadow: var(--shadow-md); color: var(--c-primary);
}
.gallery-swiper .swiper-button-prev::after, .gallery-swiper .swiper-button-next::after { font-size: 1rem; font-weight: 700; }

/* ============ Dashboard / charts ============ */
.dashboard-section { background: var(--c-bg); }
.chart-card {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--radius); padding: 1.2rem 1.2rem 1rem;
  box-shadow: var(--shadow-sm); height: 100%;
}
.chart-card h3 { font-size: .98rem; font-weight: 600; color: var(--c-dark); margin-bottom: .8rem; }
.chart-holder { position: relative; height: 230px; }

/* ============ Travel ============ */
.travel-section { position: relative; overflow: hidden; }
.travel-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(900px 300px at 15% 0%, rgba(245, 158, 11, 0.18), transparent),
    linear-gradient(160deg, var(--c-primary-deep), var(--c-darker));
}
.travel-section .container { position: relative; }
.travel-swiper { padding-bottom: 2.4rem; }
.travel-card {
  display: block; position: relative; border-radius: var(--radius);
  overflow: hidden; height: 380px; box-shadow: var(--shadow-md);
}
.travel-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.travel-card:hover img { transform: scale(1.08); }
.travel-card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(transparent 40%, rgba(8, 42, 82, 0.95));
}
.travel-card-body {
  position: absolute; inset: auto 0 0 0; padding: 1.1rem; color: #fff;
  transform: translateY(8px); transition: transform .3s;
}
.travel-card:hover .travel-card-body { transform: translateY(0); }
.travel-card-body strong { display: block; font-family: var(--font-display); font-size: 1.1rem; }
.travel-card-body small { color: #cbd5e1; font-size: .8rem; }
.travel-swiper .swiper-pagination-bullet { background: #fff; opacity: .4; }
.travel-swiper .swiper-pagination-bullet-active { opacity: 1; background: var(--c-accent); }

/* ============ Links band ============ */
.links-band { background: var(--c-surface); padding: 2.2rem 0; border-top: 1px solid var(--c-line); }
.link-chip {
  display: flex; align-items: center; gap: .45rem; height: 100%;
  background: var(--c-bg); border: 1px solid var(--c-line);
  border-radius: var(--radius-sm); padding: .7rem .9rem;
  color: var(--c-text); font-size: .82rem; line-height: 1.25;
  transition: all .2s;
}
.link-chip i { color: var(--c-primary); font-size: 1.1rem; }
.link-chip:hover { border-color: var(--c-primary); color: var(--c-primary); transform: translateY(-3px); box-shadow: var(--shadow-sm); }

/* ============ Footer ============ */
.site-footer { margin-top: 0; }
/* ซ่อน footer ใหญ่บน tablet & mobile — มี app-tabbar และเมนู offcanvas แทนอยู่แล้ว */
@media (max-width: 991.98px) {
  .site-footer { display: none; }
}
.footer-wave { line-height: 0; background: var(--c-surface); }
.footer-wave svg { width: 100%; height: 70px; display: block; }
.footer-wave svg path { fill: #A4BBF5; }
.footer-body { background: #A4BBF5; color: #274a7a; padding: 2.6rem 0 0; }
.footer-title { color: #0c2f5c; font-weight: 600; font-size: 1.05rem; }
.footer-text { font-size: .88rem; }
.footer-heading { color: #0f3d78; font-size: .85rem; letter-spacing: .05em; margin-bottom: .8rem; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links a { display: block; color: #2c4f80; font-size: .86rem; padding: .22rem 0; transition: color .2s, padding-left .2s; }
.footer-links a:hover { color: #0c2f5c; padding-left: .3rem; }
.footer-contact { list-style: none; margin: 0; padding: 0; font-size: .86rem; }
.footer-contact li { padding: .18rem 0; }
.footer-contact i { color: var(--c-accent); margin-right: .4rem; }
.footer-contact.dark { color: var(--c-text); }
.footer-contact.dark i { color: var(--c-primary); }
.footer-social { display: flex; gap: .5rem; margin-top: .8rem; }
.footer-social a {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(12, 47, 92, 0.1); color: #0c2f5c;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .2s, transform .2s;
}
.footer-social a:hover { background: var(--c-accent); color: #442c02; transform: translateY(-3px); }
.footer-bottom {
  border-top: 1px solid rgba(12, 47, 92, 0.15);
  margin-top: 2rem; padding: .9rem 0; font-size: .78rem; color: #3f5f8a;
}

/* ============ Back to top ============ */
.back-to-top {
  position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 1040;
  width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: var(--c-primary); color: #fff; font-size: 1.2rem;
  box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: all .3s ease;
}
.back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--c-accent); color: #442c02; }

/* ============ Inner pages ============ */
.page-hero {
  background:
    radial-gradient(800px 300px at 90% -80%, rgba(245, 158, 11, 0.3), transparent),
    linear-gradient(120deg, var(--c-dark), var(--c-primary));
  color: #fff; padding: 2.6rem 0 2.2rem;
}
.page-hero .breadcrumb { margin-bottom: .4rem; --bs-breadcrumb-divider-color: rgba(255,255,255,.5); }
.page-hero .breadcrumb-item a { color: rgba(255, 255, 255, 0.75); }
.page-hero .breadcrumb-item.active { color: #fff; }
.page-title { font-size: clamp(1.5rem, 3.4vw, 2.2rem); font-weight: 700; margin: 0; }
.page-subtitle { color: var(--c-accent-soft); margin: .4rem 0 0; }
.article-title { font-size: clamp(1.25rem, 2.6vw, 1.7rem); line-height: 1.4; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem; margin-top: .8rem; font-size: .85rem; color: #cbd5e1; }

.article-body {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow-sm);
  line-height: 1.85;
}
.article-body h2 { font-size: 1.25rem; color: var(--c-dark); margin: 1.6rem 0 .7rem; }
.article-body h2:first-child { margin-top: 0; }
.article-cover { width: 100%; border-radius: var(--radius-sm); margin-bottom: 1.2rem; }
.vision-quote {
  border-left: 4px solid var(--c-accent); background: var(--c-bg);
  padding: 1rem 1.2rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-display); font-size: 1.1rem; color: var(--c-primary-deep);
}
.article-share { display: flex; align-items: center; gap: .5rem; margin-top: 1.4rem; font-size: .88rem; color: var(--c-muted); }
.article-share a, .article-share button {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--c-line);
  background: var(--c-bg); color: var(--c-primary);
  display: inline-flex; align-items: center; justify-content: center; transition: all .2s;
}
.article-share a:hover, .article-share button:hover { background: var(--c-primary); color: #fff; }

.filter-chip {
  display: inline-flex; align-items: center;
  border: 1px solid var(--c-line); background: var(--c-surface);
  color: var(--c-muted); border-radius: 999px; padding: .4rem 1rem;
  font-family: var(--font-display); font-size: .88rem; transition: all .2s;
}
.filter-chip:hover { border-color: var(--c-primary); color: var(--c-primary); }
.filter-chip.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.news-search {
  display: flex; align-items: center; gap: .5rem;
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: 999px; padding: .35rem .9rem;
}
.news-search input { border: 0; outline: 0; background: none; font-size: .9rem; width: 170px; }
.news-search i { color: var(--c-muted); }

.news-card {
  display: flex; flex-direction: column; height: 100%;
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--radius); overflow: hidden; color: var(--c-text);
  box-shadow: var(--shadow-sm); transition: transform .25s, box-shadow .25s;
}
.news-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); color: var(--c-text); }
.news-card img { height: 185px; object-fit: cover; }
.news-card-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .45rem; }
.news-card h3 { font-size: 1rem; font-weight: 600; line-height: 1.45; margin: 0; }
.news-card p { font-size: .85rem; color: var(--c-muted); margin: 0; }
.news-card .featured-meta { color: var(--c-muted); margin-top: auto; }

.travel-detail-card {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--radius); overflow: hidden; height: 100%;
  box-shadow: var(--shadow-sm); transition: transform .25s, box-shadow .25s;
}
.travel-detail-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }
.travel-detail-card img { width: 100%; height: 210px; object-fit: cover; }
.travel-detail-body { padding: 1.1rem 1.2rem 1.3rem; }
.travel-detail-body h3 { font-size: 1.1rem; font-weight: 600; color: var(--c-dark); }
.travel-detail-body p { font-size: .88rem; color: var(--c-muted); margin: 0; }

.contact-card {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-sm); height: 100%;
}
.contact-card h3 { font-size: 1.1rem; color: var(--c-dark); }
.map-holder { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-md); height: 100%; min-height: 380px; }
.map-holder iframe { width: 100%; height: 100%; min-height: 380px; border: 0; }

.empty-state { text-align: center; color: var(--c-muted); padding: 3rem 1rem; }
.empty-state i { font-size: 3rem; color: var(--c-line); }
.empty-state.big { padding: 5rem 1rem; }
.empty-state.big i { font-size: 4.5rem; color: var(--c-primary); opacity: .35; }

/* ============ Responsive tweaks ============ */
@media (max-width: 991px) {
  .hero { min-height: 78vh; }
  .featured-card img { height: 340px; }
  .gallery-swiper { padding: 0 1rem 1rem; }
}
@media (max-width: 575px) {
  .hero-content { padding: 4.5rem 0 6rem; }
  .brand-text strong { font-size: .9rem; white-space: normal; line-height: 1.2; }
  .brand-text small { display: none; }
  .featured-card img { height: 300px; }
  .featured-card-body { padding: 1.4rem 1rem 2rem; }
  .travel-card { height: 320px; }
  .qs-card { padding: .85rem .9rem .8rem; }
  .qs-desc { display: none; }
  .section { padding: 2.4rem 0; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-scroll-hint { animation: none; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ============================================================
   main-app additions — topbar user menu + DB highlight slider
   ============================================================ */

/* Topbar user menu (login state) */
.topbar-user { position: relative; }
.topbar-user-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  background: transparent; border: 0; color: #274a7a; font-size: .85rem;
  padding: .1rem .3rem;
}
.topbar-user-btn:hover { color: #0c2f5c; }
.topbar-user-btn img, .topbar-avatar {
  width: 22px; height: 22px; border-radius: 50%; object-fit: cover;
  background: var(--c-primary); color: #fff; font-size: .7rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.topbar-dropdown {
  position: absolute; right: 0; top: calc(100% + .55rem); z-index: 2000;
  min-width: 230px; background: var(--c-surface); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); border: 1px solid var(--c-line);
  padding: .5rem; display: none;
}
.topbar-dropdown.show { display: block; }
.topbar-dropdown-header {
  display: flex; gap: .6rem; align-items: center;
  padding: .55rem .6rem; border-bottom: 1px solid var(--c-line); margin-bottom: .35rem;
}
.topbar-dropdown-header img, .topbar-dropdown-header .topbar-avatar {
  width: 38px; height: 38px; font-size: 1rem;
}
.topbar-dropdown-header strong { display: block; font-size: .9rem; color: var(--c-dark); line-height: 1.2; }
.topbar-dropdown-header small { color: var(--c-muted); font-size: .75rem; }
.topbar-dropdown-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .5rem .6rem; border-radius: 8px; color: var(--c-text); font-size: .88rem;
}
.topbar-dropdown-item:hover { background: var(--c-bg); color: var(--c-primary); }
.topbar-dropdown-item.danger { color: #dc2626; }
.topbar-dropdown-item.danger:hover { background: #fef2f2; color: #b91c1c; }

/* Highlight slider (site_image_slider from DB) */
.highlight-section { padding: 2.6rem 0 0; }
.highlight-swiper { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-md); }
.highlight-slide {
  display: block; position: relative; min-height: 320px;
  display: flex; align-items: center; color: #fff;
  background-size: cover; background-position: center;
}
.highlight-slide .hl-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(8, 42, 82, 0.72), rgba(8, 42, 82, 0.15));
}
.highlight-slide.align-right .hl-overlay {
  background: linear-gradient(270deg, rgba(8, 42, 82, 0.72), rgba(8, 42, 82, 0.15));
}
.hl-text { position: relative; z-index: 1; padding: 2.6rem; max-width: 620px; }
.highlight-slide.align-center { text-align: center; justify-content: center; }
.highlight-slide.align-right { justify-content: flex-end; text-align: right; }
.hl-badge {
  display: inline-block; padding: .25rem .8rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600; font-family: var(--font-display);
  margin-bottom: .7rem; color: #fff;
}
.hl-text h3 { font-size: clamp(1.3rem, 3vw, 2rem); font-weight: 700; text-shadow: 0 3px 16px rgba(0,0,0,.35); }
.hl-text p { color: #e2e8f0; font-size: .95rem; margin: .4rem 0 0; }
.highlight-swiper .swiper-pagination-bullet { background: #fff; opacity: .5; }
.highlight-swiper .swiper-pagination-bullet-active { opacity: 1; background: var(--c-accent); }
@media (max-width: 575px) {
  .highlight-slide { min-height: 240px; }
  .hl-text { padding: 1.6rem 1.2rem; }
}

/* News pinned marker on card */
.news-pin {
  position: absolute; top: .7rem; left: .7rem; z-index: 1;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--c-accent); color: #442c02;
  display: flex; align-items: center; justify-content: center; font-size: .85rem;
  box-shadow: var(--shadow-sm);
}
.news-card { position: relative; }
.news-card .news-cover {
  height: 185px; background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.85); font-size: 2.4rem;
}

/* ============================================================
   v2 additions — news list / calendar pages
   ============================================================ */
.v2-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
  margin-bottom: 1.4rem;
}
.v2-toolbar .news-search { flex: 1 1 260px; max-width: 420px; }
.v2-toolbar .news-search input { width: 100%; }
.search-clear { border: 0; background: none; color: var(--c-muted); padding: 0 .2rem; }
.search-clear:hover { color: var(--c-primary); }

.news-grid-v2 {
  display: grid; gap: 1.4rem;
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 991px) { .news-grid-v2 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 575px) { .news-grid-v2 { grid-template-columns: 1fr; } }
.news-grid-v2 .news-card { animation: v2FadeUp .5s ease-out both; }
@keyframes v2FadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.results-info { color: var(--c-muted); font-size: .85rem; margin-bottom: 1rem; }
.loading-indicator {
  display: flex; align-items: center; justify-content: center; gap: .7rem;
  color: var(--c-muted); padding: 1.6rem 0;
}
.load-more-container { display: flex; justify-content: center; padding: 1.4rem 0; }
.btn-load-more {
  background: var(--c-surface); border: 1px solid var(--c-primary);
  color: var(--c-primary); border-radius: 999px; padding: .6rem 1.6rem;
  font-family: var(--font-display); transition: all .2s;
}
.btn-load-more:hover { background: var(--c-primary); color: #fff; }
.end-results {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  color: var(--c-muted); font-size: .88rem; padding: 1.4rem 0;
}
.end-results i { color: #22c55e; }

/* ============ แผนและเทศบัญญัติ — ชั้นวางหนังสือ (Bookshelf) ============ */
.docs-section { padding: 3.5rem 0 4rem; }

.docs-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
  margin-bottom: 1.4rem;
}
.docs-tabs { display: flex; flex-wrap: wrap; gap: .5rem; }
.docs-tab {
  border: 1.5px solid var(--c-line); background: var(--c-surface);
  color: var(--c-muted); font-family: var(--font-display); font-weight: 500;
  font-size: .9rem; border-radius: 999px; padding: .42rem 1.1rem;
  cursor: pointer; transition: all .2s;
}
.docs-tab:hover { border-color: var(--c-primary); color: var(--c-primary); }
.docs-tab.active {
  background: var(--c-primary); border-color: var(--c-primary); color: #fff;
  box-shadow: 0 4px 14px rgba(23, 115, 207, 0.3);
}
.docs-tab-count {
  display: inline-block; margin-left: .45rem;
  min-width: 1.5em; text-align: center;
  background: var(--c-bg); color: var(--c-muted);
  border-radius: 999px; font-size: .72rem; font-weight: 600;
  padding: .08rem .42rem; line-height: 1.4;
  transition: all .2s;
}
.docs-tab:hover .docs-tab-count { background: #e0f4f8; color: var(--c-primary); }
.docs-tab.active .docs-tab-count {
  background: rgba(255, 255, 255, 0.22); color: #fff;
}
.docs-search {
  display: flex; align-items: center; gap: .5rem; margin-left: auto;
  background: var(--c-surface); border: 1.5px solid var(--c-line);
  border-radius: 999px; padding: .42rem 1rem; min-width: 220px; flex: 0 1 280px;
}
.docs-search i { color: var(--c-muted); }
.docs-search input {
  border: 0; outline: 0; background: none; flex: 1; min-width: 0;
  font-size: .92rem; color: var(--c-text);
}

/* ---- ตู้หนังสือ (กรอบไม้) ---- */
.bookcase {
  position: relative;
  background: linear-gradient(180deg, #8a5a30 0%, #6f4522 100%);
  border-radius: 18px; padding: 14px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* ---- Kebab menu จัดการเอกสาร (มุมขวาบนของตู้) ---- */
.bookcase-kebab { position: absolute; top: 22px; right: 22px; z-index: 6; }
.bookcase-kebab-btn {
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: rgba(30, 15, 2, 0.55); color: #fbeed9; font-size: 1.05rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s, transform .15s;
  box-shadow: 0 2px 8px rgba(30, 15, 2, 0.4);
  backdrop-filter: blur(2px);
}
.bookcase-kebab-btn:hover { background: rgba(30, 15, 2, 0.8); transform: scale(1.06); }
.bookcase-kebab-menu {
  border: 0; border-radius: 12px; box-shadow: var(--shadow-md);
  font-family: var(--font-body); font-size: .9rem; padding: .4rem;
  min-width: 220px;
}
.bookcase-kebab-menu .dropdown-item {
  border-radius: 8px; padding: .5rem .8rem; color: var(--c-text);
}
.bookcase-kebab-menu .dropdown-item:hover { background: var(--c-bg); color: var(--c-primary); }
.bookcase-kebab-menu .dropdown-item i { color: var(--c-primary); }
@media (max-width: 575px) {
  .bookcase-kebab { top: 16px; right: 16px; }
  .bookcase-kebab-btn { width: 32px; height: 32px; }
}

/* Kebab menu ลอยบน highlight slider */
.highlight-kebab {
  position: absolute; top: 12px; right: 24px; z-index: 20;
}
@media (max-width: 575px) {
  .highlight-kebab { top: 8px; right: 18px; }
}

/* Kebab menu ของ section ทั่วไป (พื้นสว่าง เช่น หัวข้อข่าว) */
.section-kebab-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--c-line); background: var(--c-surface);
  color: var(--c-muted); font-size: .95rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s;
}
.section-kebab-btn:hover {
  border-color: var(--c-primary); color: var(--c-primary);
  box-shadow: var(--shadow-sm);
}
.bookcase-inner {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.16) 0%, rgba(0, 0, 0, 0) 5%, rgba(0, 0, 0, 0) 95%, rgba(0, 0, 0, 0.16) 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 3px, rgba(0, 0, 0, 0.03) 3px 6px),
    linear-gradient(180deg, #c69a67 0%, #b38552 100%);
  border-radius: 10px;
  box-shadow: inset 0 4px 18px rgba(46, 26, 8, 0.5);
  overflow: hidden;
}

/* ---- ชั้นวาง: grid + ไม้กระดานต่อเนื่องใต้แต่ละแถว ---- */
.shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 0;
}
.book-slot {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 1.6rem .8rem 34px;
  min-height: 240px;
}
.book-slot.docs-hidden { display: none; }
/* ไม้กระดานชั้นวาง — ต่อเนื่องกันทุกช่องในแถว */
.book-slot::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 30px;
  background: linear-gradient(180deg, #a9743f 0%, #8a5a30 55%, #6f4522 100%);
  box-shadow: inset 0 2px 0 rgba(255, 244, 224, 0.35), inset 0 -3px 5px rgba(43, 24, 7, 0.45);
}
/* เงาใต้เล่มบนพื้นชั้น */
.book-slot::before {
  content: ''; position: absolute; left: 14%; right: 14%; bottom: 27px; height: 10px;
  background: radial-gradient(ellipse at center, rgba(30, 15, 2, 0.4) 0%, rgba(30, 15, 2, 0) 70%);
  z-index: 0;
}

/* ---- ตัวเล่มเอกสาร ---- */
.doc-book {
  position: relative; z-index: 1; width: 100%; max-width: 138px;
  aspect-ratio: 210 / 297;
  border: 0; padding: 0; cursor: pointer; overflow: hidden;
  border-radius: 3px 7px 7px 3px;
  background: #fff;
  box-shadow: 3px 4px 10px rgba(38, 20, 4, 0.45), 6px 0 8px -5px rgba(38, 20, 4, 0.3);
  transform-origin: bottom center;
  transition: transform .25s ease, box-shadow .25s ease;
}
.doc-book:hover, .doc-book:focus-visible {
  transform: translateY(-10px) rotate(-1.5deg) scale(1.03);
  box-shadow: 5px 14px 22px rgba(38, 20, 4, 0.5);
  outline: none;
}
.doc-book img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
/* สันหนังสือ + เงาขอบ */
.doc-book::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(90deg,
    rgba(0, 0, 0, 0.28) 0%, rgba(255, 255, 255, 0.22) 2.5%,
    rgba(0, 0, 0, 0.12) 5%, rgba(0, 0, 0, 0) 9%,
    rgba(0, 0, 0, 0) 94%, rgba(0, 0, 0, 0.1) 100%);
  border-radius: inherit;
}
/* ปกสำรองเมื่อไม่มีภาพหน้าแรก */
.book-fallback {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: .7rem .6rem .55rem .8rem; text-align: left;
  color: #fff;
}
.book-fallback.type-plan { background: linear-gradient(160deg, #1773cf 0%, #0c3c72 100%); }
.book-fallback.type-ordinance { background: linear-gradient(160deg, #b45309 0%, #7c2d12 100%); }
.book-fallback i { font-size: 1.3rem; opacity: .9; }
.book-fallback .bf-title {
  font-family: var(--font-display); font-weight: 600; font-size: .72rem; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.book-fallback .bf-org { font-size: .58rem; opacity: .75; }
/* ป้ายปีงบประมาณ */
.book-year {
  position: absolute; top: 7px; right: -1px; z-index: 2;
  background: var(--c-accent); color: #442c02;
  font-family: var(--font-display); font-weight: 600; font-size: .62rem;
  padding: .14rem .5rem .14rem .6rem; border-radius: 999px 0 0 999px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}
/* ชื่อเรื่องบนขอบไม้กระดาน */
.book-caption {
  position: absolute; left: 6px; right: 6px; bottom: 0; height: 30px; z-index: 1;
  color: #fbeed9; font-size: .7rem; text-shadow: 0 1px 2px rgba(43, 24, 7, 0.8);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
  line-height: 30px; text-align: center; pointer-events: none;
}

/* ---- ชั้นว่าง / ไม่พบผลลัพธ์ ---- */
.docs-empty {
  grid-column: 1 / -1; text-align: center; color: #fdf3e3;
  padding: 3rem 1rem 44px; text-shadow: 0 1px 3px rgba(43, 24, 7, 0.6);
}
.docs-empty i { font-size: 2.2rem; display: block; margin-bottom: .5rem; opacity: .85; }

/* ---- Modal รายละเอียดเอกสาร — "บัตรยืมหนังสือริมมูล" ---- */
.doc-m .modal-dialog { max-width: 500px; }
.doc-m-card {
  border: 0; border-radius: 22px; overflow: hidden;
  background:
    repeating-linear-gradient(0deg, rgba(13, 60, 114, 0.022) 0 1px, transparent 1px 28px),
    #fdfaf2;
  box-shadow: 0 30px 80px rgba(4, 26, 37, 0.45);
}

/* แถบแม่น้ำด้านบน */
.doc-m-band {
  position: relative;
  background:
    radial-gradient(320px 90px at 88% -20%, rgba(245, 158, 11, 0.4), transparent),
    linear-gradient(115deg, #082a52 0%, #0c3c72 55%, #1773cf 100%);
  padding: 1.05rem 1.4rem 2rem;
}
.doc-m-band::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1.6px);
  background-size: 22px 22px;
  opacity: .35;
  pointer-events: none;
}
.doc-m-wave {
  position: absolute; left: 0; right: 0; bottom: -1px;
  width: 100%; height: 16px; display: block;
}
.doc-m-title {
  position: relative; margin: 0;
  font-family: var(--font-display); font-size: 1rem; font-weight: 600;
  color: #fdfaf2; letter-spacing: .01em;
  display: flex; align-items: center; gap: .5rem;
}
.doc-m-title i { color: var(--c-accent-soft); font-size: 1.05rem; }
.doc-m-close {
  position: absolute; top: .85rem; right: .95rem; z-index: 1;
  width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.14); color: #fdfaf2;
  display: flex; align-items: center; justify-content: center; font-size: .8rem;
  transition: background .2s, transform .2s;
}
.doc-m-close:hover { background: rgba(255, 255, 255, 0.3); transform: rotate(90deg); }

.doc-m-body { padding: 0 1.4rem .35rem; }

/* ปกหนังสือลอยซ้อนแถบแม่น้ำ */
.doc-m-head {
  display: flex; gap: 1.1rem; align-items: flex-start;
  margin-top: -1.35rem; position: relative;
}
.doc-modal-cover {
  width: 118px; aspect-ratio: 210 / 297; object-fit: cover; flex-shrink: 0;
  border-radius: 3px 9px 9px 3px;
  transform: rotate(-2.5deg) translateY(-14px);
  box-shadow:
    -1px 0 0 rgba(255, 255, 255, 0.55) inset,
    3px 3px 0 #fff,
    5px 5px 0 #e9dfc9,
    0 18px 34px rgba(13, 60, 114, 0.35);
  transition: transform .35s cubic-bezier(.22, 1, .36, 1);
}
.doc-modal-cover:hover { transform: rotate(0deg) translateY(-18px) scale(1.02); }
.doc-m-info { flex: 1; min-width: 0; padding-top: .45rem; }
.doc-m-badges { margin-bottom: .45rem; }
.doc-modal-badge {
  display: inline-block; font-family: var(--font-display);
  font-size: .72rem; font-weight: 600; letter-spacing: .02em;
  border-radius: 6px; padding: .18rem .6rem; margin-right: .3rem;
  border: 1px dashed currentColor;
}
.doc-modal-badge.type-plan { background: #ecfeff; color: #1773cf; }
.doc-modal-badge.type-ordinance { background: #fff7ed; color: #b45309; }
.doc-modal-badge.year { background: #fefce8; color: #a16207; }
.doc-m-name {
  font-family: var(--font-display); font-weight: 700; font-size: 1.02rem;
  line-height: 1.5; color: #123647; margin: 0 0 .3rem;
}
.doc-m-desc { color: var(--c-muted); font-size: .84rem; margin: 0 0 .5rem; }
.doc-m-meta { display: flex; flex-wrap: wrap; gap: .4rem; }
.doc-m-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  background: #fff; border: 1px solid #ece4d2; border-radius: 999px;
  color: #5d6b74; font-size: .74rem; padding: .16rem .6rem;
  box-shadow: 0 1px 2px rgba(13, 60, 114, 0.06);
}
.doc-m-chip i { color: var(--c-primary); font-size: .78rem; }

/* ตั๋วแชร์ QR แบบตั๋วฉีก */
.doc-share-box {
  position: relative; display: flex; align-items: stretch;
  margin: 1.05rem 0 .25rem;
  background: #fff; border: 1px solid #ece4d2; border-radius: 14px;
  box-shadow: 0 4px 14px rgba(13, 60, 114, 0.07);
  overflow: hidden;
}
.doc-share-info {
  flex: 1; min-width: 0; padding: .95rem 1.05rem;
  display: flex; flex-direction: column; justify-content: center;
}
.doc-share-label {
  font-family: var(--font-display); font-weight: 600; font-size: .84rem;
  color: #123647; margin-bottom: 3px;
}
.doc-share-label i { color: var(--c-primary); }
.doc-share-link {
  font-size: .74rem; color: var(--c-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: .6rem;
}
.doc-share-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.doc-share-btn {
  border: 1px solid #d8e6ea; background: #f4fafb;
  color: var(--c-primary-deep); font-family: var(--font-display);
  font-size: .76rem; border-radius: 999px; padding: .3rem .8rem;
  cursor: pointer; transition: all .15s;
}
.doc-share-btn:hover { border-color: var(--c-primary); background: #eaf6f8; color: var(--c-primary); }
.doc-share-btn.copied { background: #dcfce7; border-color: #22c55e; color: #15803d; }

/* ฝั่งขั้วตั๋ว: เส้นปรุ + รูเจาะ + QR scan-frame */
.doc-share-stub {
  position: relative; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .3rem; padding: .8rem .95rem .55rem;
  background: repeating-linear-gradient(45deg, #fbf6ea 0 6px, #f7f0de 6px 12px);
  border-left: 2px dashed #d9cdb2;
}
.doc-share-stub::before,
.doc-share-stub::after {
  content: '';
  position: absolute; left: -8px; width: 14px; height: 14px;
  background: #fdfaf2; border: 1px solid #ece4d2; border-radius: 50%;
}
.doc-share-stub::before { top: -8px; }
.doc-share-stub::after { bottom: -8px; }
.doc-share-qrframe {
  position: relative; padding: 7px; background: #fff; border-radius: 10px;
  /* มุมเล็ง scan 4 มุม */
  background-image:
    linear-gradient(to right, var(--c-primary) 14px, transparent 14px),
    linear-gradient(to bottom, var(--c-primary) 14px, transparent 14px),
    linear-gradient(to left, var(--c-primary) 14px, transparent 14px),
    linear-gradient(to bottom, var(--c-primary) 14px, transparent 14px),
    linear-gradient(to right, var(--c-primary) 14px, transparent 14px),
    linear-gradient(to top, var(--c-primary) 14px, transparent 14px),
    linear-gradient(to left, var(--c-primary) 14px, transparent 14px),
    linear-gradient(to top, var(--c-primary) 14px, transparent 14px);
  background-repeat: no-repeat;
  background-size: 14px 2.5px, 2.5px 14px, 14px 2.5px, 2.5px 14px, 14px 2.5px, 2.5px 14px, 14px 2.5px, 2.5px 14px;
  background-position: top left, top left, top right, top right, bottom left, bottom left, bottom right, bottom right;
}
.doc-share-qr { width: 92px; height: 92px; }
.doc-share-qr canvas, .doc-share-qr img {
  width: 100% !important; height: 100% !important; display: block;
}
.doc-share-stub-label {
  font-size: .56rem; letter-spacing: .28em; color: #b39e75;
  font-weight: 600; user-select: none;
}

/* แถวปุ่มล่าง */
.doc-m-actions {
  display: flex; flex-wrap: wrap; gap: .55rem;
  padding: .85rem 1.4rem 1.25rem;
  border-top: 1px dashed #e4d9c0; margin-top: .8rem;
}
.doc-m-primary {
  flex: 1 1 auto; border: 0; border-radius: 999px;
  background: linear-gradient(180deg, #fbbf24, #f59e0b);
  color: #43290a; font-family: var(--font-display); font-weight: 700; font-size: .92rem;
  padding: .62rem 1.3rem;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
  transition: transform .2s, box-shadow .2s;
}
.doc-m-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(245, 158, 11, 0.5), 0 1px 0 rgba(255, 255, 255, 0.6) inset; }
.doc-m-ghost {
  display: inline-flex; align-items: center; gap: .4rem;
  border: 1.5px solid #cfe0e5; border-radius: 999px; background: transparent;
  color: var(--c-primary-deep); font-family: var(--font-display); font-size: .84rem;
  padding: .55rem 1.05rem; transition: all .2s;
}
.doc-m-ghost:hover { border-color: var(--c-primary); color: var(--c-primary); background: #f2f9fa; }

/* Entrance: ไล่จังหวะตอน modal เปิด */
.doc-m .doc-m-anim {
  opacity: 0; transform: translateY(16px);
  transition: opacity .5s cubic-bezier(.22, 1, .36, 1), transform .5s cubic-bezier(.22, 1, .36, 1);
}
.doc-m.show .doc-m-anim { opacity: 1; transform: none; }
.doc-m.show .doc-m-head { transition-delay: .05s; }
.doc-m.show .doc-share-box { transition-delay: .16s; }
.doc-m.show .doc-m-actions { transition-delay: .27s; }
@media (prefers-reduced-motion: reduce) {
  .doc-m .doc-m-anim { transition: none; opacity: 1; transform: none; }
  .doc-modal-cover { transition: none; }
}

/* จอเล็ก */
@media (max-width: 575px) {
  .doc-m-body { padding: 0 1rem .3rem; }
  .doc-m-head { flex-direction: column; align-items: center; text-align: center; margin-top: -1.1rem; }
  .doc-m-info { padding-top: 0; }
  .doc-m-meta, .doc-m-badges { justify-content: center; }
  .doc-m-meta { display: flex; }
  .doc-share-box { flex-direction: column; }
  .doc-share-stub { border-left: 0; border-top: 2px dashed #d9cdb2; padding: .9rem; }
  .doc-share-stub::before { left: -8px; top: -8px; }
  .doc-share-stub::after { left: auto; right: -8px; top: -8px; bottom: auto; }
  .doc-share-qr { width: 128px; height: 128px; }
  .doc-share-actions { justify-content: center; }
  .doc-share-info { text-align: center; }
  .doc-m-actions { padding: .85rem 1rem 1.1rem; }
  .doc-m-primary { flex-basis: 100%; }
  .doc-m-ghost { flex: 1; justify-content: center; }
}

/* ---- Fullscreen popup viewer (iframe ไปยัง /doc/:id?embed=1) ---- */
.doc-viewer-overlay {
  position: fixed; inset: 0; z-index: 2100;
  background: #262f36; display: flex;
  animation: dvFadeIn .2s ease;
}
.doc-viewer-overlay[hidden] { display: none; }
.doc-viewer-overlay iframe { border: 0; flex: 1; width: 100%; height: 100%; }
@keyframes dvFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---- Responsive ---- */
@media (max-width: 991px) {
  .shelf-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
  .book-slot { min-height: 212px; padding-top: 1.3rem; }
  .doc-book { max-width: 116px; }
}
@media (max-width: 575px) {
  .docs-section { padding: 2.5rem 0 3rem; }

  /* แท็บหมวดหมู่: แถวเดียว เลื่อนแนวนอน + fade ขอบ */
  .docs-tabs {
    flex-wrap: nowrap; overflow-x: auto; width: 100%;
    padding: .25rem .25rem .45rem;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent);
  }
  .docs-tabs::-webkit-scrollbar { display: none; }
  .docs-tab {
    flex: 0 0 auto; white-space: nowrap;
    scroll-snap-align: center;
  }

  .docs-search { margin-left: 0; flex: 1 1 100%; }
  .shelf-grid { grid-template-columns: repeat(3, 1fr); }
  .book-slot { min-height: 176px; padding: 1rem .5rem 30px; }
  .book-slot::after { height: 26px; }
  .book-slot::before { bottom: 23px; }
  .doc-book { max-width: 96px; border-radius: 2px 5px 5px 2px; }
  .book-caption { height: 26px; line-height: 26px; font-size: .6rem; }
  .book-year { font-size: .55rem; }
  .bookcase { padding: 10px; border-radius: 14px; }
}
@media (max-width: 360px) {
  .shelf-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   App mode — มือถือ/แท็บเล็ต (≤991px) เท่านั้น: desktop คงเดิม
   ============================================================ */

/* ---- แถบแท็บล่างแบบแอป ---- */
.app-tabbar { display: none; }

@media (max-width: 991.98px) {
  .app-tabbar {
    display: grid;
    grid-template-columns: 1fr 1fr 84px 1fr 1fr;
    align-items: center;
    position: fixed; left: 0; right: 0; bottom: 0;
    height: 62px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: content-box;
    z-index: 1080;
    background: rgba(164, 187, 245, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(12, 47, 92, 0.14);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 28px rgba(13, 60, 114, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  }
  .tab-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; height: 100%;
    background: none; border: 0; padding: 0;
    color: #4a6a99; font-family: var(--font-display); font-size: .62rem; font-weight: 500;
    letter-spacing: .01em; -webkit-tap-highlight-color: transparent;
    transition: color .2s, transform .15s;
  }
  .tab-item i { font-size: 1.2rem; line-height: 1; transition: transform .2s; }
  .tab-item:active { transform: scale(.92); }
  .tab-item.active { color: #0c3c72; }
  .tab-item.active i { transform: translateY(-1px); }
  .tab-item.active::after {
    content: ''; width: 14px; height: 3px; border-radius: 2px;
    background: var(--c-accent); margin-top: 1px;
  }

  /* ปุ่มร้องทุกข์ลอยตรงกลาง */
  .tab-fab {
    justify-self: center; align-self: start;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    transform: translateY(-20px);
    -webkit-tap-highlight-color: transparent;
    transition: transform .2s;
  }
  .tab-fab:active { transform: translateY(-20px) scale(.93); }
  .tab-fab i {
    width: 56px; height: 56px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(180deg, #fbbf24, #f59e0b);
    color: #43290a; font-size: 1.4rem;
    box-shadow: 0 10px 24px rgba(245, 158, 11, 0.5), 0 0 0 5px rgba(164, 187, 245, 0.97);
  }
  .tab-fab-label {
    color: #0c3c72; font-family: var(--font-display);
    font-size: .6rem; font-weight: 700; text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
  }

  /* Dark mode: คืนแถบแท็บเป็นกรมท่าเข้ม + ไอคอนสว่าง */
  html[data-theme="dark"] .app-tabbar {
    background: rgba(8, 42, 82, 0.96);
    border-top-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 -8px 28px rgba(3, 20, 28, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
  html[data-theme="dark"] .tab-item { color: #7fb5c4; }
  html[data-theme="dark"] .tab-item.active { color: var(--c-accent-soft); }
  html[data-theme="dark"] .tab-fab i { box-shadow: 0 10px 24px rgba(245, 158, 11, 0.5), 0 0 0 5px rgba(8, 42, 82, 0.96); }
  html[data-theme="dark"] .tab-fab-label { color: var(--c-accent-soft); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }

  /* กันคอนเทนต์ไม่ให้โดนแถบแท็บบัง (เฉพาะหน้าที่มีแถบ) + ย้าย back-to-top ขึ้นเหนือแถบ */
  body:has(.app-tabbar) { padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
  body:has(.app-tabbar) .back-to-top { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); right: 14px; }

  /* ---- Hero กระชับแบบแอป ---- */
  .hero { min-height: 0; }
  .hero-content { padding: 3.4rem 0 5.2rem; }
  .hero-text { padding: 0 .25rem; }
  .hero h1 {
    font-size: clamp(1.55rem, 6.2vw, 2.1rem);
    margin: .85rem 0 .45rem; line-height: 1.3;
  }
  .hero-slogan {
    font-size: .9rem; line-height: 1.6; color: #fef3c7;
    text-shadow: 0 1px 8px rgba(8, 42, 82, 0.6);
  }
  .hero-eyebrow { font-size: .74rem; padding: .3rem .85rem; }
  .hero-actions { margin: 1.4rem 0 1.15rem; gap: .6rem; }
  .btn-hero-primary, .btn-hero-ghost { padding: .55rem 1.15rem; font-size: .85rem; }
  .hero-search { padding: .26rem .32rem .26rem .95rem; }
  .hero-search input { padding: .45rem .6rem; font-size: .88rem; }
  .hero-search button { padding: .48rem 1.1rem; font-size: .88rem; }
  .hero-scroll-hint { display: none; }

  /* ---- ระยะขอบจอสม่ำเสมอทั้งหน้า ---- */
  .container, .container-fluid { padding-left: 1.25rem; padding-right: 1.25rem; }

  /* ---- บริการด่วน: ตารางไอคอนแบบแอป ---- */
  .quick-services { margin-top: -2.2rem; }
  .qs-grid { grid-template-columns: repeat(4, 1fr); gap: .7rem; }
  .qs-card {
    align-items: center; justify-content: flex-start;
    text-align: center; gap: .45rem;
    padding: .95rem .35rem .85rem; border-radius: 18px;
    min-height: 104px;
  }
  .qs-icon {
    width: 46px; height: 46px; border-radius: 15px;
    font-size: 1.3rem; margin-bottom: 0;
  }
  .qs-label { font-size: .7rem; font-weight: 600; line-height: 1.35; }
  .qs-desc, .qs-arrow { display: none; }
  .qs-card:active { transform: scale(.95); }

  /* ---- หัว section แบบแอป ---- */
  .section { padding: 2.6rem 0; }
  .section-head { margin-bottom: 1.2rem; }
  .section-title { font-size: 1.18rem; gap: .5rem; }
  .section-more { font-size: .82rem; }

  /* ---- แบนเนอร์ไฮไลต์ ---- */
  .highlight-section { padding-top: 2.2rem; }
  .highlight-slide { min-height: 200px; }
  .hl-text { padding: 1.5rem 1.25rem; }
  .hl-text h3 { font-size: 1.15rem; }
  .hl-text p { font-size: .82rem; }

  /* ---- แถบสถิติ ---- */
  .stats-band { padding: 2.4rem 0; margin-top: 2.4rem !important; }
  .stats-band .row { row-gap: 1.4rem !important; }
  .stat-icon { font-size: 1.45rem; margin-bottom: .25rem; }
  .stat-value { font-size: 1.6rem; }
  .stat-label { font-size: .75rem; margin-top: .3rem; }
}

/* ---- ข่าว: การ์ดปัดแนวนอนแบบ feed (เฉพาะมือถือ) ---- */
@media (max-width: 767.98px) {
  .news-hub .col-lg-8 > .row.g-4 {
    flex-wrap: nowrap; overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: .6rem;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 12px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 12px), transparent);
  }
  .news-hub .col-lg-8 > .row.g-4::-webkit-scrollbar { display: none; }
  .news-hub .col-lg-8 > .row.g-4 > [class*="col-"] {
    flex: 0 0 80%; max-width: 80%;
    scroll-snap-align: center;
  }
  .news-hub .news-card .news-cover { height: 150px; }
  .news-hub .news-card h3 { font-size: .92rem; }
}

/* ============================================================
   App mode — หน้า /news และ page-hero ทุกหน้า (มือถือ/แท็บเล็ต)
   ============================================================ */
@media (max-width: 991.98px) {
  /* หัวหน้ารองกระชับแบบแอป */
  .page-hero { padding: 1.35rem 0 1.15rem; }
  .page-hero .breadcrumb { font-size: .72rem; margin-bottom: .15rem; }
  .page-hero .page-title { font-size: 1.3rem; }
  .page-hero .page-subtitle { font-size: .8rem; margin-top: .1rem; }
}

@media (max-width: 767.98px) {
  /* /news: ช่องค้นหาเต็มแถวบน + chips เลื่อนแนวนอนแถวเดียว */
  body[data-page="news"] .v2-toolbar { gap: .55rem; }
  body[data-page="news"] .v2-toolbar .news-search {
    flex: 1 1 100%; max-width: none; order: -1;
  }
  body[data-page="news"] #filterChips {
    flex-wrap: nowrap !important; overflow-x: auto; width: 100%;
    padding: .2rem .2rem .45rem;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent);
  }
  body[data-page="news"] #filterChips::-webkit-scrollbar { display: none; }
  body[data-page="news"] .filter-chip {
    flex: 0 0 auto; white-space: nowrap; scroll-snap-align: center;
  }

  /* /news: การ์ดข่าวเป็น list แบบแอปข่าว (รูปซ้าย เนื้อขวา) */
  body[data-page="news"] .news-grid-v2 { grid-template-columns: 1fr; gap: .7rem; }
  body[data-page="news"] .news-grid-v2 .news-card {
    display: grid; grid-template-columns: 118px 1fr;
    border-radius: 16px; min-height: 112px;
  }
  body[data-page="news"] .news-grid-v2 .news-card:active { transform: scale(.985); }
  body[data-page="news"] .news-grid-v2 .news-cover {
    height: 100%; min-height: 112px; font-size: 1.5rem;
  }
  body[data-page="news"] .news-grid-v2 .news-card-body {
    padding: .6rem .8rem .55rem; gap: .25rem;
  }
  body[data-page="news"] .news-grid-v2 .news-card h3 {
    font-size: .88rem; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  body[data-page="news"] .news-grid-v2 .news-card p { display: none; }
  body[data-page="news"] .news-grid-v2 .badge-type {
    font-size: .62rem; padding: .12rem .5rem; align-self: flex-start;
  }
  body[data-page="news"] .news-grid-v2 .featured-meta { font-size: .7rem; }
  body[data-page="news"] .news-grid-v2 .news-pin {
    width: 24px; height: 24px; font-size: .68rem; top: .45rem; left: .45rem;
  }
}

/* ============ ปุ่มติดตั้ง PWA ใน mobile menu ============ */
.mm-install {
  display: flex; align-items: center; gap: .7rem;
  width: 100%; margin-top: 1.1rem; padding: .8rem .85rem;
  background: linear-gradient(120deg, rgba(245, 158, 11, 0.16), rgba(245, 158, 11, 0.05));
  border: 1px dashed rgba(251, 191, 36, 0.55);
  border-radius: 16px; color: #fdfaf2; text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: transform .2s, background .2s, border-color .2s;
}
.mm-install:hover, .mm-install:active {
  background: linear-gradient(120deg, rgba(245, 158, 11, 0.28), rgba(245, 158, 11, 0.1));
  border-color: var(--c-accent); transform: translateY(-2px);
}
.mm-install[hidden] { display: none; }
.mm-install-ico {
  width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0;
  background: linear-gradient(180deg, #fbbf24, #f59e0b); color: #43290a;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem;
  box-shadow: 0 6px 14px rgba(245, 158, 11, 0.35);
}
.mm-install-text { flex: 1; min-width: 0; line-height: 1.35; }
.mm-install-text strong {
  display: block; font-family: var(--font-display); font-size: .88rem; color: #fde68a;
}
.mm-install-text small { color: #b9d8e2; font-size: .72rem; }
.mm-install-arrow { color: var(--c-accent-soft); font-size: 1.05rem; }
.mm-ios-tip {
  margin-top: .55rem; padding: .7rem .85rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px; color: #cfe9ef; font-size: .78rem; line-height: 1.6;
}
.mm-ios-tip[hidden] { display: none; }

/* ============================================================
   Dark mode — html[data-theme="dark"] (toggle ที่ topbar)
   ============================================================ */
html[data-theme="dark"] {
  color-scheme: dark;
  --c-bg: #0a1e28;
  --c-surface: #102b37;
  --c-text: #d9e8ed;
  --c-muted: #8fadb8;
  --c-line: #1d3d4c;
  --c-dark: #dff1f6;              /* บทบาทตัวหนังสือหัวข้อ — สว่างบนพื้นมืด */
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.55);
}

/* header กระจกมืด */
html[data-theme="dark"] .site-header {
  background: rgba(9, 27, 37, 0.92);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}
html[data-theme="dark"] .mobile-menu-btn { background: var(--c-primary); }

/* จุดที่เดิมใช้ var(--c-dark) เป็น "พื้นหลัง" ต้องกลับเป็นสีเข้มจริง */
html[data-theme="dark"] .footer-body { background: #06141b; }
html[data-theme="dark"] .footer-wave svg path { fill: #06141b; }
html[data-theme="dark"] .footer-body { color: #cbd5e1; }
html[data-theme="dark"] .footer-title { color: #fff; }
html[data-theme="dark"] .footer-heading { color: var(--c-accent-soft); }
html[data-theme="dark"] .footer-links a { color: #cbd5e1; }
html[data-theme="dark"] .footer-links a:hover { color: #fff; }
html[data-theme="dark"] .footer-social a { background: rgba(255, 255, 255, 0.1); color: #fff; }
html[data-theme="dark"] .footer-bottom { color: #94a3b8; border-top-color: rgba(255, 255, 255, 0.12); }
html[data-theme="dark"] .btn-event-all { background: #135aa8; }
html[data-theme="dark"] .btn-event-all:hover { background: var(--c-primary); }
html[data-theme="dark"] .exec-avatar { background: linear-gradient(135deg, var(--c-primary), #082a52); }
html[data-theme="dark"] .page-hero {
  background:
    radial-gradient(800px 300px at 90% -80%, rgba(245, 158, 11, 0.22), transparent),
    linear-gradient(120deg, #04141c, #0b4b60);
}
html[data-theme="dark"] .stats-band {
  background:
    radial-gradient(1200px 400px at 85% -50%, rgba(245, 158, 11, 0.18), transparent),
    linear-gradient(120deg, #04141c, #0b4b60);
  color: #fff;
}
html[data-theme="dark"] .stat-value { color: #fff; }
html[data-theme="dark"] .stat-icon { color: var(--c-accent-soft); }
html[data-theme="dark"] .stat-suffix,
html[data-theme="dark"] .stat-label { color: #bae6fd; }
html[data-theme="dark"] .mm-avatar-txt,
html[data-theme="dark"] .qs-icon { filter: saturate(.92); }

/* Modal เอกสาร: กระดาษกลางคืน (QR คงพื้นขาวเพื่อให้สแกนได้) */
html[data-theme="dark"] .doc-m-card {
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 28px),
    #0e2530;
}
html[data-theme="dark"] .doc-m-wave path { fill: #0e2530; }
html[data-theme="dark"] .doc-m-name,
html[data-theme="dark"] .doc-share-label { color: #e4f2f6; }
html[data-theme="dark"] .doc-m-chip { background: #0a1c24; border-color: #1d3d4c; color: #9dbcc7; }
html[data-theme="dark"] .doc-share-box { background: #0a1c24; border-color: #1d3d4c; }
html[data-theme="dark"] .doc-share-stub {
  background: repeating-linear-gradient(45deg, #0d222c 0 6px, #0a1c24 6px 12px);
  border-color: #265062;
}
html[data-theme="dark"] .doc-share-stub::before,
html[data-theme="dark"] .doc-share-stub::after { background: #0e2530; border-color: #1d3d4c; }
html[data-theme="dark"] .doc-share-btn { background: #0d2833; border-color: #265062; color: #9fd6e4; }
html[data-theme="dark"] .doc-m-ghost { border-color: #2a586c; color: #9fd6e4; }
html[data-theme="dark"] .doc-m-ghost:hover { background: #0d2833; }
html[data-theme="dark"] .doc-m-actions { border-top-color: #23485a; }
html[data-theme="dark"] .docs-tab-count { background: #0a1c24; }

/* ปุ่ม toggle บน topbar */
.contrast-toggle i { pointer-events: none; }

/* Dark mode: topbar กลับเป็นเข้ม + คอนโทรลสว่าง */
html[data-theme="dark"] .topbar { background: var(--c-darker); color: #cbd5e1; border-bottom-color: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] .topbar-link { color: #cbd5e1; }
html[data-theme="dark"] .topbar-link:hover { color: #fff; }
html[data-theme="dark"] .font-size-controls { border-color: #33566b; }
html[data-theme="dark"] .font-size-controls button { color: #cbd5e1; }
html[data-theme="dark"] .contrast-toggle { border-color: #33566b; color: #cbd5e1; }
html[data-theme="dark"] .topbar-user-btn { color: #cbd5e1; }
html[data-theme="dark"] .topbar-user-btn:hover { color: #fff; }

/* ============================================================
   Light mode: mobile drawer เป็นพื้นขาว ตัวอักษรกรมท่า
   (dark mode คงธีม "แม่น้ำยามค่ำ" เดิมไว้)
   ============================================================ */
html:not([data-theme="dark"]) .mobile-menu.offcanvas {
  color: #14335c;
  background:
    radial-gradient(320px 180px at 100% 0%, rgba(164, 187, 245, 0.45), transparent 65%),
    linear-gradient(180deg, #eef4ff 0%, #ffffff 42%);
  box-shadow: -18px 0 60px rgba(13, 60, 114, 0.22);
}
html:not([data-theme="dark"]) .mm-glow { background-image: radial-gradient(rgba(12, 47, 92, 0.05) 1px, transparent 1.5px); }
html:not([data-theme="dark"]) .mm-header { border-bottom-color: rgba(12, 47, 92, 0.1); }
html:not([data-theme="dark"]) .mm-brand img { filter: none; }
html:not([data-theme="dark"]) .mm-brand-text strong { color: #14335c; }
html:not([data-theme="dark"]) .mm-brand-text small { color: #5b7aa6; }
html:not([data-theme="dark"]) .mm-close { background: rgba(12, 47, 92, 0.07); color: #14335c; }
html:not([data-theme="dark"]) .mm-close:hover { background: rgba(12, 47, 92, 0.15); }

html:not([data-theme="dark"]) .mm-user { background: #f4f8ff; border-color: #dbe6f7; }
html:not([data-theme="dark"]) .mm-user-info strong { color: #14335c; }
html:not([data-theme="dark"]) .mm-user-info small { color: #5b7aa6; }
html:not([data-theme="dark"]) .mm-user-btn { background: #e8f0fd; color: #135aa8; }
html:not([data-theme="dark"]) .mm-user-btn:hover { background: #d6e6fb; color: #0c3c72; }
html:not([data-theme="dark"]) .mm-user-btn.danger { color: #dc2626; }
html:not([data-theme="dark"]) .mm-user-btn.danger:hover { background: #fee2e2; color: #b91c1c; }

html:not([data-theme="dark"]) .mm-link { color: #14335c; }
html:not([data-theme="dark"]) .mm-link:hover,
html:not([data-theme="dark"]) .mm-link:focus-visible { background: rgba(12, 47, 92, 0.05); color: #0c2f5c; }
html:not([data-theme="dark"]) .mm-link.active { background: #eaf2fe; color: #135aa8; }
html:not([data-theme="dark"]) .mm-ico { background: #e8f0fd; color: #1773cf; }
html:not([data-theme="dark"]) .mm-link:hover .mm-ico { background: #dce9fb; }
html:not([data-theme="dark"]) .mm-link.active .mm-ico { background: #d6e6fb; color: #135aa8; }
html:not([data-theme="dark"]) .mm-chev { color: rgba(12, 47, 92, 0.3); }
html:not([data-theme="dark"]) .mm-link:hover .mm-chev { color: #0c2f5c; }

html:not([data-theme="dark"]) .mm-label { color: #135aa8; }

html:not([data-theme="dark"]) .mm-tile { background: #ffffff; border-color: #dbe6f7; color: #14335c; box-shadow: 0 2px 8px rgba(13, 60, 114, 0.06); }
html:not([data-theme="dark"]) .mm-tile i { filter: none; }
html:not([data-theme="dark"]) .mm-tile:hover { background: #f4f8ff; border-color: #b9cdf0; color: #0c2f5c; }

html:not([data-theme="dark"]) .mm-call { border-color: rgba(12, 47, 92, 0.2); color: #14335c; }
html:not([data-theme="dark"]) .mm-call:hover { border-color: var(--c-accent); color: #b45309; background: rgba(245, 158, 11, 0.1); }
html:not([data-theme="dark"]) .mm-copy { color: #8ba0bd; }

/* ปุ่มติดตั้ง PWA — ตัวอักษรให้อ่านออกบนพื้นขาว */
html:not([data-theme="dark"]) .mm-install-text strong { color: #8a5a0a; }
html:not([data-theme="dark"]) .mm-install-text small { color: #6b7f95; }
html:not([data-theme="dark"]) .mm-install-arrow { color: #c2740a; }
html:not([data-theme="dark"]) .mm-ios-tip { background: #f4f8ff; border-color: #dbe6f7; color: #4a6a99; }
