@font-face { font-family: 'Sarabun'; font-weight: 400; font-display: swap; src: url(../fonts/sarabun-thai-400-normal.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Sarabun'; font-weight: 400; font-display: swap; src: url(../fonts/sarabun-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212; }
@font-face { font-family: 'Sarabun'; font-weight: 500; font-display: swap; src: url(../fonts/sarabun-thai-500-normal.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Sarabun'; font-weight: 500; font-display: swap; src: url(../fonts/sarabun-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212; }
@font-face { font-family: 'Sarabun'; font-weight: 600; font-display: swap; src: url(../fonts/sarabun-thai-600-normal.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Sarabun'; font-weight: 600; font-display: swap; src: url(../fonts/sarabun-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212; }
@font-face { font-family: 'Sarabun'; font-weight: 700; font-display: swap; src: url(../fonts/sarabun-thai-700-normal.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Sarabun'; font-weight: 700; font-display: swap; src: url(../fonts/sarabun-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-weight: 600; font-display: swap; src: url(../fonts/ibm-plex-sans-thai-thai-600-normal.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-weight: 600; font-display: swap; src: url(../fonts/ibm-plex-sans-thai-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-weight: 700; font-display: swap; src: url(../fonts/ibm-plex-sans-thai-thai-700-normal.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'IBM Plex Sans Thai'; font-weight: 700; font-display: swap; src: url(../fonts/ibm-plex-sans-thai-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF, U+2212; }
/* =====================================================================
   site.css — เว็บไซต์ OPDAE
   ใช้สีจากสื่อของหน่วยงาน: แดงเลือดหมู (OPDAE) ชมพูอ่อน ทอง และเขียวโรงพยาบาลเป็นสีเสริม
   เปลี่ยนสีทั้งเว็บได้ที่ :root
   ===================================================================== */
:root {
  --red: #a3243b;          /* แดง OPDAE */
  --red-strong: #861a2f;
  --red-soft: #f8e9ec;
  --rose: #c98b96;
  --gold: #c39a2b;
  --mci: #d7263d;          /* ปุ่ม MCI */
  --mci-strong: #b31b30;
  --green: #0b6e4f;
  --green-soft: #e3f5ef;
  --bg: #fbf8f8;
  --surface: #ffffff;
  --surface-2: #f6f0f1;
  --line: #ecdfe2;
  --line-strong: #d9c6ca;
  --text: #2b2226;
  --muted: #6f6266;
  --amber-soft: #fdf4dc; --amber: #9a6a00;
  --font-body: 'Sarabun', 'Leelawadee UI', 'Thonburi', Tahoma, sans-serif;
  --font-head: 'IBM Plex Sans Thai', 'Sarabun', 'Leelawadee UI', Tahoma, sans-serif;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(60, 20, 30, .06), 0 8px 24px rgba(60, 20, 30, .06);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 17px; line-height: 1.65; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.3; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--red); }
img { max-width: 100%; display: block; }
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.18em; }
.muted { color: var(--muted); } .small { font-size: .88rem; } .center { text-align: center; }
.hide-sm { } .spacer { flex: 1; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.wrap.narrow { max-width: 860px; }
.section { padding-block: 2.6rem; }
.tint { background: var(--surface-2); }
.eyebrow { font-family: var(--font-head); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .82rem; color: var(--red); }
.eyebrow.light { color: #ffd9de; }

/* ---------- ปุ่ม ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 44px; padding: .55em 1.15em; border-radius: 12px; border: 1.5px solid transparent; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, transform .05s, box-shadow .15s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-strong); }
.btn-outline { background: var(--surface); color: var(--red); border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--red); }
.btn-red, .btn-mci { background: var(--mci); color: #fff; box-shadow: 0 6px 18px rgba(215, 38, 61, .32); }
.btn-red:hover, .btn-mci:hover { background: var(--mci-strong); }
.btn-white { background: #fff; color: var(--mci); }
.btn-lg { min-height: 52px; font-size: 1.05rem; padding: .6em 1.4em; }
.btn-xl { min-height: 62px; font-size: 1.2rem; padding: .7em 1.7em; border-radius: 16px; }
.btn-xl .ic { width: 1.4em; height: 1.4em; }
.btn-sm { min-height: 36px; padding: .3em .8em; font-size: .9rem; }
.btn-block { width: 100%; }
.link { font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: .2em; }
.link:hover { text-decoration: underline; }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; color: var(--red); background: var(--red-soft); padding: .1em .6em; border-radius: 999px; }

/* ---------- แถบบน + ส่วนหัว ---------- */
.topline { background: var(--red-strong); color: #fbe7ea; font-size: .88rem; }
.topline-in { display: flex; align-items: center; gap: 1.2rem; min-height: 38px; flex-wrap: wrap; }
.topline span { display: inline-flex; align-items: center; gap: .4rem; }
.topline .emerg { background: var(--mci); color: #fff; padding: .15rem .7rem; border-radius: 999px; font-weight: 600; }
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; box-shadow: 0 2px 10px rgba(60, 20, 30, .04); }
.head-in { display: flex; align-items: center; gap: 1rem; min-height: 78px; }
.brand { display: flex; align-items: center; gap: .8rem; text-decoration: none; color: var(--text); min-width: 0; }
.brand-logos { display: flex; gap: .35rem; flex: none; }
.brand-logos img { height: 52px; width: auto; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-txt b { font-family: var(--font-head); color: var(--red); font-size: 1.35rem; letter-spacing: .02em; }
.brand-txt span { font-weight: 700; font-size: .95rem; }
.brand-txt small { color: var(--muted); font-size: .76rem; }
.nav { display: flex; align-items: center; gap: .6rem; margin-left: auto; }
.nav > ul { list-style: none; display: flex; gap: .1rem; margin: 0; padding: 0; }
.nav > ul > li { position: relative; }
.nav > ul > li > a, .nav > ul > li > button { white-space: nowrap; display: inline-flex; align-items: center; gap: .25rem; padding: .55rem .75rem; border-radius: 10px; text-decoration: none; color: var(--text); font: inherit; font-weight: 600; font-size: .96rem; background: none; border: 0; cursor: pointer; }
.nav > ul > li > a:hover, .nav > ul > li > button:hover { background: var(--surface-2); }
.nav a.active, .nav button.active { color: var(--red); box-shadow: inset 0 -3px 0 var(--red); border-radius: 10px 10px 0 0; }
.nav .sub { list-style: none; margin: 0; padding: .4rem; position: absolute; top: 100%; left: 0; min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); display: none; z-index: 50; }
.nav .has-sub:hover .sub, .nav .has-sub.open .sub, .nav .has-sub:focus-within .sub { display: block; }
.nav .sub a { display: block; padding: .5rem .8rem; border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 600; font-size: .94rem; }
.nav .sub a:hover, .nav .sub a.active { background: var(--red-soft); color: var(--red); }
.nav-actions { display: flex; align-items: center; gap: .5rem; }
.nav-toggle { display: none; margin-left: auto; width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--text); }
.nav-toggle .ic { width: 24px; height: 24px; }
.user-menu { position: relative; }
.user-btn { white-space: nowrap; display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .6rem .3rem .3rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-weight: 600; cursor: pointer; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--red); color: #fff; font-weight: 700; }
.user-drop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: .4rem; display: none; z-index: 60; }
.user-menu.open .user-drop { display: block; }
.user-drop a, .user-drop button { display: flex; align-items: center; gap: .55rem; width: 100%; padding: .55rem .7rem; border-radius: 8px; text-decoration: none; color: var(--text); font: inherit; font-weight: 600; font-size: .94rem; background: none; border: 0; cursor: pointer; text-align: left; }
.user-drop a:hover, .user-drop button:hover { background: var(--red-soft); color: var(--red); }
.user-drop form { margin: 0; border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .3rem; }
@media (max-width: 1180px) {
  .nav-toggle { display: inline-grid; place-items: center; }
  .nav { position: fixed; inset: 0 0 0 auto; width: min(340px, 88vw); background: var(--surface); flex-direction: column; align-items: stretch; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px)); gap: 1rem; transform: translateX(100%); transition: transform .2s ease; box-shadow: -10px 0 40px rgba(0, 0, 0, .15); overflow-y: auto; z-index: 70; }
  body.nav-open .nav { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(40, 10, 20, .4); z-index: 65; }
  .nav > ul { flex-direction: column; }
  .nav .sub { position: static; display: block; box-shadow: none; border: 0; padding: 0 0 0 .8rem; min-width: 0; }
  .nav a.active, .nav button.active { box-shadow: inset 3px 0 0 var(--red); border-radius: 0 10px 10px 0; }
  .nav-actions { flex-direction: column; align-items: stretch; }
  .user-drop { position: static; display: block; box-shadow: none; border: 0; padding: .3rem 0 0; }
  .user-btn { width: 100%; }
  .hide-md { display: inline; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .hide-sm { display: none !important; }
  .brand-logos img { height: 42px; }
  .brand-txt b { font-size: 1.15rem; }
  .brand-txt small { display: none; }
  .head-in { min-height: 66px; }
  .wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .section { padding-block: 1.8rem; }
}

/* ---------- แจ้งเตือน ---------- */
.alert { padding: .75rem 1rem; border-radius: 12px; font-weight: 600; margin: .4rem 0; }
.alert.ok { background: var(--green-soft); color: var(--green); }
.alert.err { background: var(--red-soft); color: var(--red-strong); }
.alert.warn { background: var(--amber-soft); color: var(--amber); }
.alert.info { background: #eef3fb; color: #2b4f86; }
.flash { margin-top: 1rem; }

/* ---------- หน้าแรก ---------- */
.hero { background: radial-gradient(120% 120% at 100% 0%, var(--red-soft) 0%, var(--bg) 55%); overflow: hidden; position: relative; }
.hero::before { content: ""; position: absolute; width: 520px; height: 520px; left: -260px; bottom: -280px; border-radius: 50%; background: var(--red); opacity: .08; }
.hero-in { display: grid; grid-template-columns: 1.05fr .95fr; gap: 2.5rem; align-items: center; padding-block: 3.2rem 3.6rem; position: relative; }
.hero h1 { font-size: clamp(1.9rem, 4vw, 3rem); color: var(--red-strong); margin-top: .3rem; }
.hero-org { font-weight: 600; color: var(--muted); margin-top: .3rem; }
.hero-tag { font-family: var(--font-head); font-weight: 700; font-size: 1.2rem; margin-top: 1rem; color: var(--text); }
.hero-intro { margin-top: .8rem; max-width: 60ch; color: #4a3e42; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.6rem; }
.hero-photos { position: relative; aspect-ratio: 1 / .9; max-width: 560px; justify-self: center; width: 100%; }
.hero-photos img { position: absolute; border-radius: 50%; object-fit: cover; border: 8px solid #fff; box-shadow: 0 0 0 3px var(--red), 0 18px 40px rgba(60, 20, 30, .18); }
.hp-main { width: 74%; aspect-ratio: 1; top: 0; right: 0; }
.hp-a { width: 36%; aspect-ratio: 1; left: 0; bottom: 4%; box-shadow: 0 0 0 3px var(--rose), 0 12px 30px rgba(60, 20, 30, .18) !important; }
.hp-b { width: 40%; aspect-ratio: 1; right: 6%; bottom: -6%; box-shadow: 0 0 0 3px var(--gold), 0 12px 30px rgba(60, 20, 30, .18) !important; }
@media (max-width: 900px) { .hero-in { grid-template-columns: 1fr; padding-block: 2rem 3rem; } .hero-photos { max-width: 420px; } }
.emerg-band { background: var(--red); color: #fff; }
.emerg-in { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; padding-block: 1.1rem; }
.eb-item { display: flex; gap: .8rem; align-items: center; }
.eb-ic { width: 46px; height: 46px; border-radius: 14px; background: rgba(255, 255, 255, .14); display: grid; place-items: center; flex: none; }
.eb-ic .ic { width: 24px; height: 24px; }
.eb-item b { display: block; font-size: 1.05rem; }
.eb-item span { font-size: .86rem; opacity: .88; }
@media (max-width: 800px) { .emerg-in { grid-template-columns: 1fr; } }
.mci-cta { margin-top: 2rem; background: linear-gradient(120deg, var(--mci) 0%, var(--red-strong) 100%); color: #fff; border-radius: 22px; padding: 1.6rem 1.8rem; display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; box-shadow: 0 16px 40px rgba(179, 27, 48, .3); }
.mci-cta > div { flex: 1; min-width: 260px; }
.mci-cta h2 { font-size: 1.4rem; margin: .2rem 0; }
.mci-cta p { opacity: .9; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.sec-head h2 { font-size: 1.55rem; position: relative; padding-left: .9rem; }
.sec-head h2::before { content: ""; position: absolute; left: 0; top: .2em; bottom: .2em; width: 5px; border-radius: 3px; background: var(--red); }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 960px) { .quick-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .quick-grid { grid-template-columns: 1fr; } }
.quick { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: .35rem; transition: border-color .15s, transform .15s, box-shadow .15s; }
.quick:hover { border-color: var(--red); transform: translateY(-2px); box-shadow: var(--shadow); }
.q-ic { width: 50px; height: 50px; border-radius: 14px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; margin-bottom: .3rem; }
.q-ic .ic { width: 26px; height: 26px; }
.quick b { font-family: var(--font-head); font-size: 1.1rem; }
.quick span:last-child { color: var(--muted); font-size: .92rem; }
.highlights { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
@media (max-width: 800px) { .highlights { grid-template-columns: 1fr; } }
.highlights li { display: flex; gap: .9rem; background: var(--surface); border-radius: var(--radius); padding: 1rem 1.1rem; border: 1px solid var(--line); }
.hl-n { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
@media (max-width: 960px) { .post-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .post-grid { grid-template-columns: 1fr; } }
.post-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--text); display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; }
.post-card:hover { border-color: var(--red); box-shadow: var(--shadow); }
.pc-img { aspect-ratio: 16 / 9; background: var(--surface-2); display: block; overflow: hidden; }
.pc-img img { width: 100%; height: 100%; object-fit: cover; }
.pc-ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--red); background: linear-gradient(135deg, var(--red-soft), #fff); }
.pc-ph .ic { width: 46px; height: 46px; opacity: .75; }
.pc-discharge { color: var(--green); background: linear-gradient(135deg, var(--green-soft), #fff); }
.pc-knowledge { color: var(--gold); background: linear-gradient(135deg, #fbf3dc, #fff); }
.pc-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .35rem; }
.pc-meta { display: flex; gap: .6rem; align-items: center; font-size: .82rem; color: var(--muted); }
.pc-body b { font-family: var(--font-head); font-size: 1.08rem; line-height: 1.35; }
.pc-sum { color: var(--muted); font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.staff-cta { display: flex; gap: 1rem; align-items: center; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 1.2rem 1.4rem; flex-wrap: wrap; }
.staff-cta > span { width: 48px; height: 48px; border-radius: 14px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; }
.staff-cta > div { flex: 1; min-width: 220px; }

/* ---------- หน้าเนื้อหา ---------- */
.page-hero { background: linear-gradient(120deg, var(--red-strong), var(--red)); color: #fff; padding-block: 2.2rem 2rem; }
.page-hero h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
.page-hero .muted { color: #ffd9de; }
.crumb { font-size: .88rem; opacity: .85; margin-bottom: .3rem; }
.crumb a { color: #fff; }
.post-date { display: flex; gap: .4rem; align-items: center; margin-top: .4rem; opacity: .9; }
.page-img { width: 100%; max-height: 420px; object-fit: cover; border-radius: var(--radius); margin-bottom: 1.4rem; }
.lead { font-size: 1.15rem; color: var(--muted); margin-bottom: 1rem; }
.prose { font-size: 1.05rem; }
.prose > * + * { margin-top: 1rem; }
.prose h3 { font-size: 1.3rem; color: var(--red-strong); margin-top: 1.8rem; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: .35rem; }
.edit-link { margin-top: 2rem; }
.back { margin-top: 2rem; }
.group-h { font-size: 1.3rem; margin: 1.6rem 0 1rem; color: var(--red-strong); }
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.staff-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.staff-card img, .staff-ph { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; border: 4px solid var(--red-soft); }
.staff-ph { display: grid; place-items: center; background: var(--red-soft); color: var(--red); font-size: 2.4rem; font-family: var(--font-head); font-weight: 700; }
.staff-card span { color: var(--muted); font-size: .9rem; }
.pager { display: flex; gap: .4rem; justify-content: center; margin-top: 2rem; }
.pager a { min-width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); text-decoration: none; color: var(--text); font-weight: 700; }
.pager a.active { background: var(--red); color: #fff; border-color: var(--red); }
.empty-box { text-align: center; padding: 3rem 1rem; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: .7rem; }
.empty-box .ic { width: 46px; height: 46px; color: var(--line-strong); }
.contact-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 1.4rem; }
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .contact-grid { grid-template-columns: 1fr; } }
.c-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; display: flex; flex-direction: column; gap: .3rem; }
.c-ic { width: 46px; height: 46px; border-radius: 14px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; }
.c-card.emerg { background: var(--mci); color: #fff; border-color: var(--mci); }
.c-card.emerg .c-ic { background: rgba(255, 255, 255, .18); color: #fff; }
.addr-card { display: grid; grid-template-columns: 300px 1fr; gap: 1.5rem; align-items: center; margin-top: 1.4rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.addr-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 50%; border: 6px solid var(--red-soft); }
.addr-card > div { display: flex; flex-direction: column; gap: .8rem; align-items: flex-start; }
.addr-card h3 { display: flex; gap: .4rem; align-items: center; color: var(--red-strong); }
@media (max-width: 700px) { .addr-card { grid-template-columns: 1fr; } .addr-card img { max-width: 220px; } }
.narrow-p { max-width: 70ch; }

/* ---------- เข้าสู่ระบบ / ระบบงานภายใน ---------- */
.login-wrap { display: grid; grid-template-columns: 1fr 1fr; min-height: calc(100vh - 200px); }
.login-side { position: relative; background: var(--red-strong); color: #fff; display: flex; align-items: flex-end; overflow: hidden; }
.login-side img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .32; }
.login-side > div { position: relative; padding: 2.4rem; max-width: 520px; display: flex; flex-direction: column; gap: .5rem; }
.login-card { align-self: center; justify-self: center; width: min(440px, calc(100% - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 2rem; box-shadow: var(--shadow); margin-block: 2rem; display: flex; flex-direction: column; gap: 1rem; }
.login-card h1 { display: flex; gap: .5rem; align-items: center; font-size: 1.5rem; color: var(--red-strong); }
@media (max-width: 860px) { .login-wrap { grid-template-columns: 1fr; } .login-side { min-height: 200px; } .login-side > div { padding: 1.4rem 1.2rem; } }
.form-stack { display: flex; flex-direction: column; gap: .9rem; }
.form-stack label, .form-grid label { display: flex; flex-direction: column; gap: .3rem; font-weight: 700; font-size: .92rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1rem; align-items: end; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
input, select, textarea { font: inherit; font-weight: 400; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: .6em .8em; width: 100%; min-height: 46px; }
textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(163, 36, 59, .15); }
label small { font-weight: 400; color: var(--muted); }
.mci-big { display: flex; align-items: center; gap: 1.3rem; background: linear-gradient(120deg, var(--mci), var(--red-strong)); color: #fff; text-decoration: none; border-radius: 24px; padding: 1.6rem 1.8rem; box-shadow: 0 18px 44px rgba(179, 27, 48, .32); transition: transform .15s; }
.mci-big:hover { transform: translateY(-2px); }
.mb-ic { width: 74px; height: 74px; border-radius: 22px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; flex: none; }
.mb-ic .ic { width: 40px; height: 40px; }
.mb-txt { flex: 1; display: flex; flex-direction: column; gap: .2rem; }
.mb-txt b { font-family: var(--font-head); font-size: 1.8rem; }
.mb-txt > span { opacity: .9; }
.mb-live { display: inline-flex; align-items: center; gap: .5rem; background: rgba(255, 255, 255, .18); padding: .2rem .7rem; border-radius: 999px; font-weight: 700; align-self: flex-start; margin-top: .3rem; }
.mb-go { width: 34px; height: 34px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .7); } 100% { box-shadow: 0 0 0 9px transparent; } }
@media (max-width: 600px) { .mci-big { padding: 1.2rem; gap: .9rem; } .mb-ic { width: 56px; height: 56px; } .mb-txt b { font-size: 1.35rem; } .mb-go { display: none; } }
.module-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
@media (max-width: 860px) { .module-grid { grid-template-columns: 1fr; } }
.module { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; display: flex; flex-direction: column; gap: .3rem; text-decoration: none; color: var(--text); }
.module .ic { width: 30px; height: 30px; color: var(--red); margin-bottom: .3rem; }
.module span { color: var(--muted); font-size: .9rem; }
a.module:hover { border-color: var(--red); box-shadow: var(--shadow); }
.module.soon { border-style: dashed; opacity: .75; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.2rem; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: .3rem 1rem; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; }

/* ---------- ส่วนท้าย ---------- */
.site-foot { background: #2a1519; color: #e9d9dc; margin-top: 3rem; }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 2rem; padding-block: 2.4rem; }
.foot-grid h4 { color: #fff; margin-bottom: .6rem; }
.foot-grid p { display: flex; gap: .5rem; align-items: flex-start; margin-bottom: .4rem; font-size: .94rem; }
.foot-grid a { color: #ffd9de; }
.foot-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; color: #fff; }
.foot-brand img { width: 46px; }
.foot-bottom { text-align: center; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px)); font-size: .82rem; border-top: 1px solid rgba(255, 255, 255, .1); color: #c2a9ae; }
@media (max-width: 800px) { .foot-grid { grid-template-columns: 1fr; gap: 1.2rem; } }

/* ---------- ติดตั้ง ---------- */
.install-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: var(--surface-2); }
.install-card { width: min(640px, 100%); background: #fff; border-radius: 22px; padding: 2rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 1rem; }
.install-card h1 { color: var(--red-strong); font-size: 1.5rem; }
.install-logos { display: flex; gap: .5rem; } .install-logos img { height: 56px; }
.install-card .form-grid button { grid-column: 1 / -1; }
.install-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.config-out { font-family: monospace; font-size: .85rem; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- หลังบ้าน ---------- */
.admin-hero { padding-block: 1.6rem 1.4rem; }
.admin-tabs { display: flex; gap: .3rem; overflow-x: auto; border-bottom: 1px solid var(--line); margin-top: 1rem; }
.admin-tabs a { padding: .7rem 1rem; text-decoration: none; color: var(--muted); font-weight: 700; white-space: nowrap; border-bottom: 3px solid transparent; }
.admin-tabs a.active { color: var(--red); border-bottom-color: var(--red); }
.admin { padding-top: 1.4rem; }
.admin-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: .8rem; }
@media (max-width: 900px) { .admin-cards { grid-template-columns: 1fr 1fr; } }
.a-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1rem; text-decoration: none; color: var(--text); display: flex; flex-direction: column; }
.a-card b { font-family: var(--font-head); font-size: 2rem; color: var(--red); line-height: 1.1; }
.a-card small { color: var(--muted); }
.a-card:hover { border-color: var(--red); }
.admin-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin: 1.2rem 0; }
.chip-row { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { padding: .35rem .9rem; border-radius: 999px; border: 1px solid var(--line-strong); text-decoration: none; color: var(--text); font-weight: 600; font-size: .92rem; background: var(--surface); }
.chip.active { background: var(--red); color: #fff; border-color: var(--red); }
.a-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.a-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.a-row:last-child { border-bottom: 0; }
.a-row.draft { background: #fbf8f2; }
.a-row-main { display: flex; gap: .8rem; align-items: center; min-width: 0; flex: 1; }
.a-row-main > div { display: flex; flex-direction: column; min-width: 0; }
.a-row-main img { width: 64px; height: 44px; object-fit: cover; border-radius: 8px; flex: none; }
.a-row-main img.round { width: 44px; border-radius: 50%; }
.a-row-act { display: flex; gap: .4rem; align-items: center; }
.a-row-act form { margin: 0; }
.btn.danger { color: var(--mci); }
.admin-form { display: flex; flex-direction: column; gap: 1rem; max-width: 860px; }
.admin-form > label { display: flex; flex-direction: column; gap: .3rem; font-weight: 700; font-size: .92rem; }
.check { flex-direction: row !important; align-items: center; gap: .5rem !important; font-weight: 600 !important; }
.check input { width: 20px; height: 20px; min-height: 0; }
.check-row { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.cur-img { display: flex; gap: 1rem; align-items: center; }
.cur-img img { width: 140px; height: 90px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.fmt-help { background: var(--surface-2); border-radius: 10px; padding: .6rem .9rem; font-size: .9rem; }
.fmt-help summary { cursor: pointer; font-weight: 700; color: var(--red); }
.fmt-help code { background: #fff; padding: 0 .3em; border-radius: 4px; }

@media (max-width: 1440px) and (min-width: 1181px) { .brand-txt small { display: none; } .nav > ul > li > a, .nav > ul > li > button { padding: .55rem .6rem; } }
@media (max-width: 1440px) and (min-width: 1181px) { .user-btn .hide-md { display: none; } .nav-actions .btn { padding: .55em .9em; } }
.user-drop .ud-name { padding: .4rem .7rem .5rem; font-weight: 700; border-bottom: 1px solid var(--line); margin-bottom: .3rem; }
.btn.armed { background: var(--mci); color: #fff; border-color: var(--mci); }

/* ---------- แกลเลอรีภาพกิจกรรม ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .6rem; margin: .8rem 0 1.4rem; }
.gallery a { display: block; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--surface-2); }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.gallery a:hover img { transform: scale(1.04); }
.group-h .ic { width: 1em; height: 1em; margin-right: .3em; vertical-align: -.1em; color: var(--red); }
.gal-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
.gal-item { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .85rem; }
.gal-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.gal-item .check { display: flex; align-items: center; gap: .35rem; }

/* =====================================================================
   รุ่น 3: หัวเว็บบนมือถือ ปุ่มเข้าสู่ระบบด้านบน วีดีโอ เครื่องมือจัดรูปแบบ
   ===================================================================== */
.only-sm { display: none !important; }
.topline a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; }
.topline .emerg { color: #fff; }
.topline .tl-login { border: 1px solid rgba(255, 255, 255, .55); padding: .12rem .7rem; border-radius: 999px; font-weight: 600; }
.topline .tl-login:hover { background: rgba(255, 255, 255, .15); }
.brand-txt .bt-name { overflow-wrap: anywhere; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--red-strong); text-decoration: underline; text-underline-offset: 3px; }
.fb-link { display: inline-flex; align-items: center; gap: .35rem; }
.fb-link .ic { width: 1.1em; height: 1.1em; }
.tag.vid-tag { background: #111827; color: #fff; }
.vid { position: relative; width: 100%; aspect-ratio: 16 / 9; margin: 1rem 0; border-radius: 14px; overflow: hidden; background: #000; }
.vid iframe, .vid video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.prose blockquote.note-box { margin: 1.2rem 0; padding: .9rem 1.1rem; border-left: 4px solid var(--red); background: var(--red-soft, #fdeef0); border-radius: 0 12px 12px 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.4rem 0; }
.prose h4 { margin: 1rem 0 .3rem; }
.rich-img { max-width: 100%; height: auto; border-radius: 12px; display: block; margin: .8rem 0; }
.links-box { margin: 1.2rem 0; padding: 1rem 1.2rem; border-radius: 14px; background: var(--surface-2, #f8f6f6); border: 1px solid var(--line); }
.links-box h3 { display: flex; align-items: center; gap: .4rem; font-size: 1.05rem; margin: 0 0 .5rem; }
.rich-field { display: flex; flex-direction: column; gap: 0; }
.rich-field .rf-lbl { font-weight: 600; margin-bottom: .35rem; }
.rich-tools { display: flex; flex-wrap: wrap; gap: .25rem; padding: .4rem; border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; background: #faf7f7; }
.rt-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: .3rem .6rem; font: inherit; font-size: .85rem; cursor: pointer; }
.rt-btn:hover { border-color: var(--red); color: var(--red-strong); }
.rich-preview { border: 1px dashed var(--line); padding: 1rem; background: #fff; max-height: 460px; overflow: auto; }
.rich-field textarea { border-top-left-radius: 0; border-top-right-radius: 0; }
@media (max-width: 1180px) {
  .head-quick.only-sm { display: inline-flex !important; }
}
.head-quick { margin-left: auto; align-items: center; gap: .35rem; padding: .45rem .8rem; border-radius: 12px; background: var(--red-strong); color: #fff; text-decoration: none; font-weight: 700; font-size: .9rem; white-space: nowrap; }
.head-quick .ic { width: 1.1em; height: 1.1em; }
@media (max-width: 640px) {
  .topline-in { min-height: 34px; gap: .6rem; flex-wrap: nowrap; justify-content: space-between; }
  .topline .spacer { display: none; }
  .topline { font-size: .8rem; }
  .brand { gap: .5rem; }
  .brand-logos img { height: 36px; }
  .brand-txt b { font-size: 1.05rem; }
  .brand-txt .bt-name { font-size: .78rem; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .head-in { gap: .5rem; }
  .head-quick { padding: .4rem .55rem; font-size: .82rem; }
  .hero-actions .staff-login { display: none; }
}
@media (max-width: 380px) { .head-quick span { display: none; } }
/* หน้าเข้าสู่ระบบ: บนมือถือให้ฟอร์มอยู่บนสุด */
@media (max-width: 860px) {
  .login-wrap { display: flex; flex-direction: column; min-height: 0; }
  .login-card { order: 1; margin-block: 1.2rem; }
  .login-side { order: 2; min-height: 160px; }
}
.topline .tl-phone { display: none; }
@media (max-width: 640px) { .topline .tl-phone { display: inline-flex; } }
.head-quick + .nav-toggle { margin-left: .5rem; }

/* ---------- รุ่น 2.5: หัวเว็บไม่ให้ชื่อหน่วยงานถูกบีบเป็นแนวตั้ง ---------- */
@media (min-width: 1181px) { .site-head .brand { flex: none; } .brand-txt b, .brand-txt .bt-name { white-space: nowrap; } }
@media (max-width: 1440px) and (min-width: 1181px) {
  .nav-actions.authed .btn .bt { display: none; }
  .nav-actions.authed .btn { padding: .55em .75em; }
  .nav > ul > li > a, .nav > ul > li > button { padding: .55rem .5rem; }
}
@media (max-width: 1300px) and (min-width: 1181px) { .brand-logos img { height: 44px; } .brand-txt .bt-name { font-size: .88rem; } }
@media (max-width: 1180px) { .brand-txt .bt-name { white-space: normal; } }
.nav .sub a .ic-ext { width: .85em; height: .85em; margin-left: .25rem; opacity: .6; vertical-align: -1px; }

/* ปุ่มลัดหน้าแรก: ขอใช้รถ Refer / ศูนย์รับ-ส่งต่อ / หน่วยงานภายใน */
.quick.q-refer { border-color: #f5c2c7; background: linear-gradient(135deg, #fff5f6, #fff); }
.quick.q-refer .q-ic { background: var(--red-strong, #a3123a); color: #fff; }
.unit-band { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 900px) { .unit-band { grid-template-columns: 1fr; } }
.unit-card { display: flex; gap: .9rem; align-items: flex-start; padding: 1.1rem 1.2rem; border: 1px solid var(--line, #e5e7eb); border-radius: 18px; background: #fff; text-decoration: none; color: inherit; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); transition: transform .15s, box-shadow .15s; }
.unit-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, .08); }
.unit-card .uc-ic { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--red-soft, #fde8ec); color: var(--red, #861a2f); }
.unit-card .uc-ic .ic { width: 26px; height: 26px; }
.unit-card b { display: block; font-size: 1.05rem; }
.unit-card span { color: var(--muted, #6b7280); font-size: .9rem; }

/* หน้าหน่วยงานย่อย */
.unit-hero-card { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
@media (max-width: 860px) { .unit-hero-card { grid-template-columns: 1fr; } }
.unit-contact { border: 1px solid var(--line, #e5e7eb); border-radius: 18px; padding: 1.1rem 1.2rem; background: #fff; }
.unit-contact h3 { margin: 0 0 .6rem; font-size: 1.05rem; display: flex; gap: .4rem; align-items: center; }
.unit-contact .tel-big { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .7rem; }
.unit-contact .tel-big a { display: inline-flex; gap: .35rem; align-items: center; padding: .5rem .85rem; border-radius: 12px; background: var(--red-soft, #fde8ec); color: var(--red, #861a2f); font-weight: 700; text-decoration: none; font-size: 1.05rem; }
.unit-btns { display: flex; flex-direction: column; gap: .6rem; margin: .8rem 0 0; }
.unit-btns .btn { justify-content: center; white-space: normal; text-align: center; }
.unit-cover { width: 100%; border-radius: 18px; margin-bottom: 1rem; max-height: 380px; object-fit: cover; }
.unit-tools { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }

/* ผลงานและรางวัล / กิจกรรมวิชาการ */
.chip-row.cat-row { margin: 0 0 1.2rem; }
.tag.cat-tag { background: #eef2ff; color: #3730a3; }
.pc-ph.pc-academic { background: linear-gradient(135deg, #e0e7ff, #eef2ff); color: #4338ca; }
.pc-ph.pc-unit { background: linear-gradient(135deg, #fde8ec, #fff1f2); color: #9f1239; }
.page-intro { max-width: 860px; color: var(--muted, #6b7280); margin: 0 0 1.2rem; }
.award-feature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 1.4rem; align-items: center; padding: 1.2rem; border-radius: 22px; background: linear-gradient(135deg, #fffbeb, #fff); border: 1px solid #fde68a; text-decoration: none; color: inherit; }
.award-feature img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 16px; }
.award-feature .af-badge { display: inline-flex; gap: .35rem; align-items: center; padding: .25rem .7rem; border-radius: 999px; background: #f59e0b; color: #fff; font-weight: 700; font-size: .85rem; }
.award-feature h3 { margin: .6rem 0 .4rem; font-size: 1.3rem; line-height: 1.45; }
.award-feature p { color: var(--muted, #6b7280); margin: 0; }
@media (max-width: 800px) { .award-feature { grid-template-columns: 1fr; } }
.staff-card img { object-fit: cover; }
.staff-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.staff-card b { line-height: 1.45; text-wrap: balance; }
.staff-card span { text-wrap: balance; }
@media (max-width: 520px) { .staff-grid { grid-template-columns: 1fr 1fr; gap: .6rem; } .staff-card { padding: .9rem .5rem; } .staff-card img, .staff-ph { width: 88px; height: 88px; } .staff-card b { font-size: .92rem; } }

/* แก้: เมนูบนมือถือ/แท็บเล็ตถูกฉากหลังทับจนกดไม่ได้ (หัวเว็บเป็น stacking context z-index 40 ต่ำกว่าฉากหลัง 65) */
body.nav-open .site-head { z-index: 80; }
@media (max-width: 860px) { .unit-hero-card .unit-contact { order: -1; } }

/* v2.6 developer credit */
.dev-credit { display: block; margin-top: .3rem; font-size: .7rem; letter-spacing: .03em; opacity: .55; }
