/* ธีมโรงเรียนมังกรกมลาวาสวิทยาลัย: แดงชาด ทอง น้ำเงิน บนพื้นครีม */
:root {
  --red: #8e1b24;
  --red-700: #6b131b;
  --red-900: #3d0a0f;
  --red-50: #fbf0ee;
  --gold: #c99a3b;
  --gold-400: #ddb767;
  --gold-100: #f6ecd6;
  --gold-text: #7a5414;
  --navy: #1d3a6b;
  --navy-700: #142a50;
  --navy-50: #ecf1f9;
  --green: #1f6b4a;
  --green-50: #e7f3ec;
  --purple: #5a2466;
  --purple-50: #f4ebf6;
  --cream: #f8f4ec;
  --paper: #ffffff;
  --ink: #2b211e;
  --muted: #65584f;
  --line: #e8ddcc;
  --shadow: 0 1px 2px rgba(61, 10, 15, 0.06), 0 8px 24px rgba(61, 10, 15, 0.07);
  --radius: 14px;
  --sans: 'Noto Sans Thai', 'IBM Plex Sans Thai', system-ui, sans-serif;
  --serif: 'Noto Serif Thai', 'Noto Serif', 'Noto Sans Thai', serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--cream); line-height: 1.65; font-size: 16px; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--red); }
