/* ==========================================================================
   งานวิทยบริการและเทคโนโลยีสารสนเทศ มรภ.ชัยภูมิ — Public site
   โทนน้ำเงินกรมท่า–ทอง ตามอัตลักษณ์มหาวิทยาลัย
   ========================================================================== */
:root {
  --navy-950: #061733; --navy-900: #0b2a55; --navy-800: #123a70; --navy-700: #1b4a8a; --navy-100: #e6edf7; --navy-50: #f3f6fb;
  --gold: #e0b64a; --gold-600: #c99a26; --gold-100: #fbf1d6;
  --ink: #1d2433; --muted: #5b6475; --line: #dfe5ee; --white: #fff;
  --ok: #1c7a3c; --warn: #b26a00; --bad: #b3261e;
  --radius-lg: 14px; --radius: 10px; --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(var(--sh), .06), 0 8px 22px -10px rgba(var(--sh), .22);
  --font-head: "Bai Jamjuree", "IBM Plex Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  --font-body: "IBM Plex Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  --wrap: 1220px;
  --ov: 6,23,51; --sh: 11,42,85;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body { margin: 0; font: 16.5px/1.7 var(--font-body); color: var(--ink); background: #fff; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--navy-700); text-underline-offset: 3px; }
a:hover { color: var(--navy-900); }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.3; color: var(--navy-900); margin: 0 0 .5em; font-weight: 700; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--navy-900); color: #fff; padding: 8px 14px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.muted { color: var(--muted); } .center { text-align: center; } .small { font-size: 14px; }
[hidden] { display: none !important; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .5em; padding: .62em 1.25em; border-radius: 10px; border: 1.5px solid var(--navy-900); background: var(--navy-900);
  color: #fff; font: 600 15.5px/1.3 var(--font-head); text-decoration: none; cursor: pointer; transition: background .15s, color .15s, transform .15s; }
.btn:hover { background: var(--navy-800); color: #fff; }
.btn-ghost { background: #fff; color: var(--navy-900); border-color: var(--line); }
.btn-ghost:hover { background: var(--navy-50); color: var(--navy-900); border-color: var(--navy-700); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy-950); }
.btn-gold:hover { background: #ecc35a; color: var(--navy-950); }
.btn-sm { padding: .42em .9em; font-size: 14px; }
.btn-lg { padding: .78em 1.6em; font-size: 17px; }
.btn-block { width: 100%; justify-content: center; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row.center { justify-content: center; }

/* Top bar + masthead */
.topbar { background: var(--navy-950); color: #c9d4e6; font-size: 13.5px; }
.topbar-in { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-block: 6px; }
.topbar p { margin: 0; }
.topbar ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 18px; }
.topbar a { color: #e8eef8; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.topbar a:hover { color: var(--gold); }
.libnow.is-open .ic { color: #6fd38e; } .libnow.is-closed .ic { color: #f19a8f; }
.masthead { background: #fff; border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.masthead-in { display: flex; align-items: center; gap: 22px; padding-block: 14px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-width: 0; margin-right: auto; }
.brand-logo { height: 62px; width: auto; }
.brand-mark { width: 56px; height: 56px; flex: none; border-radius: 14px; display: grid; place-items: center; background: var(--navy-900); color: var(--gold);
  font: 700 22px var(--font-head); box-shadow: inset 0 -4px 0 var(--gold); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font: 700 clamp(17px, 2vw, 22px)/1.25 var(--font-head); color: var(--navy-900); }
.brand-text small { font-size: 13px; color: var(--muted); }
.search { display: flex; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.search input { border: 0; padding: 8px 12px; font: inherit; font-size: 14.5px; width: 220px; outline: none; background: transparent; }
.search button { border: 0; background: var(--navy-50); color: var(--navy-900); padding: 0 12px; cursor: pointer; }
.search:focus-within { border-color: var(--navy-700); }
.mast-cta { white-space: nowrap; }
.nav-toggle, .mobile-search { display: none; }
.mainnav { background: var(--navy-900); }
.nav-list { list-style: none; margin: 0 auto; display: flex; align-items: stretch; gap: 2px; }
.nav-item { position: relative; }
.nav-link { display: flex; align-items: center; gap: 6px; padding: 12px 15px; font: 600 15.5px/1.3 var(--font-head); color: #e8eef8; text-decoration: none;
  background: none; border: 0; cursor: pointer; border-bottom: 3px solid transparent; }
.nav-link:hover, .nav-item.is-active > .nav-link { color: #fff; border-bottom-color: var(--gold); background: rgba(255,255,255,.05); }
.nav-link .ic-chev { width: 15px; height: 15px; transition: transform .15s; }
.sub { list-style: none; margin: 0; padding: 8px; position: absolute; top: 100%; left: 0; min-width: 280px; background: #fff; border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translateY(4px); transition: opacity .15s, transform .15s, visibility .15s; }
.nav-item:nth-last-child(-n+2) .sub { left: auto; right: 0; }
.sub a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-size: 15px; }
.sub a:hover, .sub a[aria-current] { background: var(--navy-50); color: var(--navy-900); }
.ic-ext { width: 14px; height: 14px; color: var(--muted); }
@media (hover: hover) and (min-width: 1025px) { .has-sub:hover > .sub { opacity: 1; visibility: visible; transform: none; } .has-sub:hover .ic-chev { transform: rotate(180deg); } }
.has-sub.open > .sub { opacity: 1; visibility: visible; transform: none; }
.has-sub.open .ic-chev { transform: rotate(180deg); }

/* Hero */
.hero { position: relative; color: #fff; overflow: hidden;
  background: radial-gradient(1200px 500px at 85% -10%, rgba(224,182,74,.22), transparent 60%), linear-gradient(135deg, var(--navy-900) 0%, var(--navy-950) 100%); }
.hero::before { content: ""; position: absolute; inset: 0; opacity: .14;
  background-image: linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: linear-gradient(100deg, transparent 30%, #000 75%); -webkit-mask-image: linear-gradient(100deg, transparent 30%, #000 75%); }
.hero-in { position: relative; display: grid; grid-template-columns: 1.2fr 1fr; gap: 44px; align-items: center; padding-block: clamp(36px, 6vw, 70px); }
.eyebrow { font: 600 13px var(--font-head); letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin-bottom: 10px; }
.hero h1 { color: #fff; font-size: clamp(28px, 3.4vw, 42px); line-height: 1.25; margin-bottom: 12px; }
.hero-text { color: #c9d4e6; font-size: 17px; max-width: 34em; }
.finder { background: #fff; border-radius: var(--radius-lg); padding: 8px; box-shadow: 0 18px 40px -16px rgba(0,0,0,.5); max-width: 620px; }
.finder-tabs { display: flex; gap: 4px; padding: 2px 2px 8px; }
.finder-tabs button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 7px 12px; border-radius: 8px; cursor: pointer;
  font: 600 14.5px var(--font-head); color: var(--muted); }
.finder-tabs button[aria-selected="true"] { background: var(--navy-50); color: var(--navy-900); }
.finder-form { display: flex; gap: 8px; }
.finder-form input { flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; font: inherit; font-size: 16px; }
.finder-form input:focus { border-color: var(--navy-700); outline: 2px solid var(--navy-100); }
.finder-form button { border: 0; border-radius: 10px; background: var(--gold); color: var(--navy-950); font: 700 16px var(--font-head); padding: 0 22px; cursor: pointer; }
.finder-form.solo { max-width: 720px; margin-bottom: 18px; }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.quick-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius-lg); background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12); color: #fff; text-decoration: none; font: 600 15.5px/1.35 var(--font-head); backdrop-filter: blur(4px); transition: background .15s, transform .15s; }
.quick-item:hover { background: rgba(255,255,255,.14); color: #fff; transform: translateY(-2px); }
.quick-ic { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 11px; background: #fff; color: var(--c); }
.quick-ic .ic { width: 22px; height: 22px; }

/* Pulse strip */
.pulse { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 14px; margin-top: -26px; position: relative; z-index: 2; }
.pulse-item { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); text-decoration: none; color: var(--ink); }
.pulse-item b { display: block; font: 600 15.5px/1.3 var(--font-head); color: var(--navy-900); }
.pulse-item small { color: var(--muted); font-size: 13.5px; }
.pulse-item:hover b { color: var(--navy-700); }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 18%, transparent); }
.dot.ok { background: var(--ok); color: var(--ok); } .dot.warn { background: var(--warn); color: var(--warn); } .dot.off { background: #99a2b1; color: #99a2b1; }
.pulse-track .ic { color: var(--navy-700); width: 22px; height: 22px; }
.pulse-track input { flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 15px; }
.pulse-track button { border: 0; background: var(--navy-900); color: #fff; border-radius: 8px; padding: 9px 14px; font: 600 14.5px var(--font-head); cursor: pointer; }

/* Blocks */
.block { padding-block: 40px 6px; }
.block-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.block-head h2 { font-size: clamp(22px, 2.4vw, 28px); margin: 0; position: relative; padding-bottom: 8px; }
.block-head h2::after { content: ""; position: absolute; left: 0; bottom: 0; width: 44px; height: 4px; border-radius: 4px; background: var(--gold); }
.more { display: inline-flex; align-items: center; gap: 6px; font: 600 15px var(--font-head); text-decoration: none; white-space: nowrap; }
.empty { padding: 26px; border: 1.5px dashed var(--line); border-radius: var(--radius-lg); background: var(--navy-50); color: var(--muted); text-align: center; }
.empty.small { padding: 16px; font-size: 14.5px; }

.units { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.unit-card { position: relative; display: flex; flex-direction: column; padding: 26px 24px 22px; border-radius: var(--radius-lg); text-decoration: none; color: var(--ink);
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 9%, #fff), #fff 60%); border: 1px solid var(--line); border-top: 5px solid var(--c); overflow: hidden; transition: box-shadow .2s, transform .2s; }
.unit-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); color: var(--ink); }
.unit-card > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .08; }
.unit-ic { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 14px; background: var(--c); color: #fff; margin-bottom: 14px; position: relative; }
.unit-ic .ic { width: 28px; height: 28px; }
.unit-card h3 { font-size: 21px; position: relative; margin-bottom: 4px; }
.unit-card p { color: var(--muted); position: relative; flex: 1; }
.unit-card .more { color: var(--c); position: relative; }

.banner { position: relative; aspect-ratio: 16 / 5; border-radius: var(--radius-lg); overflow: hidden; background: var(--navy-900); }
.banner .slide { position: absolute; inset: 0; opacity: 0; transition: opacity .8s; }
.banner .slide.is-on { opacity: 1; z-index: 1; }
.banner img { width: 100%; height: 100%; object-fit: cover; }
.banner .slide::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(var(--ov),.82), rgba(var(--ov),0) 65%); }
.slide-copy { position: absolute; z-index: 2; left: 0; top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: 0 clamp(20px, 4vw, 48px); max-width: 60%; color: #fff; }
.slide-copy h2 { color: #fff; font-size: clamp(20px, 2.8vw, 34px); }
.hero-nav { position: absolute; top: 50%; z-index: 3; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.2); color: #fff; display: grid; place-items: center; cursor: pointer; }
.hero-nav.prev { left: 12px; } .hero-nav.next { right: 12px; }
.hero-dots { position: absolute; z-index: 3; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
.hero-dots button { width: 9px; height: 9px; border-radius: 9px; border: 0; padding: 0; background: rgba(255,255,255,.5); cursor: pointer; }
.hero-dots button[aria-selected="true"] { width: 24px; background: var(--gold); }

.news-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.news-grid-list { grid-template-columns: repeat(3, 1fr); }
.news-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: #fff; }
.news-card:hover { box-shadow: var(--shadow); }
.news-thumb { position: relative; aspect-ratio: 16/10; background: var(--navy-50); overflow: hidden; display: block; }
.news-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.news-card:hover .news-thumb img { transform: scale(1.04); }
.noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--navy-100); }
.noimg .ic { width: 48px; height: 48px; color: #b9c6da; }
.news-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.news-meta { font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.news-body h3, .news-body .h3 { font-size: 17px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.news-body h3 a, .news-body .h3 a { color: var(--navy-900); text-decoration: none; }
.news-body p { font-size: 14.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }
.date-tag { position: absolute; left: 12px; top: 12px; background: var(--navy-900); color: #fff; border-radius: 8px; padding: 5px 9px; text-align: center; font: 500 12px/1.2 var(--font-head); }
.date-tag b { display: block; font-size: 21px; }
.readmore { margin-top: auto; padding-top: 8px; display: inline-flex; align-items: center; gap: 6px; font: 600 14.5px var(--font-head); text-decoration: none; }

.split { display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; }
.svc-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.svc-list a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); height: 100%; }
.svc-list a:hover { border-color: var(--c); background: color-mix(in srgb, var(--c) 5%, #fff); }
.svc-list b { display: block; font: 600 15px/1.35 var(--font-head); color: var(--navy-900); }
.svc-list small { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.svc-list .go { margin-left: auto; color: var(--muted); }
.svc-ic { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 11px; background: color-mix(in srgb, var(--c, var(--navy-700)) 12%, #fff); color: var(--c, var(--navy-700)); }
.svc-ic .ic { width: 22px; height: 22px; }
.course-mini { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.course-mini b { display: block; font: 600 15.5px/1.4 var(--font-head); color: var(--navy-900); }
.course-mini small { display: block; color: var(--muted); font-size: 13.5px; }
.course-mini em, .course-body em { font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--ok); }
.course-mini em.full, .course-body em.full { color: var(--bad); }
.cal { width: 56px; flex: none; text-align: center; background: var(--navy-900); color: #fff; border-radius: 10px; padding: 6px 0; font: 500 12px/1.2 var(--font-head); }
.cal b { display: block; font-size: 22px; color: var(--gold); }

.books { display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px; }
.books-wide { grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); }
.book { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 4px; }
.cover { aspect-ratio: 2/3; border-radius: 4px 8px 8px 4px; overflow: hidden; background: var(--navy-50); display: grid; place-items: center; box-shadow: -3px 0 0 var(--navy-800) inset, 0 10px 20px -10px rgba(var(--sh),.45); margin-bottom: 6px; transition: transform .2s; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover .ic { width: 40px; height: 40px; color: #9fb0c9; }
.book:hover .cover { transform: translateY(-4px); }
.book b { font: 600 14.5px/1.4 var(--font-head); color: var(--navy-900); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book small { color: var(--muted); font-size: 13px; }
.callno { font-family: ui-monospace, monospace; }

.stats { margin-top: 44px; background: var(--navy-900); color: #fff; }
.stats-in { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 24px; align-items: center; padding-block: 30px; }
.stats h2 { color: #fff; font-size: 21px; margin: 0; } .stats h2 small { color: var(--gold); font-size: 15px; font-weight: 500; }
.stats div b { display: block; font: 700 36px/1.1 var(--font-head); color: var(--gold); }
.stats div span { color: #c9d4e6; font-size: 14.5px; }

/* Footer */
.sitefoot { background: var(--navy-950); color: #c9d4e6; }
main + .sitefoot { margin-top: 56px; }
.stats + * {}
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr auto; gap: 36px; padding-block: 40px; }
.sitefoot h2 { color: #fff; font-size: 17px; margin-bottom: 8px; }
.foot-sub { font-size: 14px; }
.foot-contact, .foot-col ul { list-style: none; padding: 0; margin: 0; font-size: 14.5px; }
.foot-contact li { display: flex; gap: 10px; margin-bottom: 6px; } .foot-contact .ic { color: var(--gold); margin-top: .25em; }
.foot-col li { margin-bottom: 6px; } .foot-col li::before { content: "›"; color: var(--gold); margin-right: 8px; }
.sitefoot a { color: #fff; text-decoration: none; } .sitefoot a:hover { color: var(--gold); }
.foot-meta { text-align: center; }
.foot-soc { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.soc { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--navy-800); color: #fff; }
.soc .ic { width: 18px; height: 18px; } .soc-fb { background: #1877f2; } .soc-line { background: #06c755; }
.counter-label { font-size: 13.5px; margin-bottom: 6px; }
.counter { display: inline-flex; gap: 3px; margin: 0 0 14px; }
.counter span { min-width: 22px; padding: 3px 0; background: #000c20; border: 1px solid rgba(255,255,255,.15); border-radius: 4px; font: 600 16px/1.3 var(--font-head); color: var(--gold); }
.staff-login { font-size: 13.5px; } .staff-login a { display: inline-flex; gap: 6px; align-items: center; opacity: .8; }
.foot-bar { border-top: 1px solid rgba(255,255,255,.1); font-size: 13.5px; }
.foot-bar-in { display: flex; justify-content: space-between; align-items: center; padding-block: 12px; } .foot-bar p { margin: 0; }
.totop { display: inline-flex; align-items: center; gap: 6px; }

/* Inner pages */
.pagehead { background: linear-gradient(110deg, var(--navy-900), var(--navy-800)); color: #fff; padding: 26px 0 30px; position: relative; overflow: hidden; }
.pagehead::after { content: ""; position: absolute; right: -60px; bottom: -120px; width: 340px; height: 340px; border-radius: 50%; border: 40px solid rgba(224,182,74,.12); }
.pagehead h1 { color: #fff; font-size: clamp(24px, 3vw, 34px); margin: 4px 0 0; position: relative; z-index: 1; }
.pagehead .lead { margin: 6px 0 0; color: #c9d4e6; max-width: 52em; position: relative; z-index: 1; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: #aebbd2; position: relative; z-index: 1; } .crumbs a { color: #fff; }
.content { padding-block: 34px 10px; }
.content.narrow { max-width: 900px; }
.prose { max-width: 50em; }
.prose h2 { font-size: 23px; margin-top: 1.4em; } .prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 19px; }
.prose img { border-radius: var(--radius); margin-block: 1em; }
.prose blockquote { margin: 1em 0; padding: .4em 1.2em; border-left: 4px solid var(--gold); background: var(--gold-100); }
.prose table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.prose td, .prose th { border: 1px solid var(--line); padding: 8px 10px; }
.prose li { margin-bottom: .35em; }
.prose .btn { color: #fff; }
.prose .ql-align-center { text-align: center; } .prose .ql-align-right { text-align: right; } .prose .ql-align-justify { text-align: justify; }
.prose iframe, .prose .ql-video { display: block; max-width: 100%; width: 100%; aspect-ratio: 16/9; height: auto; border: 0; border-radius: var(--radius); }
.intro { color: #3b4456; max-width: 52em; }
.updated { font-size: 14px; color: var(--muted); margin-top: 2em; }
.sec-title { font-size: 22px; margin: 34px 0 16px; display: flex; align-items: center; gap: 10px; }
.sec-title:first-child { margin-top: 0; }
.sub-title { font-size: 16px; color: var(--muted); margin: 18px 0 10px; }
.unit-dot { width: 12px; height: 12px; border-radius: 4px; background: var(--c, var(--navy-700)); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { padding: 6px 14px; border: 1.5px solid var(--line); border-radius: 999px; text-decoration: none; font: 600 14.5px var(--font-head); color: var(--navy-900); background: #fff; }
.chips a[aria-current] { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.chips.small a { font-size: 13px; padding: 4px 11px; }
.filterbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.filter-input { border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 15px; min-width: 240px; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 30px; }
.pager a { min-width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); text-decoration: none; font-weight: 600; }
.pager a[aria-current] { background: var(--navy-900); color: #fff; }
.back { margin-top: 28px; } .back a { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-decoration: none; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); background: var(--gold-100); color: #5a4300; font-size: 15px; }
.notice .ic { margin-top: .25em; }
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert-success { background: #e8f5ec; border-color: #b8dfc4; color: #1c5a2e; }
.alert-error { background: #fdecee; border-color: #f3bcc3; color: #8a1020; }
.alert-info { background: var(--navy-50); border-color: var(--navy-100); color: var(--navy-900); }

/* Unit page */
.unit-head { color: #fff; padding: 28px 0 34px; background: linear-gradient(110deg, color-mix(in srgb, var(--c) 82%, #000) 0%, var(--c) 100%), var(--img, none) center / cover; position: relative; }
.unit-head h1 { color: #fff; font-size: clamp(24px, 3.2vw, 36px); margin: 10px 0 4px; }
.unit-head .lead { color: rgba(255,255,255,.88); margin-bottom: 18px; }
.unit-ic.big { background: rgba(255,255,255,.16); margin: 14px 0 0; }
.unit-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; align-items: start; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 16px; }
.svc-card { display: flex; flex-direction: column; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; scroll-margin-top: 20px; }
.svc-card:target { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); }
.svc-card h3 { font-size: 17.5px; margin: 12px 0 6px; }
.svc-card > p { color: #46505f; font-size: 15px; }
.svc-unit { font: 600 12.5px var(--font-head); color: var(--c, var(--muted)); margin: 12px 0 0; text-transform: uppercase; letter-spacing: .03em; }
.svc-unit + h3 { margin-top: 2px; }
.svc-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 13.5px; color: var(--muted); }
.svc-card details { margin-bottom: 10px; font-size: 15px; } .svc-card summary { cursor: pointer; font-weight: 600; color: var(--navy-700); }
.svc-go { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; font: 600 15px var(--font-head); color: var(--c); text-decoration: none; }
.unit-side { position: sticky; top: 16px; display: grid; gap: 16px; }
.side-box { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; background: var(--navy-50); }
.side-box h2 { font-size: 17px; }
.contact-mini, .side-links { list-style: none; margin: 0 0 6px; padding: 0; font-size: 15px; }
.contact-mini li { display: flex; gap: 10px; margin-bottom: 8px; } .contact-mini .ic { margin-top: .25em; color: var(--navy-700); }
.side-links li { border-bottom: 1px solid var(--line); } .side-links li:last-child { border: 0; }
.side-links a { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; text-decoration: none; color: var(--ink); }
.side-links a:hover { color: var(--navy-700); } .side-links .ic { margin-top: .25em; color: var(--navy-700); }
.side-links small { display: block; color: var(--muted); font-size: 12.5px; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 14px; }
.person { display: flex; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; }
.person.is-head { border-color: var(--gold); background: var(--gold-100); }
.person img, .avatar { width: 76px; height: 92px; flex: none; object-fit: cover; border-radius: 10px; background: var(--navy-50); display: grid; place-items: center; }
.avatar .ic { width: 34px; height: 34px; color: #9fb0c9; }
.person h3 { font-size: 16.5px; margin-bottom: 2px; }
.person p { margin: 0 0 2px; font-size: 14px; } .person .pos { color: var(--navy-700); font-weight: 500; } .person .duty { color: var(--muted); }
.person .ct { display: flex; gap: 6px; align-items: center; color: #46505f; word-break: break-all; }
.faq { display: grid; gap: 10px; }
.faq details { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.faq summary { padding: 14px 16px; cursor: pointer; font: 600 16px/1.45 var(--font-head); color: var(--navy-900); list-style: none; display: flex; gap: 10px; align-items: flex-start; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+"; color: var(--gold-600); font-size: 20px; line-height: 1.1; }
.faq details[open] summary::before { content: "–"; }
.faq .prose { padding: 0 16px 14px 42px; }
.tag { font-size: 11.5px; font-weight: 700; color: #fff; background: var(--c); border-radius: 6px; padding: 1px 6px; margin-top: 3px; }

/* e-Service request */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; margin-bottom: 10px; }
.type-card { display: flex; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); text-decoration: none; color: var(--ink); background: #fff; transition: border-color .15s, box-shadow .15s; }
.type-card:hover { border-color: var(--c); box-shadow: var(--shadow); color: var(--ink); }
.type-card b { display: block; font: 600 16px/1.4 var(--font-head); color: var(--navy-900); } .type-card small { color: var(--muted); font-size: 14px; }
.req-form { max-width: 880px; }
.req-head { display: flex; gap: 16px; align-items: flex-start; padding: 20px; border-radius: var(--radius-lg); background: color-mix(in srgb, var(--c) 8%, #fff); border-left: 5px solid var(--c); margin-bottom: 18px; }
.req-head .svc-unit { margin: 0; } .req-head h2 { margin: 0 0 4px; font-size: 22px; } .req-head p { margin: 0; color: #46505f; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px 6px; margin: 18px 0; }
legend { font: 700 16px var(--font-head); color: var(--navy-900); padding: 0 8px; }
.field { margin-bottom: 16px; }
.field label { display: block; font: 600 14.5px var(--font-head); margin-bottom: 5px; color: var(--navy-900); }
.req { color: var(--bad); }
.field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border: 1.5px solid #cfd8e5; border-radius: 9px; font: inherit; font-size: 16px; background: #fff; color: var(--ink); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--navy-700); outline: 2px solid var(--navy-100); }
.field input[type=file] { padding: 8px; font-size: 14.5px; }
.field.cap input { width: 110px; }
.help { font-size: 13.5px; color: var(--muted); margin: 5px 0 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; } .grid-2 .span-2 { grid-column: 1 / -1; }
.grid-2.gap { gap: 30px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 4px; accent-color: var(--navy-900); flex: none; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.done-card { max-width: 620px; margin: 0 auto; text-align: center; padding: 34px 28px; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.done-ic { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: #e3f3e8; color: var(--ok); display: grid; place-items: center; }
.done-ic .ic { width: 34px; height: 34px; }
.code-label { margin: 18px 0 2px; color: var(--muted); font-size: 14px; }
.code { font: 700 34px/1.2 ui-monospace, "Bai Jamjuree", monospace; letter-spacing: .06em; color: var(--navy-900); background: var(--gold-100); border: 2px dashed var(--gold); border-radius: 12px; padding: 10px 18px; display: inline-block; cursor: copy; }

/* Tracking */
.track-form { max-width: 620px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.ticket { max-width: 860px; border: 1px solid var(--line); border-radius: 18px; padding: 24px 26px; border-top: 6px solid var(--c); }
.ticket-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.ticket-head h2 { font-size: 22px; margin: 2px 0 4px; } .ticket-head .svc-unit { margin: 0; }
.st { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 5px 12px; border-radius: 999px; font: 600 14px var(--font-head);
  color: var(--sc); background: color-mix(in srgb, var(--sc) 12%, #fff); border: 1px solid color-mix(in srgb, var(--sc) 30%, #fff); }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--sc); }
.progress-steps { list-style: none; padding: 0; margin: 10px 0 20px; display: grid; grid-template-columns: repeat(3, 1fr); counter-reset: s; }
.progress-steps li { position: relative; text-align: center; font-size: 14px; color: var(--muted); padding-top: 34px; }
.progress-steps li span { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 24px; height: 24px; border-radius: 50%; background: #e2e7ef; border: 3px solid #fff; box-shadow: 0 0 0 2px #e2e7ef; z-index: 1; }
.progress-steps li::before { content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 3px; background: #e2e7ef; }
.progress-steps li:first-child::before { display: none; }
.progress-steps li.on { color: var(--navy-900); font-weight: 600; }
.progress-steps li.on span { background: var(--ok); box-shadow: 0 0 0 2px var(--ok); }
.progress-steps li.on::before { background: var(--ok); }
.facts { display: grid; margin: 16px 0 22px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.facts div { display: grid; grid-template-columns: 190px 1fr; border-bottom: 1px solid var(--line); } .facts div:last-child { border: 0; }
.facts dt { background: var(--navy-50); padding: 9px 14px; font: 600 14.5px var(--font-head); color: var(--navy-900); }
.facts dd { margin: 0; padding: 9px 14px; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 8px; }
.timeline li { position: relative; padding: 0 0 16px 24px; border-left: 2px solid var(--line); }
.timeline li:last-child { border-color: transparent; }
.tl-dot { position: absolute; left: -8px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--sc); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--sc); }
.tl-time { font-size: 13.5px; color: var(--muted); margin: 0 0 2px; } .timeline p { margin: 0; }
.rate { margin-top: 20px; padding: 20px; border-radius: var(--radius-lg); background: var(--gold-100); }
.rate h3 { font-size: 18px; }
.stars { color: var(--gold-600); font-size: 22px; letter-spacing: 2px; } .stars span { color: #d8d0b8; }
.star-input { display: inline-flex; flex-direction: row-reverse; gap: 4px; margin-bottom: 12px; }
.star-input input { position: absolute; opacity: 0; }
.star-input label { font-size: 36px; color: #d8d0b8; cursor: pointer; line-height: 1; transition: color .1s; }
.star-input label:hover, .star-input label:hover ~ label, .star-input input:checked ~ label { color: var(--gold-600); }
.star-input input:focus-visible + label { outline: 3px solid var(--navy-700); border-radius: 4px; }

/* Library */
.lib-top { display: grid; grid-template-columns: 340px 1fr; gap: 22px; margin-bottom: 30px; }
.lib-now { border-radius: var(--radius-lg); padding: 22px; color: #fff; background: linear-gradient(140deg, #1f7a4d, #14573a); }
.lib-now.closed { background: linear-gradient(140deg, #4b5567, #2c3443); }
.lib-state { display: flex; align-items: center; gap: 10px; font: 600 16px var(--font-head); margin-bottom: 6px; }
.lib-state .dot.ok { background: #8ff0b0; color: #8ff0b0; }
.lib-today { opacity: .9; margin: 0; } .lib-time { font: 700 30px/1.3 var(--font-head); margin: 4px 0 0; } .lib-note { margin: 8px 0 0; opacity: .9; font-size: 14.5px; }
.lib-search { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; }
.lib-search h2 { font-size: 20px; }
.hours { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.hours th, .hours td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.hours th { font: 600 15px var(--font-head); color: var(--navy-900); width: 45%; }
.hours tr.today { background: var(--gold-100); }
.closures { list-style: none; padding: 0; margin: 0; } .closures li { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.closures span { color: var(--muted); font-size: 14.5px; }
.eres { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 12px; }
.eres-card { display: flex; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); text-decoration: none; color: var(--ink); }
.eres-card:hover { border-color: var(--navy-700); box-shadow: var(--shadow); }
.eres-card img { width: 64px; height: 42px; object-fit: contain; flex: none; }
.eres-card b { display: flex; gap: 6px; align-items: center; font: 600 15.5px var(--font-head); color: var(--navy-900); }
.eres-card small { display: block; color: var(--muted); font-size: 14px; } .eres-card em { display: block; font-size: 12.5px; color: var(--ok); font-style: normal; margin-top: 2px; }

/* Courses */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 18px; }
.course-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; text-decoration: none; color: var(--ink); }
.course-card:hover { box-shadow: var(--shadow); }
.course-img { position: relative; aspect-ratio: 16/9; background: linear-gradient(135deg, var(--navy-800), var(--navy-950)); display: grid; place-items: center; }
.course-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.course-img > .ic { width: 52px; height: 52px; color: var(--gold); }
.course-img .cal { position: absolute; left: 12px; top: 12px; }
.course-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; }
.course-body b { font: 600 16.5px/1.4 var(--font-head); color: var(--navy-900); } .course-body small { color: var(--muted); }
.course-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; align-items: start; }
.article-title { font-size: clamp(23px, 2.8vw, 31px); }
.article-cover { width: 100%; max-height: 520px; object-fit: cover; border-radius: var(--radius-lg); margin-bottom: 18px; }
.lead-dark { font-size: 18px; color: #3b4456; }
.reg-box { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; background: var(--navy-50); }
.reg-box h2 { font-size: 19px; }
.past-list { list-style: none; padding: 0; } .past-list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.past-list small { color: var(--muted); white-space: nowrap; }

/* Status */
.sys-summary { display: flex; gap: 12px; align-items: center; padding: 16px 20px; border-radius: var(--radius-lg); margin-bottom: 18px; font-size: 17px; }
.sys-summary.ok { background: #e8f5ec; color: var(--ok); } .sys-summary.warn { background: #fff3dc; color: var(--warn); }
.sys-summary .ic { width: 26px; height: 26px; }
.sys-list { list-style: none; margin: 0 0 20px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.sys-list li { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.sys-list li:last-child { border: 0; }
.sys-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--sc); flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--sc) 18%, transparent); }
.sys-list div { flex: 1; } .sys-list b { font: 600 16px var(--font-head); } .sys-list b a { color: var(--navy-900); } .sys-list div p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.sys-label { text-align: right; font: 600 14.5px var(--font-head); color: var(--sc); } .sys-label small { display: block; color: var(--muted); font: 400 12.5px var(--font-body); }

/* Documents */
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.doc-row { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.doc-ic { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--navy-50); color: var(--navy-700); }
.doc-ic .ic { width: 24px; height: 24px; }
.doc-info { flex: 1; min-width: 0; } .doc-info h3 { font-size: 16.5px; margin: 0 0 2px; } .doc-info p { margin: 0; font-size: 14.5px; color: #46505f; }
.doc-meta { color: var(--muted) !important; font-size: 13px !important; margin-top: 4px !important; }
.doc-act { display: flex; gap: 8px; flex-wrap: wrap; }

/* Contact */
.contact { display: grid; grid-template-columns: 1fr 1.1fr; gap: 26px; align-items: start; }
.contact-card { padding: 24px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: #fff; margin-bottom: 20px; }
.contact-card h2 { font-size: 20px; }
.org-sub { color: var(--muted); }
.contact-list { margin: 0; } .contact-list div { padding: 10px 0; border-top: 1px solid var(--line); }
.contact-list dt { display: flex; align-items: center; gap: 8px; font: 600 14.5px var(--font-head); color: var(--navy-700); }
.contact-list dd { margin: 2px 0 0 28px; word-break: break-word; }
.contact-units { list-style: none; padding: 0; margin: 0; } .contact-units li { padding: 10px 0 10px 14px; border-left: 4px solid var(--c); margin-bottom: 8px; background: var(--navy-50); border-radius: 0 8px 8px 0; }
.contact-units b { display: block; } .contact-units span { font-size: 14px; color: var(--muted); }
.map iframe { width: 100%; min-height: 360px; border: 0; border-radius: var(--radius-lg); }

/* News detail (shared) */
.news-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 44px; align-items: start; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 14.5px; }
.article-meta .sep { width: 1px; height: 14px; background: var(--line); margin-inline: 8px; }
.article-cover img { width: 100%; max-height: 560px; object-fit: cover; border-radius: var(--radius-lg); }
figure.article-cover { margin: 8px 0 22px; }
.btn-fb { background: #1877f2; border-color: #1877f2; }
.gallery-title { font-size: 21px; margin-top: 32px; } .gallery-title small { font: 400 15px var(--font-body); color: var(--muted); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 8px; }
.gallery a { aspect-ratio: 4/3; border-radius: 8px; overflow: hidden; background: var(--navy-50); }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.news-side { position: sticky; top: 16px; }
.news-side h2 { font-size: 19px; padding-bottom: 8px; border-bottom: 3px solid var(--gold); }
.side-news { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.side-news img { width: 92px; height: 66px; object-fit: cover; border-radius: 8px; flex: none; }
.side-news b { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font: 600 14.5px/1.45 var(--font-head); color: var(--navy-900); }
.side-news small { color: var(--muted); font-size: 13px; }
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(4, 12, 28, .94); display: grid; place-items: center; }
.lightbox img { max-width: 92vw; max-height: 86vh; border-radius: 6px; }
.lb-close, .lb-nav { position: absolute; border: 0; background: rgba(255,255,255,.14); color: #fff; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.lb-close { top: 16px; right: 16px; } .lb-prev { left: 16px; top: 50%; } .lb-next { right: 16px; top: 50%; }
.lb-count { position: absolute; bottom: 14px; color: #fff; margin: 0; font-size: 14px; }
.results { list-style: none; padding: 0; margin: 0; } .results li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.results h2 { font-size: 18px; margin: 2px 0 4px; } .results p { margin: 0; color: #46505f; font-size: 15px; }
.r-type { font: 600 13px var(--font-head); color: var(--gold-600); }

/* Responsive */
@media (max-width: 1100px) {
  .news-grid { grid-template-columns: repeat(2, 1fr); } .news-grid-list { grid-template-columns: repeat(2, 1fr); }
  .books { grid-template-columns: repeat(3, 1fr); }
  .hero-in, .split, .unit-layout, .course-layout, .news-layout, .lib-top { grid-template-columns: 1fr; }
  .unit-side, .news-side { position: static; }
  .pulse { grid-template-columns: 1fr 1fr; } .pulse-track { grid-column: 1 / -1; }
  .stats-in { grid-template-columns: repeat(3, 1fr); } .stats h2 { grid-column: 1 / -1; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1024px) {
  .search:not(.mobile-search), .mast-cta { display: none; }
  .topbar p { display: none; }
  .nav-toggle { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); background: #fff; color: var(--navy-900); padding: 8px 12px; border-radius: 10px; font: 600 15px var(--font-head); cursor: pointer; }
  .mainnav { display: none; } .mainnav.open { display: block; }
  .mainnav .mobile-search { display: flex; margin: 12px 20px 4px; } .mobile-search input { flex: 1; width: auto; }
  .nav-list { flex-direction: column; padding-block: 6px; }
  .nav-link { width: 100%; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.1); padding: 12px 4px; }
  .sub { position: static; display: none; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; border-radius: 8px; margin: 4px 0 8px; }
  .has-sub.open > .sub { display: block; }
  .units { grid-template-columns: 1fr; }
  .contact { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  body { font-size: 16px; }
  .topbar ul { gap: 12px; font-size: 12.5px; } .topbar li:nth-child(2) { display: none; }
  .brand-mark { width: 46px; height: 46px; font-size: 18px; } .brand-logo { height: 48px; } .brand-text small { display: none; }
  .quick { grid-template-columns: 1fr 1fr; } .quick-item { font-size: 14px; padding: 12px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .pulse { grid-template-columns: 1fr; margin-top: 16px; }
  .news-grid, .news-grid-list, .svc-list { grid-template-columns: 1fr; }
  .books { grid-template-columns: repeat(2, 1fr); }
  .banner { aspect-ratio: 4/3; } .slide-copy { max-width: 100%; justify-content: flex-end; padding-bottom: 36px; }
  .banner .slide::after { background: linear-gradient(0deg, rgba(var(--ov),.88), rgba(var(--ov),.1)); }
  .grid-2, .grid-2.gap { grid-template-columns: 1fr; gap: 0; }
  .facts div { grid-template-columns: 1fr; }
  .ticket { padding: 18px; } .ticket-head { flex-direction: column; }
  .doc-row { flex-wrap: wrap; } .doc-act { width: 100%; }
  .stats-in { grid-template-columns: 1fr 1fr; } .foot-grid { grid-template-columns: 1fr; }
  .foot-bar-in { flex-direction: column; gap: 6px; text-align: center; }
  .code { font-size: 26px; }
  .sys-list li { flex-wrap: wrap; } .sys-label { text-align: left; width: 100%; padding-left: 28px; }
}
@media print { .topbar, .masthead, .sitefoot, .news-side, .unit-side { display: none; } }

/* ป้องกันเนื้อหาล้นจอบนมือถือ (grid item ค่าเริ่มต้น min-width: auto) */
.pulse > *, .lib-top > *, .split > *, .hero-in > *, .grid-2 > *, .unit-layout > *, .course-layout > *, .news-layout > *, .contact > * { min-width: 0; }
.pulse-track input, .finder-form input { width: 100%; }
@media (max-width: 680px) { .hero h1 { font-size: 27px; } .lib-time { font-size: 26px; } }

/* ---------- Hero: แบนเนอร์ใหญ่ + ภาพพื้นหลังอัปโหลดได้ ---------- */
.hero { min-height: clamp(460px, 64vh, 660px); display: flex; flex-direction: column; justify-content: center; }
.hero-in { display: block; text-align: center; padding-block: clamp(48px, 8vw, 96px) clamp(70px, 9vw, 110px); position: relative; z-index: 2; }
.hero h1 { font-size: clamp(28px, 4vw, 50px); text-shadow: 0 2px 18px rgba(0,0,0,.35); }
.hero-text { margin-inline: auto; text-shadow: 0 1px 10px rgba(0,0,0,.4); }
.hero-bg { position: absolute; inset: 0; z-index: 0; }
.hero-bg .slide { position: absolute; inset: 0; opacity: 0; transition: opacity 1.4s ease; }
.hero-bg .slide.is-on { opacity: 1; }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.04); }
.hero-bg .slide.is-on img { animation: kenburns 9s ease-out both; }
@keyframes kenburns { from { transform: scale(1.08); } to { transform: scale(1); } }
.hero.has-img::before { z-index: 1; opacity: 1; background: linear-gradient(180deg, rgba(var(--ov),.55) 0%, rgba(var(--ov),.62) 55%, rgba(var(--ov),.85) 100%); mask-image: none; -webkit-mask-image: none; }
.hero .hero-dots { z-index: 3; bottom: 54px; }
.finder { margin: 26px auto 0; max-width: 980px; padding: 12px; text-align: left; border-radius: 16px; }
.finder-tabs { flex-wrap: wrap; }
.finder-form input { padding: 15px 16px; font-size: 17px; }
.finder-form button { padding: 0 30px; font-size: 17px; background: var(--navy-900); color: #fff; }
.finder-form button:hover { background: var(--navy-800); }
.finder-select { flex: none; width: 150px; border: 1.5px solid var(--line); border-radius: 10px; padding: 0 12px; font: inherit; font-size: 16px; background: #fff; color: var(--ink); }
.finder-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 4px 2px; font-size: 14px; color: var(--muted); }
.finder-foot [data-panel][hidden] { display: none; }
.finder-links { display: flex; gap: 16px; margin-left: auto; } .finder-links a { font-weight: 600; }
.quickbar { position: relative; z-index: 3; margin-top: -48px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.quickbar .quick-item { flex-direction: column; text-align: center; justify-content: center; gap: 10px; padding: 18px 10px; background: #fff; color: var(--navy-900);
  border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: none; font-size: 14.5px; }
.quickbar .quick-item:hover { color: var(--c); border-color: var(--c); background: #fff; }
.quickbar .quick-ic { background: color-mix(in srgb, var(--c) 12%, #fff); width: 48px; height: 48px; }
.pulse { margin-top: 18px; }

/* ---------- Slide show ภาพ ---------- */
.showcase { position: relative; aspect-ratio: 16 / 7; border-radius: 18px; overflow: hidden; background: var(--navy-950); box-shadow: var(--shadow); }
.showcase .slide { position: absolute; inset: 0; opacity: 0; transition: opacity .9s; }
.showcase .slide.is-on { opacity: 1; z-index: 1; }
.showcase img { width: 100%; height: 100%; object-fit: cover; }
.showcase .slide-link { display: block; height: 100%; }
.showcase .slide.has-text::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(0deg, rgba(var(--ov),.85) 0%, rgba(var(--ov),0) 55%); }
.showcase .slide-copy { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; top: auto; max-width: none; padding: 0 clamp(20px, 4vw, 44px) clamp(40px, 5vw, 56px); display: block; }
.showcase .slide-copy h3 { color: #fff; font-size: clamp(20px, 2.6vw, 32px); margin-bottom: 4px; }
.showcase .slide-copy p { color: #dfe6f2; margin-bottom: 12px; max-width: 46em; }
.showcase .hero-nav { width: 46px; height: 46px; background: rgba(255,255,255,.22); }
.showcase .hero-nav:hover { background: rgba(255,255,255,.4); }

/* ---------- ตารางการฝึกอบรม ---------- */
.sched-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sched-head h2 { margin: 0; font-size: 24px; text-align: center; } .sched-head small { font-size: 14px; color: var(--muted); font-weight: 400; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.cal-dn { background: var(--navy-900); color: #fff; text-align: center; font: 600 14px var(--font-head); padding: 8px 0; }
.cal-cell { min-height: 104px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-cell:nth-child(7n + 7) { border-right: 0; }
.cal-cell.blank { background: var(--navy-50); }
.cal-cell.today { background: var(--gold-100); }
.cal-d { font: 600 13.5px var(--font-head); color: var(--muted); }
.cal-cell.today .cal-d { color: var(--navy-900); }
.cal-ev { display: block; font-size: 12.5px; line-height: 1.35; padding: 3px 6px; border-radius: 6px; background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--c);
  border-left: 3px solid var(--c); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cal-ev:hover { background: var(--c); color: #fff; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.sched { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 760px; }
.sched th { background: var(--navy-50); text-align: left; font: 600 14px var(--font-head); color: var(--navy-900); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.sched td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.sched tr:last-child td { border-bottom: 0; }
.sched tr.is-past td { color: var(--muted); }
.sched a { text-decoration: none; }
.cstate { display: inline-block; margin-top: 4px; font-size: 13px; font-weight: 600; }
.cstate.open { color: var(--ok); } .cstate.full, .cstate.closed { color: var(--bad); } .cstate.past { color: var(--muted); }
.nowrap { white-space: nowrap; }

@media (max-width: 1100px) { .quickbar { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 680px) {
  .hero-in { padding-block: 40px 70px; text-align: left; }
  .finder-form { flex-wrap: wrap; } .finder-select { width: 100%; height: 44px; } .finder-form button { padding: 12px 20px; flex: 1; }
  .finder-tabs button { font-size: 13px; padding: 6px 9px; }
  .quickbar { grid-template-columns: repeat(2, 1fr); margin-top: -40px; }
  .showcase { aspect-ratio: 4 / 3; }
  .cal-grid { display: none; }
  .sched-head h2 { font-size: 19px; }
}
@media print { .hero, .quickbar, .filterbar, .sched-head .btn, .btn-row { display: none !important; } .cal-grid { display: grid; } .table-wrap { border: 0; } }

.mt-sm { margin-top: 18px; } .lib-search .finder-form.solo { margin-bottom: 8px; } .lib-search h2 { font-size: 18px; }

/* ---------- ปุ่มใช้งานด่วนด้านซ้าย–ขวาของข้อความหลัก ---------- */
.hero-in.has-sides { display: grid; grid-template-columns: 230px minmax(0, 1fr) 230px; grid-template-areas: "left title right" "finder finder finder"; column-gap: 28px; align-items: center; }
.hero-title { grid-area: title; }
.hero-in .finder { grid-area: finder; }
.side-left { grid-area: left; } .side-right { grid-area: right; }
.hero-side { display: flex; flex-direction: column; gap: 10px; }
.side-btn { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; text-align: left; text-decoration: none; color: #fff;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.24); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font: 600 15px/1.35 var(--font-head); box-shadow: 0 8px 22px -12px rgba(0,0,0,.6); transition: background .15s, transform .15s, color .15s; }
.side-btn:hover, .side-btn:focus-visible { background: #fff; color: var(--navy-900); transform: translateX(var(--shift, 4px)); }
.side-right .side-btn { --shift: -4px; flex-direction: row-reverse; text-align: right; }
.side-ic { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 11px; background: #fff; color: var(--c); }
.side-ic .ic { width: 22px; height: 22px; }
.side-btn:hover .side-ic { background: color-mix(in srgb, var(--c) 14%, #fff); }
.hero-in.has-sides { padding-bottom: clamp(60px, 7vw, 90px); }
.pulse { margin-top: -30px; }
@media (max-width: 1100px) {
  .hero-in.has-sides { grid-template-columns: 1fr 1fr; grid-template-areas: "title title" "finder finder" "left right"; row-gap: 18px; column-gap: 12px; }
  .side-right .side-btn { flex-direction: row; text-align: left; --shift: 4px; }
  .pulse { margin-top: 18px; }
}
@media (max-width: 680px) {
  .side-btn { padding: 10px; font-size: 13.5px; gap: 8px; } .side-ic { width: 36px; height: 36px; }
}
.hero-in.has-sides .finder { width: 100%; margin-top: 30px; }
.hero-in.has-sides { grid-template-columns: 250px minmax(0, 1fr) 250px; }
@media (max-width: 1100px) { .hero-in.has-sides { grid-template-columns: 1fr 1fr; } }
.hero-in.has-sides { grid-template-columns: 240px minmax(0, 1fr) 240px; column-gap: 22px; }
.hero-in.has-sides h1 { font-size: clamp(26px, 2.9vw, 42px); }
.hero-in.has-sides .side-btn { font-size: 14.5px; }
@media (max-width: 1100px) { .hero-in.has-sides { grid-template-columns: 1fr 1fr; } .hero-in.has-sides h1 { font-size: clamp(26px, 4.4vw, 40px); } }
@media (max-width: 1100px) { .hero .hero-dots { bottom: 18px; } .hero-in.has-sides { padding-bottom: 56px; } }
@media (max-width: 680px) { .finder-form input { flex: 1 1 100%; } .finder-form button { flex: 1 1 100%; padding: 12px; } .finder-tabs { gap: 2px; } }

/* ---------- คู่มือ ---------- */
.manual-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 18px; margin-bottom: 10px; }
.manual-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; text-decoration: none; color: var(--ink); background: #fff; transition: box-shadow .2s, transform .2s; }
.manual-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); color: var(--ink); }
.manual-cover { position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 16%, #fff), color-mix(in srgb, var(--c) 6%, #fff)); }
.manual-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.manual-cover > .ic { width: 64px; height: 64px; color: var(--c); }
.manual-cover em { position: absolute; top: 10px; right: 10px; font: 700 11.5px var(--font-head); font-style: normal; background: var(--c); color: #fff; padding: 2px 8px; border-radius: 6px; }
.manual-body { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; flex: 1; }
.manual-body b { font: 600 16px/1.45 var(--font-head); color: var(--navy-900); }
.manual-body small { color: var(--muted); font-size: 13.5px; }
.manual-go { margin-top: auto; padding-top: 8px; display: inline-flex; align-items: center; gap: 6px; font: 600 14.5px var(--font-head); color: var(--c); }

/* ---------- สถิติ ---------- */
.stat-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 16px; margin-bottom: 18px; }
.stat-group { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; background: var(--navy-50); }
.stat-group h4 { display: flex; align-items: center; gap: 8px; font-size: 17px; margin-bottom: 6px; color: var(--navy-900); }
.stats-head { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); }
.stats-head h2 { display: flex; flex-direction: column; align-items: center; } .stats-head h2 small { font-size: 13.5px; }
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 24px; }
.kpi { border-radius: var(--radius-lg); padding: 16px; background: var(--navy-900); color: #fff; }
.kpi b { display: block; font: 700 28px/1.2 var(--font-head); }
.kpi span { font-size: 13.5px; opacity: .85; }
.kpi.gold { background: var(--gold-100); color: #5a4300; } .kpi.gold b { color: var(--gold-600); }
.chart-box { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; margin-bottom: 20px; }
.chart-box h3 { font-size: 17px; }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; height: 220px; align-items: end; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bar-fill { width: 100%; max-width: 34px; min-height: 2px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--navy-700), var(--navy-900)); }
.bar-val { font-size: 12px; font-weight: 600; color: var(--navy-900); }
.bar-lab { font-size: 12px; color: var(--muted); }
.hbar { display: grid; grid-template-columns: minmax(0, 1.3fr) 1fr 36px; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 14.5px; }
.hbar > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 10px; background: var(--navy-50); border-radius: 99px; overflow: hidden; } .hbar-track i { display: block; height: 100%; border-radius: 99px; }
.hbar b { text-align: right; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 680px) { .kpis { grid-template-columns: 1fr 1fr; } .kpi b { font-size: 23px; } .bars { height: 170px; gap: 3px; } .bar-lab { font-size: 10.5px; } }

/* แถบเมนู: ไม่ตัดคำกลางเมนู และย่อระยะบนจอกลาง */
.nav-link { white-space: nowrap; }
@media (min-width: 1025px) and (max-width: 1280px) { .nav-link { padding: 12px 10px; font-size: 14.5px; } .nav-list { gap: 0; } }

/* ---------- ฐานข้อมูลวิจัย ---------- */
.db-intro h2 { font-size: 20px; line-height: 1.5; max-width: 60em; }
.db-list { display: grid; gap: 12px; margin-top: 16px; }
.db-card { display: grid; grid-template-columns: 44px minmax(0, 1fr) 220px; gap: 16px; align-items: start; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; }
.db-card:hover { border-color: var(--navy-700); box-shadow: var(--shadow); }
.db-no { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--navy-900); color: var(--gold); font: 700 17px var(--font-head); }
.db-main h3 { font-size: 18px; margin-bottom: 2px; } .db-main h3 a { color: var(--navy-900); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.db-subj { font: 600 13.5px var(--font-head); color: var(--navy-700); margin-bottom: 6px; }
.db-main p:last-child { margin: 0; color: #46505f; font-size: 15px; }
.db-act { display: flex; flex-direction: column; gap: 8px; } .db-act .btn { justify-content: center; }
.callout-db { display: flex; align-items: center; gap: 14px; padding: 16px 20px; margin-bottom: 16px; border-radius: var(--radius-lg); text-decoration: none; color: #fff; background: linear-gradient(110deg, var(--navy-900), var(--navy-700)); }
.callout-db > .ic:first-child { width: 34px; height: 34px; color: var(--gold); } .callout-db span { flex: 1; display: flex; flex-direction: column; font-size: 14.5px; opacity: .95; }
.callout-db b { font: 600 17px var(--font-head); } .callout-db:hover { color: #fff; filter: brightness(1.08); }
@media (max-width: 860px) { .db-card { grid-template-columns: 40px minmax(0, 1fr); } .db-act { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; } }

/* ---------- รองรับทุกขนาดจอ / ทุกอุปกรณ์ ---------- */
html { overflow-wrap: break-word; }
body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.sr { left: 0; top: 0; }
img, video, iframe { max-width: 100%; }
.hero-dots button { box-sizing: content-box; padding: 8px 4px; background-clip: content-box; }
.hero-nav, .lb-nav, .lb-close { touch-action: manipulation; }
@media (min-width: 1600px) { :root { --wrap: 1380px; } body { font-size: 17px; } }
@media (min-width: 2200px) { :root { --wrap: 1560px; } }
@media (max-width: 1024px) {
  .mainnav.open { max-height: calc(100vh - 120px); max-height: calc(100dvh - 120px); overflow-y: auto; overscroll-behavior: contain; }
  .search input, .filter-input, .pulse-track input { font-size: 16px; } /* iOS ไม่ซูมเมื่อแตะช่องกรอก */
  .filter-input { min-width: 0; width: 100%; }
}
@media (max-width: 480px) {
  .wrap { padding-inline: 14px; }
  .block-head { flex-wrap: wrap; }
  .chips { gap: 6px; } .chips a { font-size: 13.5px; padding: 5px 11px; }
  .content { padding-block: 24px 6px; }
  .pagehead { padding: 18px 0 22px; }
  .topbar-in { justify-content: center; } .topbar ul { gap: 10px; }
  .eres-card { flex-direction: column; } .db-card { padding: 14px; gap: 10px; }
  .facts dt, .facts dd { padding: 8px 10px; }
  .ticket { padding: 14px; }
  .sched-head { flex-wrap: wrap; justify-content: center; } .sched-head h2 { order: -1; width: 100%; }
  .stat-group { padding: 14px; }
  .done-card { padding: 24px 16px; } .code { font-size: 22px; letter-spacing: .03em; }
  .star-input label { font-size: 32px; }
  .foot-grid { padding-block: 28px; }
}
@media (max-height: 500px) and (orientation: landscape) { .hero { min-height: auto; } .hero-in { padding-block: 28px 56px; } }
@media (hover: none) { .side-btn:hover, .quick-item:hover { transform: none; } }
@media (max-width: 1024px) { .nav-item:not(.has-sub) > .nav-link { justify-content: flex-start; gap: 8px; } }
@media (max-width: 360px) { .hero-in.has-sides h1, .hero h1 { font-size: 23px; } .brand-text strong { font-size: 15.5px; } }

/* ---------- ระบบบริการออนไลน์ (ดึงจาก service.cpru.ac.th) ---------- */
.portal-sec { margin-top: 44px; padding: 44px 0 48px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(900px 400px at 85% 0%, rgba(224,182,74,.16), transparent 60%), linear-gradient(160deg, var(--navy-900), var(--navy-950)); }
.portal-sec::before { content: ""; position: absolute; inset: 0; opacity: .07; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.6) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.6) 1px, transparent 1px); background-size: 40px 40px; }
.portal-sec .wrap { position: relative; }
.portal-head h2 { color: #fff; } .portal-head p { margin: 10px 0 0; color: #c9d6cf; font-size: 15px; }
.portal-sec .more { color: var(--gold); }
.portal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); gap: 14px; }
.portal-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px 16px 16px; border-radius: 16px; text-decoration: none; overflow: hidden;
  color: #fff; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); transition: transform .2s, background .2s, border-color .2s; min-height: 200px; }
.portal-card::before { content: ""; position: absolute; left: 16px; right: 16px; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--pc), transparent); }
.portal-card::after { content: ""; position: absolute; right: -30px; bottom: -30px; width: 110px; height: 110px; border-radius: 50%; background: var(--pc); opacity: .08; }
.portal-card:hover { transform: translateY(-4px); background: rgba(255,255,255,.1); border-color: color-mix(in srgb, var(--pc) 60%, transparent); color: #fff; }
.portal-ic { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; font-size: 26px; line-height: 1;
  background: color-mix(in srgb, var(--pc) 22%, transparent); border: 1px solid color-mix(in srgb, var(--pc) 40%, transparent); }
.portal-ic img { width: 30px; height: 30px; object-fit: contain; } .portal-ic .ic { width: 26px; height: 26px; color: var(--pc); }
.portal-badge { font: 700 10.5px/1.2 var(--font-head); letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 99px;
  color: color-mix(in srgb, var(--pc) 60%, #fff); background: color-mix(in srgb, var(--pc) 18%, transparent); }
.portal-title { font: 600 15.5px/1.45 var(--font-head); }
.portal-desc { font-size: 13px; opacity: .8; }
.portal-go { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 99px; background: var(--pc); color: #fff; font: 600 13.5px var(--font-head);
  box-shadow: 0 6px 16px -8px var(--pc); position: relative; z-index: 1; }
/* แบบพื้นสว่าง (หน้า systems.php) */
.portal-light .portal-card { color: var(--ink); background: #fff; border-color: var(--line); }
.portal-light .portal-card:hover { color: var(--ink); background: #fff; box-shadow: var(--shadow); }
.portal-light .portal-badge { color: color-mix(in srgb, var(--pc) 75%, #000); }
.portal-light .portal-title { color: var(--navy-900); }
@media (max-width: 480px) { .portal-grid { grid-template-columns: 1fr 1fr; gap: 10px; } .portal-card { min-height: 180px; padding: 14px 12px; } .portal-title { font-size: 14px; } .portal-go { padding: 6px 11px; font-size: 12.5px; } }