a:hover { color: var(--red-700); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.fill { fill: currentColor; stroke: none; }

/* ---------- ปุ่ม ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-gold { background: linear-gradient(180deg, var(--gold-400), var(--gold)); color: var(--red-900); border-color: #b98a2e; }
.btn-gold:hover { background: var(--gold); color: var(--red-900); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-700); color: #fff; }
.btn-navy { background: linear-gradient(180deg, #2a4f8f, var(--navy)); color: #fff; }
.btn-navy:hover { background: var(--navy-700); color: #fff; }
.btn-ghost { background: var(--paper); color: var(--red); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--red); color: var(--red-700); }
.btn-light { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.55); backdrop-filter: blur(4px); }
.btn-light:hover { background: rgba(255,255,255,.22); color: #fff; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--red); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- ส่วนหัว ---------- */
.topbar { background: var(--red-900); color: #f3dcc0; font-size: 13.5px; }
.topbar .wrap { display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center; justify-content: space-between; min-height: 38px; }
.topbar a { color: #f3dcc0; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.topbar a:hover { color: #fff; }
.topbar .social { display: flex; gap: 4px; }
.topbar .addr { display: inline-flex; gap: 6px; align-items: center; }
.topbar .social a { width: 34px; justify-content: center; border-radius: 8px; }
.topbar .social a:hover { background: rgba(255,255,255,.1); }
.topbar .icon { width: 16px; height: 16px; }

.site-header { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 74px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand img { width: 44px; height: auto; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 19px; color: var(--red); line-height: 1.25; }
.brand-sub { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.brand-zh { color: var(--gold-text); font-weight: 600; margin-left: 4px; }
.main-nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.main-nav a { text-decoration: none; color: var(--ink); font-weight: 500; font-size: 15px; padding: 0 12px; min-height: 44px; display: inline-flex; align-items: center; border-radius: 8px; }
.main-nav a:hover { background: var(--red-50); color: var(--red); }
.main-nav .btn { margin-left: 8px; }
.main-nav a.btn-navy, .main-nav a.btn-navy:hover { color: #fff; background: var(--navy); }
.menu-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 10px; width: 44px; height: 44px; align-items: center; justify-content: center; cursor: pointer; }

/* ---------- hero ---------- */
.hero { position: relative; color: #fff; background: var(--red-900) url('/assets/img/temple.jpg') center 35% / cover no-repeat; }
.hero::before { content: ''; position: absolute; inset: 0; background: linear-gradient(95deg, rgba(43,6,10,.94) 0%, rgba(61,10,15,.82) 38%, rgba(61,10,15,.25) 72%, rgba(0,0,0,.05) 100%); }
.hero::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: repeating-linear-gradient(90deg, var(--gold) 0 18px, var(--red) 18px 22px); }
.hero .wrap { position: relative; padding-top: 72px; padding-bottom: 132px; }
.hero-badge { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(221,183,103,.5); font-size: 14px; color: #f6e2bd; }
.hero-badge img { width: 30px; height: auto; background: #fff; border-radius: 50%; padding: 2px; }
.hero h1 { font-family: var(--serif); font-size: clamp(34px, 5vw, 58px); line-height: 1.2; margin: 20px 0 6px; font-weight: 700; text-shadow: 0 2px 12px rgba(0,0,0,.35); }
.hero .zh { font-size: clamp(20px, 2.4vw, 28px); color: var(--gold-400); letter-spacing: .12em; font-weight: 600; }
.hero .lead { max-width: 600px; font-size: 18px; color: #f4e7da; margin: 18px 0 26px; }
.hero .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.hero .chip { padding: 5px 12px; border-radius: 999px; background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.28); font-size: 14px; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero .btn { min-height: 50px; padding: 0 22px; font-size: 16px; }

.stats { position: relative; z-index: 2; margin-top: -78px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; border-top: 4px solid var(--gold); }
.stat .label { font-size: 14px; color: var(--muted); font-weight: 600; }
.stat .value { font-family: var(--serif); font-size: 34px; font-weight: 700; color: var(--red); line-height: 1.25; }
.stat .unit { font-family: var(--sans); font-size: 15px; color: var(--ink); font-weight: 600; margin-left: 4px; }
.stat .note { font-size: 13px; color: var(--muted); }

/* ---------- section ---------- */
.section { padding: 72px 0 8px; }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 28px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--gold-text); font-weight: 700; font-size: 14px; letter-spacing: .04em; }
.eyebrow::before { content: ''; width: 28px; height: 2px; background: var(--gold); }
.section h2 { font-family: var(--serif); font-size: clamp(26px, 3vw, 34px); line-height: 1.3; margin: 6px 0 0; color: var(--ink); }
.section-head p { margin: 6px 0 0; color: var(--muted); max-width: 640px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.muted { color: var(--muted); }

/* ข้อมูลโรงเรียน */
.about-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 24px; }
.identity { padding: 28px; display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 24px; align-items: start; }
.identity .emblem { width: 140px; }
.identity-items { display: grid; gap: 18px; }
.identity-item h3 { margin: 0; font-size: 15px; color: var(--gold-text); font-weight: 700; }
.identity-item p { margin: 2px 0 0; font-family: var(--serif); font-size: 18px; line-height: 1.55; color: var(--ink); }
.leaders { padding: 24px 28px; }
.leaders h3, .temple-card h3 { margin: 0 0 12px; font-family: var(--serif); font-size: 20px; color: var(--red); }
.leader { display: flex; flex-direction: column; padding: 12px 0; border-top: 1px solid var(--line); }
.leader:first-of-type { border-top: 0; }
.leader .role { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.leader .name { font-weight: 600; font-size: 16.5px; }
.temple-card { overflow: hidden; margin-top: 24px; }
.temple-card img { width: 100%; aspect-ratio: 16/8; object-fit: cover; object-position: center 40%; }
.temple-card .body { padding: 20px 24px 24px; }
.temple-card .alias { color: var(--gold-text); font-weight: 600; font-size: 14px; }
.temple-card p { margin: 8px 0 0; color: var(--muted); font-size: 15px; }

.fiveg { margin-top: 24px; grid-column: 1 / -1; padding: 26px 28px; background: linear-gradient(135deg, var(--red-700), var(--red-900)); color: #fff; border: 0; }
.fiveg h3 { margin: 0 0 4px; font-family: var(--serif); font-size: 21px; }
.fiveg .sub { color: #f0d7b2; font-size: 14.5px; margin: 0 0 18px; }
.fiveg-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.fiveg-item { background: rgba(255,255,255,.07); border: 1px solid rgba(221,183,103,.35); border-radius: 12px; padding: 14px; }
.fiveg-item h4 { margin: 0 0 4px; color: var(--gold-400); font-size: 16px; }
.fiveg-item p { margin: 0; font-size: 14px; color: #f4e7da; line-height: 1.55; }

/* สรุป 3 ปี */
.years-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.year-card { padding: 24px; position: relative; overflow: hidden; }
.year-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--gold); }
.year-card.latest::before { background: var(--red); }
.year-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.year-card .y-label { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.year-card .y { font-family: var(--serif); font-size: 36px; font-weight: 700; color: var(--red); line-height: 1.15; }
.level { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 14px; background: var(--gold-100); color: var(--gold-text); }
.level.excellent { background: var(--red); color: #fff; }
.level.top { background: var(--navy); color: #fff; }
.std-rows { margin: 16px 0; display: grid; gap: 8px; }
.std-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; font-size: 14.5px; padding: 8px 0; border-top: 1px dashed var(--line); }
.std-row b { font-weight: 600; white-space: nowrap; }
.year-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }

/* เอกสารหลัก */
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.doc { padding: 22px; display: flex; flex-direction: column; gap: 10px; transition: transform .15s, box-shadow .15s; }
.doc:hover { transform: translateY(-2px); }
.doc-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--red-50); color: var(--red); display: flex; align-items: center; justify-content: center; }
.doc-icon .icon { width: 24px; height: 24px; }
.doc h3 { margin: 0; font-size: 17.5px; line-height: 1.45; }
.doc p { margin: 0; color: var(--muted); font-size: 14.5px; flex-grow: 1; }
.doc .links { display: flex; flex-wrap: wrap; gap: 8px; }
.doc .empty { font-size: 13.5px; color: var(--muted); font-style: italic; }

/* มาตรฐาน */
.std-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.std-tab { text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); padding: 16px 18px; cursor: pointer; display: flex; gap: 14px; align-items: center; min-height: 84px; box-shadow: var(--shadow); }
.std-tab .num { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 700; font-size: 22px; background: var(--gold-100); color: var(--gold-text); }
.std-tab .t1 { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.std-tab .t2 { font-weight: 700; line-height: 1.4; }
.std-tab[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.std-tab[aria-pressed="true"] .num { background: var(--gold); color: var(--red-900); }
.std-tab[aria-pressed="true"] .t1 { color: #f3dcc0; }
.ind-list { padding: 6px 22px; }
.ind-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 14px 0; font-size: 13.5px; color: var(--muted); align-items: center; }
.ind-row { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; padding: 16px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.ind-row:hover .ind-title { color: var(--red); }
.ind-main { display: flex; gap: 14px; align-items: flex-start; flex: 1 1 420px; min-width: 0; }
.code { flex: 0 0 auto; min-width: 52px; height: 36px; padding: 0 10px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--red-50); color: var(--red); font-weight: 700; font-size: 16px; border: 1px solid #f0d4d0; }
.ind-title { font-weight: 600; font-size: 16.5px; line-height: 1.5; }
.ind-meta { font-size: 13.5px; color: var(--muted); }
.ind-side { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ychip { font-size: 13px; font-weight: 700; padding: 2px 9px; border-radius: 7px; border: 1px solid var(--navy); background: var(--navy); color: #fff; }
.ychip.off { background: transparent; color: var(--muted); border: 1px dashed #a8998c; }
.bp { font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--gold-100); color: var(--gold-text); display: inline-flex; gap: 4px; align-items: center; }
.bp .icon { width: 14px; height: 14px; fill: currentColor; }

/* Best Practice & gallery */
.bp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.bp-card { overflow: hidden; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; }
.bp-card .ph { aspect-ratio: 16/10; background: var(--gold-100) center/cover no-repeat; }
.bp-card .body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 6px; }
.bp-card .meta { font-size: 13.5px; color: var(--gold-text); font-weight: 700; }
.bp-card h3 { margin: 0; font-size: 17.5px; line-height: 1.45; }
.bp-card p { margin: 0; color: var(--muted); font-size: 14.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.gallery button { padding: 0; border: 0; background: var(--line); border-radius: 12px; overflow: hidden; cursor: zoom-in; aspect-ratio: 4/3; position: relative; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.gallery button:hover img { transform: scale(1.04); }
.gallery .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 8px; font-size: 12.5px; color: #fff; text-align: left; background: linear-gradient(transparent, rgba(0,0,0,.65)); }

/* ติดต่อ */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; }
.contact-info { padding: 28px; display: grid; gap: 20px; align-content: start; }
.contact-info h3 { margin: 0; font-size: 15px; color: var(--gold-text); }
.contact-info p { margin: 2px 0 0; font-size: 16.5px; }
.contact-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.map { overflow: hidden; min-height: 360px; }
.map iframe { width: 100%; height: 100%; min-height: 360px; border: 0; display: block; }

.site-footer { margin-top: 72px; background: var(--red-900); color: #ead2b4; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; justify-content: space-between; padding-top: 28px; padding-bottom: 28px; }
.site-footer .f-brand { display: flex; gap: 14px; align-items: center; }
.site-footer img { width: 46px; background: #fff; border-radius: 50%; padding: 3px; }
.site-footer b { color: #fff; font-family: var(--serif); font-size: 17px; }
.site-footer small { display: block; font-size: 13.5px; }
.footer-band { height: 6px; background: repeating-linear-gradient(90deg, var(--gold) 0 18px, var(--red) 18px 22px); }

/* ---------- หน้าตัวชี้วัด ---------- */
.page-hero { position: relative; color: #fff; background: var(--red-900) url('/assets/img/temple-sm.jpg') center 30% / cover; }
.page-hero::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(43,6,10,.95), rgba(61,10,15,.82) 60%, rgba(61,10,15,.6)); }
.page-hero .wrap { position: relative; padding-top: 30px; padding-bottom: 36px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; color: #f0d7b2; }
.crumbs a { color: #f0d7b2; text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }
.crumbs a:hover { color: #fff; text-decoration: underline; }
.page-hero .std { margin-top: 14px; color: var(--gold-400); font-weight: 700; font-size: 15px; }
.page-hero h1 { margin: 4px 0 0; font-family: var(--serif); font-size: clamp(24px, 3.2vw, 36px); line-height: 1.35; max-width: 980px; }
.page-hero h1 .c { color: var(--gold-400); margin-right: 10px; }
.page-body { padding-top: 28px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.desc-card { padding: 24px 28px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 28px; align-items: start; }
.desc-card h2, .panel h2 { margin: 0; font-family: var(--serif); font-size: 20px; color: var(--red); }
.desc-card p { margin: 6px 0 0; font-size: 16.5px; line-height: 1.75; }
.criteria { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 14px; }
.criteria summary { cursor: pointer; font-weight: 700; color: var(--navy); min-height: 40px; display: flex; align-items: center; gap: 8px; list-style: none; }
.criteria summary::-webkit-details-marker { display: none; }
.criteria summary::before { content: '+'; width: 24px; height: 24px; border-radius: 6px; background: var(--navy-50); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.criteria[open] summary::before { content: '−'; }
.lv { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 14px; padding: 12px 0; border-top: 1px dashed var(--line); }
.lv:first-of-type { border-top: 0; }
.lv .n { font-weight: 700; color: var(--navy); }
.lv p { margin: 0; }
.panel { padding: 24px 28px; }
.table-wrap { overflow-x: auto; margin-top: 12px; }
table.t { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 15px; }
table.t th { text-align: left; font-size: 13.5px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 2px solid var(--line); }
table.t td, table.t tbody th { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.t tbody th { font-weight: 700; color: var(--red); }
.verdict { font-weight: 600; color: var(--green); }

.ev-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; }
.ev-head h2 { font-family: var(--serif); font-size: 26px; margin: 0; }
.ev-head p { margin: 2px 0 0; color: var(--muted); font-size: 14.5px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; padding: 5px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.seg button { min-height: 40px; padding: 0 16px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--red); color: #fff; }
.ev-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 22px; align-items: start; margin-top: 16px; }
.topic-nav { display: grid; gap: 8px; position: sticky; top: 92px; max-height: calc(100vh - 110px); overflow: auto; padding-right: 4px; }
.topic-btn { text-align: left; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; min-height: 48px; }
.topic-btn:hover { border-color: var(--gold); }
.topic-btn .n { flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--gold-100); color: var(--gold-text); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.topic-btn .tt { font-weight: 600; line-height: 1.45; display: block; }
.topic-btn .tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.topic-btn[aria-pressed="true"] { border: 2px solid var(--red); padding: 11px 13px; background: var(--red-50); }
.topic-btn[aria-pressed="true"] .n { background: var(--red); color: #fff; }
.tag { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--green-50); color: var(--green); }
.tag.warn { background: transparent; border: 1px dashed #a8998c; color: var(--muted); }
.tag.gold { background: var(--gold-100); color: var(--gold-text); }
.tag.lock { background: var(--purple-50); color: var(--purple); }
.tag.site { background: var(--navy-50); color: var(--navy); }
.tag.mine { background: var(--gold-100); color: var(--gold-text); }

.ev-panel { padding: 26px 28px; min-height: 300px; }
.ev-panel > h3 { margin: 0; font-family: var(--serif); font-size: 24px; line-height: 1.4; }
.ev-year { margin-top: 22px; padding-top: 18px; border-top: 2px solid var(--gold-100); }
.ev-year-h { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; }
.ev-year-h .yy { font-family: var(--serif); font-weight: 700; font-size: 20px; color: var(--red); }
.ev-year-h .by { font-size: 13px; color: var(--muted); }
.part { margin-top: 18px; }
.part h4 { margin: 0 0 10px; display: flex; gap: 10px; align-items: center; font-size: 16.5px; }
.part h4 .pn { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13.5px; }
.summary-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: start; }
.summary-box p { margin: 0; font-size: 16px; line-height: 1.8; white-space: pre-line; }
.statbox { min-width: 170px; background: var(--cream); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.statbox .v { font-family: var(--serif); font-size: 26px; font-weight: 700; color: var(--red); line-height: 1.3; }
.statbox .nt { font-size: 13px; color: var(--muted); }
.pdf-list { display: grid; gap: 8px; }
.pdf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 8px 14px; }
.pdf .nm { display: flex; gap: 10px; align-items: center; min-width: 0; font-weight: 600; }
.pdf .nm .icon { color: var(--red); }
.pdf .act { display: flex; gap: 6px; }
.pdf-frame { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; height: 640px; background: #eee; }
.pdf-frame iframe { width: 100%; height: 100%; border: 0; }
.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.imgs button { padding: 0; border: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 4/3; background: var(--line); cursor: zoom-in; }
.imgs img { width: 100%; height: 100%; object-fit: cover; }
.note { border-radius: 10px; padding: 12px 16px; font-size: 15px; display: flex; gap: 10px; align-items: flex-start; }
.note .icon { margin-top: 3px; }
.note.site { background: var(--navy-50); color: var(--navy); }
.note.lock { background: var(--purple-50); color: var(--purple); }
.note.empty { background: var(--cream); color: var(--muted); border: 1px dashed #cdbfae; }
.assessor-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 10px; }
.field { display: grid; gap: 6px; }
.field label, .lbl { font-weight: 600; font-size: 15px; }
.field .hint { font-size: 13px; color: var(--muted); }
.input, select.input, textarea.input { min-height: 46px; padding: 0 14px; border: 1px solid #b9ab9c; border-radius: 10px; background: #fff; width: 100%; }
textarea.input { padding: 10px 14px; min-height: 110px; line-height: 1.7; resize: vertical; }
.input:focus { border-color: var(--red); outline: 3px solid rgba(201,154,59,.35); outline-offset: 0; }
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 8px; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(20,6,8,.92); display: flex; align-items: center; justify-content: center; padding: 56px 64px; }
.lightbox img { max-height: 100%; max-width: 100%; object-fit: contain; border-radius: 6px; }
.lightbox .cap { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; color: #f3dcc0; font-size: 15px; padding: 0 70px; }
.lightbox button { position: absolute; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lightbox button:hover { background: rgba(255,255,255,.26); }
.lightbox .x { top: 14px; right: 14px; }
.lightbox .pv { left: 10px; top: 50%; transform: translateY(-50%); }
.lightbox .nx { right: 10px; top: 50%; transform: translateY(-50%); }

.loading { padding: 80px 0; text-align: center; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px; z-index: 200; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.toast.err { background: var(--red); }

@media (max-width: 1080px) {
  .main-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; flex-direction: column; align-items: stretch; padding: 10px 16px 16px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
  .main-nav.open { display: flex; }
  .main-nav .btn { margin: 8px 0 0; }
  .menu-toggle { display: inline-flex; }
  .fiveg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ev-layout { grid-template-columns: minmax(0, 1fr); }
  .topic-nav { position: static; max-height: none; }
}
@media (max-width: 860px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about-grid, .contact-grid { grid-template-columns: minmax(0, 1fr); }
  .years-grid, .std-tabs { grid-template-columns: minmax(0, 1fr); }
  .identity { grid-template-columns: minmax(0, 1fr); }
  .identity .emblem { width: 110px; }
  .desc-card { grid-template-columns: minmax(0, 1fr); }
  .summary-box { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .topbar .addr { display: none; }
  .brand-sub, .brand-zh { display: none; }
  .ev-panel, .panel, .desc-card { padding: 18px; }
  .brand-name { font-size: 16px; }
  .hero .wrap { padding-top: 44px; padding-bottom: 116px; }
  .stat .value { font-size: 27px; }
  .fiveg-grid { grid-template-columns: minmax(0, 1fr); }
  .lv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .lightbox { padding: 56px 8px; }
  .pdf-frame { height: 460px; }
}
@media print {
  .topbar, .site-header, .hero .actions, .site-footer, .seg, .topic-nav, .pager, .map { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* ================= หน้าครูและผู้ดูแลระบบ ================= */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(circle at 15% 10%, #e9e4dc, transparent 45%), radial-gradient(circle at 90% 95%, #f3e2c4, transparent 40%), var(--cream); }
.login-card { width: 100%; max-width: 1080px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); background: #fff; border-radius: 28px; overflow: hidden; box-shadow: 0 30px 80px rgba(61,10,15,.18); }
.login-form { padding: 56px 48px; display: flex; flex-direction: column; gap: 18px; justify-content: center; }
.login-form .logo { width: 84px; margin: 0 auto; }
.login-form h1 { margin: 0; text-align: center; font-family: var(--serif); color: var(--red); font-size: 26px; line-height: 1.35; }
.login-form .sub { text-align: center; color: var(--muted); font-size: 14.5px; margin-top: -10px; }
.login-art { position: relative; min-height: 560px; background: var(--red-900) url('/assets/img/temple.jpg') center / cover; color: #fff; display: flex; flex-direction: column; justify-content: flex-end; padding: 40px; gap: 12px; }
.login-art::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(30,20,50,.05) 20%, rgba(25,15,40,.85)); }
.login-art > * { position: relative; }
.login-art h2 { margin: 0 0 8px; font-family: var(--serif); font-size: 28px; line-height: 1.4; }
.login-art .feat { display: flex; gap: 12px; align-items: center; padding: 11px 16px; border-radius: 12px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28); backdrop-filter: blur(6px); font-weight: 600; }
.login-form .back { text-align: center; font-size: 14.5px; }

.shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; }
.side { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; gap: 12px; align-items: center; padding: 18px 18px 16px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.side-brand img { width: 40px; }
.side-brand b { display: block; font-family: var(--serif); color: var(--red); font-size: 15.5px; line-height: 1.3; }
.side-brand small { color: var(--muted); font-size: 12.5px; }
.side nav { padding: 14px 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; overflow-y: auto; overflow-x: hidden; }
.side nav a { min-width: 0; }
.side nav .grp { font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 14px 12px 4px; }
.side nav a { display: flex; gap: 12px; align-items: center; padding: 0 12px; min-height: 44px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 500; }
.side nav a:hover { background: var(--cream); }
.side nav a.on { background: var(--gold-100); color: var(--red); font-weight: 700; box-shadow: inset 3px 0 0 var(--gold); }
.side-foot { margin-top: auto; padding: 14px 16px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.side-foot .who { font-weight: 700; }
.side-foot .who small { display: block; color: var(--muted); font-weight: 500; }
.side-foot .row { display: flex; gap: 8px; flex-wrap: wrap; }
.main { padding: 24px 32px 64px; min-width: 0; }
.topline { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.topline h1 { margin: 0; font-family: var(--serif); font-size: 26px; line-height: 1.35; }
.topline .sub { color: var(--muted); font-size: 14.5px; }
.mobile-bar { display: none; }

.welcome { position: relative; overflow: hidden; border-radius: 22px; min-height: 210px; color: #fff; padding: 30px 34px; display: flex; flex-direction: column; justify-content: center; background: var(--red-900) url('/assets/img/temple.jpg') right 35% / cover; margin-bottom: 22px; }
.welcome::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(43,6,10,.92) 0%, rgba(61,10,15,.7) 45%, rgba(0,0,0,0) 85%); }
.welcome > * { position: relative; }
.welcome h2 { margin: 6px 0; font-family: var(--serif); font-size: 30px; }
.welcome .pill { align-self: flex-start; background: var(--gold); color: var(--red-900); font-weight: 700; padding: 5px 14px; border-radius: 999px; font-size: 14px; }
.welcome p { margin: 0; color: #f4e7da; max-width: 560px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { border-radius: 16px; padding: 16px 18px; display: flex; gap: 14px; align-items: center; border: 1px solid; }
.kpi .ic { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; flex: 0 0 46px; }
.kpi .ic .icon { width: 22px; height: 22px; }
.kpi .l { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.kpi .v { font-size: 28px; font-weight: 700; line-height: 1.2; }
.kpi.k1 { background: #eef3fb; border-color: #cfdcf1; } .kpi.k1 .ic { background: var(--navy); }
.kpi.k2 { background: #eaf5ee; border-color: #c7e3d1; } .kpi.k2 .ic { background: var(--green); }
.kpi.k3 { background: #fbf3e2; border-color: #efdcb3; } .kpi.k3 .ic { background: var(--gold); }
.kpi.k4 { background: var(--red-50); border-color: #efcfca; } .kpi.k4 .ic { background: var(--red); }

.ind-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.ind-card { padding: 18px 20px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 12px; transition: border-color .15s; }
.ind-card:hover { border-color: var(--gold); }
.ind-card .hd { display: flex; gap: 12px; align-items: flex-start; }
.ind-card .tt { font-weight: 600; line-height: 1.45; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 44px minmax(0, 1fr) 64px; gap: 10px; align-items: center; font-size: 13.5px; }
.bar .track { height: 9px; border-radius: 99px; background: #eee6da; overflow: hidden; }
.bar .fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--red)); border-radius: 99px; }
.bar .n { text-align: right; color: var(--muted); }

.year-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 20px; align-items: start; }
.ed-topics { display: grid; gap: 8px; position: sticky; top: 16px; }
.ed-topics .add { padding: 14px; display: grid; gap: 10px; }
.ed-panel { padding: 24px 26px; display: grid; gap: 22px; }
.ed-panel h2 { margin: 0; font-family: var(--serif); font-size: 22px; line-height: 1.4; }
.checklist { display: flex; flex-wrap: wrap; gap: 8px; }
.ck { display: inline-flex; gap: 6px; align-items: center; padding: 4px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; background: var(--cream); color: var(--muted); border: 1px dashed #bfae9b; }
.ck.ok { background: var(--green-50); color: var(--green); border: 1px solid #b8dcc6; }
.ck .icon { width: 16px; height: 16px; }
.block { border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 14px; }
.block > h3 { margin: 0; display: flex; gap: 10px; align-items: center; font-size: 17px; }
.block > h3 .pn { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13.5px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.radios { display: flex; flex-wrap: wrap; gap: 8px; }
.radio { flex: 1 1 190px; display: flex; gap: 10px; align-items: center; min-height: 48px; padding: 8px 12px; border: 1px solid #b9ab9c; border-radius: 10px; cursor: pointer; font-weight: 500; }
.radio:has(input:checked) { border: 2px solid var(--red); padding: 7px 11px; background: var(--red-50); font-weight: 700; }
.radio input, .chk input { width: 18px; height: 18px; accent-color: var(--red); }
.chk { display: inline-flex; gap: 10px; align-items: center; min-height: 44px; font-weight: 600; cursor: pointer; }
.drop { border: 2px dashed #c9b9a4; border-radius: 12px; padding: 18px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; background: #fffdf9; }
.drop.over { border-color: var(--red); background: var(--red-50); }
.file-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.file-row .nm { display: flex; gap: 8px; align-items: center; font-weight: 600; min-width: 0; flex: 1 1 260px; }
.file-row .nm a { overflow-wrap: anywhere; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.thumb { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.thumb img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.thumb input { border: 0; border-top: 1px solid var(--line); width: 100%; padding: 6px 8px; font-size: 13px; min-height: 34px; }
.thumb .del { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); color: var(--red); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.icon-btn:hover { color: var(--red); border-color: var(--red); }
.progress { font-size: 14px; color: var(--navy); font-weight: 600; }
.savebar { position: sticky; bottom: 12px; z-index: 5; background: rgba(255,255,255,.97); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 12px 16px; display: flex; gap: 10px; justify-content: flex-end; align-items: center; border-radius: 12px; }
.savebar .state { margin-right: auto; font-size: 14px; color: var(--muted); }
table.t input.input { min-height: 40px; padding: 0 10px; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { padding: 2px 10px; border-radius: 999px; background: var(--cream); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.pill.admin { background: var(--navy); color: #fff; border-color: var(--navy); }
.pill.off { background: #eee; color: #777; }
dialog.modal { border: 0; border-radius: 18px; padding: 0; width: min(760px, calc(100% - 24px)); box-shadow: 0 30px 80px rgba(0,0,0,.3); }
dialog.modal::backdrop { background: rgba(30,10,12,.55); }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-h h2 { margin: 0; font-size: 20px; font-family: var(--serif); }
.modal-b { padding: 20px 22px; display: grid; gap: 14px; max-height: 70vh; overflow: auto; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.ind-picks { display: grid; gap: 12px; }
.ind-picks fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 0; }
.ind-picks legend { font-weight: 700; padding: 0 6px; }
.ind-picks label { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; font-size: 14.5px; }
.rep { display: grid; gap: 8px; }
.rep-row { display: grid; gap: 8px; align-items: end; }
.empty-state { padding: 40px; text-align: center; color: var(--muted); }

@media (max-width: 1100px) {
  .ed-layout { grid-template-columns: minmax(0, 1fr); }
  .ed-topics { position: static; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 60; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .mobile-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
  .mobile-bar b { font-family: var(--serif); color: var(--red); }
  .main { padding: 18px 16px 48px; }
  .login-card { grid-template-columns: minmax(0, 1fr); }
  .login-art { min-height: 220px; order: -1; }
  .login-art .feat { display: none; }
  .login-form { padding: 32px 22px; }
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
}
