/* =============================================================================
   ระบบรายงาน SAR — ระบบการออกแบบ (ใช้ร่วมกับ Tailwind)
   ============================================================================= */
:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --line: #e4e8ef;
  --line-2: #d3d9e3;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #5a6a7f;
  --ink-4: #94a3b8;
  /* สีหลัก = ตระกูลน้ำเงินเดียวกับกราฟ (brand-500 = --s1) — คุมโทนทั้งเว็บ */
  --brand-50: #eef5fd;
  --brand-100: #dbeafb;
  --brand-200: #bdd7f6;
  --brand-300: #91bcef;
  --brand-400: #5598e7;
  --brand-500: #2a78d6;
  --brand-600: #1f68c2;
  --brand-700: #1a57a3;
  --brand-800: #164684;
  --brand-900: #113766;
  --brand-950: #0b2547;
  --brand-rgb: 42, 120, 214;
  /* สีเน้นรอง (ส้ม = --s2) ใช้กับป้าย "ข้อมูลทดสอบ" */
  --accent-50: #fff4ed;
  --accent-200: #fdd5bf;
  --accent-700: #a63d12;
  --accent-900: #7c2d12;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 18px 40px -18px rgba(15, 23, 42, .28);
  --topbar-h: 64px;

  /* โทเคนกราฟ (ตรวจด้วยตัวตรวจจานสีแล้ว: ordinal ramp, categorical 2 สี all-pairs บนพื้นขาว) */
  --viz-surface: #ffffff;
  --viz-ink: #0f172a;
  --viz-ink-2: #475569;
  --viz-muted: #64748b;
  --viz-grid: #e5e8ef;
  --viz-axis: #c5ccd8;
  --viz-zero: #f4f6fa;
  --viz-track: #cde2fb;           /* blue step 100 */
  --s1: #2a78d6;                  /* categorical slot 1 (blue) */
  --s2: #eb6834;                  /* categorical slot 2 (orange) */
  --iqa-5: #104281;               /* ยอดเยี่ยม  (blue 650) */
  --iqa-4: #1c5cab;               /* ดีเลิศ     (blue 550) */
  --iqa-3: #2a78d6;               /* ดี         (blue 450) */
  --iqa-2: #5598e7;               /* ปานกลาง   (blue 350) */
  --iqa-1: #86b6ef;               /* กำลังพัฒนา (blue 250) */
  --lvl-3: #104281;               /* ความพร้อมระดับมาก */
  --lvl-2: #2a78d6;               /* ปานกลาง */
  --lvl-1: #86b6ef;               /* น้อย */
  --st-good: #0ca30c;             /* สถานะ (ใช้คู่ไอคอน + ป้ายเสมอ) */
  --st-warn: #fab219;
  --st-crit: #d03b3b;
}

html { scroll-padding-top: calc(var(--topbar-h) + 16px); }
/* Thonburi = ฟอนต์ไทยของ Mac/iPhone ที่ใช้แทนระหว่างรอ IBM Plex Sans Thai — ระบุชื่อไว้ เบราว์เซอร์ไม่ต้องค้นหาฟอนต์ไทยในเครื่องเอง
   (การค้นหาเองทำให้จัดหน้าครั้งแรกช้า ~0.1 วินาที โดยเฉพาะหัวข้อตัวหนาขนาดใหญ่) — เครื่องที่ไม่มี Thonburi ข้ามไปตัวถัดไปตามเดิม */
body { font-family: 'IBM Plex Sans Thai', Thonburi, system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
::selection { background: var(--brand-100); }

/* ---------- แถบด้านบน ---------- */
#topbar { position: sticky; top: 0; z-index: 50; height: var(--topbar-h); background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar-in { height: 100%; display: flex; align-items: center; gap: .75rem; padding: 0 1rem; max-width: 100%; }
.brand { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.brand img { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; box-shadow: var(--shadow-sm); flex-shrink: 0; }
.brand b { display: block; font-size: .95rem; font-weight: 700; line-height: 1.2; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { display: block; font-size: .72rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .wm { font-weight: 800; letter-spacing: -.01em; }
.brand .wm i { font-style: normal; color: var(--brand-600); }
.brand .th { font-weight: 600; }
.brand .th::before { content: ''; display: inline-block; width: 1px; height: .85em; margin: 0 .55rem; vertical-align: -.08em; background: currentColor; opacity: .4; }
@media (max-width: 767px) { .brand .th { display: none; } }
.user-chip { display: flex; align-items: center; gap: .6rem; padding: .25rem .75rem .25rem .3rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.user-chip .av { width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: var(--brand-700); background: var(--brand-100); }
.user-chip .nm { font-size: .82rem; font-weight: 600; line-height: 1.15; max-width: 15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .rl { font-size: .7rem; color: var(--ink-3); }

/* แถบบนแบบเด่น (พื้นสีหลักไล่เฉด ตัวอักษรขาว) */
#topbar { background: linear-gradient(100deg, var(--brand-950) 0%, var(--brand-800) 55%, var(--brand-600) 100%); border-bottom: 0; box-shadow: 0 4px 14px rgba(11, 37, 71, .3); backdrop-filter: none; color: #fff; }
#topbar .brand img { background: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 2px 6px rgba(0, 0, 0, .25); }
#topbar .brand b { color: #fff; font-size: 1rem; letter-spacing: .005em; }
#topbar .brand small { color: rgba(255, 255, 255, .78); }
#topbar .brand .wm i { color: #8fd3ff; }
#topbar .btn-ghost { color: rgba(255, 255, 255, .92); }
#topbar .btn-ghost:hover { background: rgba(255, 255, 255, .16); color: #fff; }
#topbar .btn-secondary { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .35); color: #fff; box-shadow: none; }
#topbar .btn-secondary:hover { background: rgba(255, 255, 255, .24); border-color: rgba(255, 255, 255, .55); color: #fff; }
#topbar .btn-primary { background: #fff; color: var(--brand-700); box-shadow: 0 2px 6px rgba(0, 0, 0, .18); }
#topbar .btn-primary:hover { background: var(--brand-50); }
#topbar .user-chip { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .25); }
#topbar .user-chip .av { background: #fff; color: var(--brand-700); }
#topbar .user-chip .nm { color: #fff; }
#topbar .user-chip .rl { color: rgba(255, 255, 255, .72); }
/* เมนูหลักของสถานศึกษา (แถบบน) */
.tb-nav { display: flex; align-items: center; gap: .3rem; margin-left: .75rem; flex-shrink: 0; }   /* เมนูไม่หด — จอแคบให้ชื่อระบบ (.brand) ย่อแทน */
.tb-nav:empty { display: none; }
.tb-nav button, .tb-nav a { display: inline-flex; align-items: center; gap: .45rem; height: 2.3rem; padding: 0 .9rem; border-radius: 999px; font-size: .86rem; font-weight: 600; color: rgba(255, 255, 255, .8); white-space: nowrap; transition: background .15s, color .15s; }
.tb-nav button:hover, .tb-nav a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.tb-nav button[aria-current="page"], .tb-nav a[aria-current="page"] { background: rgba(255, 255, 255, .18); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28); }
.tb-nav button:focus-visible, .tb-nav a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 1279px) { .tb-nav span { display: none; } .tb-nav button, .tb-nav a { width: 2.3rem; padding: 0; justify-content: center; } }
/* ปุ่มผู้ใช้ + เมนูย่อย */
.um { position: relative; }
.um-btn { display: flex; align-items: center; gap: .55rem; height: 2.6rem; padding: 0 .7rem 0 .3rem; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .25); color: #fff; transition: background .15s; }
.um-btn:hover, .um-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .2); }
.um-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.um .av { width: 2rem; height: 2rem; flex-shrink: 0; display: grid; place-items: center; border-radius: 999px; font-weight: 700; font-size: .85rem; background: #fff; color: var(--brand-700); }
.um-btn .who { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; text-align: left; }
.um-btn .nm { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; font-weight: 600; line-height: 1.15; }
.um-btn .rl { font-size: .68rem; color: rgba(255, 255, 255, .72); }
.um-btn .chev { font-size: .65rem; opacity: .8; transition: transform .15s; }
.um-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
@media (max-width: 767px) { .um-btn .who { display: none; } .um-btn { padding-right: .55rem; } }
.um-menu { position: absolute; right: 0; top: calc(100% + .5rem); z-index: 60; width: 17rem; padding: .4rem; border-radius: .9rem; background: #fff; color: var(--ink); box-shadow: 0 16px 40px rgba(15, 23, 42, .22), 0 0 0 1px rgba(15, 23, 42, .06); animation: fv-in .12s ease-out; }
.um-head { display: flex; align-items: center; gap: .65rem; padding: .55rem .6rem .7rem; margin-bottom: .3rem; border-bottom: 1px solid var(--line); }
.um-head .av { background: var(--brand-100); }
.um-head b { display: block; font-size: .85rem; line-height: 1.3; }
.um-head small { display: block; font-size: .72rem; color: var(--ink-3); }
.um-item { display: flex; align-items: center; gap: .65rem; width: 100%; padding: .55rem .65rem; border-radius: .6rem; font-size: .86rem; color: var(--ink-2); text-align: left; }
.um-item i { width: 1.1rem; text-align: center; color: var(--ink-3); }
.um-item:hover, .um-item:focus-visible { background: #f1f5f9; color: var(--ink); outline: none; }
.um-item.danger { color: #b91c1c; }
.um-item.danger i { color: #dc2626; }
.um-item.danger:hover, .um-item.danger:focus-visible { background: #fef2f2; }
.um-sep { height: 1px; margin: .3rem .25rem; background: var(--line); }
#topbar .ctl-year { height: 2.3rem; border-color: transparent; background: #fff; color: var(--brand-800); font-size: .9rem; font-weight: 700; box-shadow: 0 2px 6px rgba(0, 0, 0, .18); }
#topbar .ctl-year > i { color: var(--brand-600); }
#topbar .ctl-year:focus-within { box-shadow: 0 0 0 3px rgba(255, 255, 255, .55); }
#topbar .ctl-year.other { background: #fde68a; color: #78350f; }
#topbar .ctl-year.other > i { color: #92400e; }
#topbar .ctl-open { height: 2.3rem; padding: 0 .95rem 0 .55rem; gap: .55rem; font-size: .84rem; font-weight: 700; color: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
#topbar .ctl-open[aria-checked="false"] .sw { background: rgba(255, 255, 255, .35); }
#topbar .ctl-open[aria-checked="true"] { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .4); box-shadow: none; }
#topbar .ctl-open[aria-checked="true"]:hover { background: rgba(255, 255, 255, .24); }
#topbar .ctl-open[aria-checked="false"] { background: #dc2626; border-color: #fca5a5; }
#topbar .ctl-open[aria-checked="false"]:hover { background: #b91c1c; }
@keyframes live-dot { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, .85); } 80%, 100% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); } }

/* ---------- ปุ่ม ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; height: 2.5rem; padding: 0 1rem; border-radius: .75rem; font-size: .875rem; font-weight: 600;
  border: 1px solid transparent; line-height: 1; white-space: nowrap; cursor: pointer; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s; user-select: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand-600); color: #fff; box-shadow: 0 1px 2px rgba(var(--brand-rgb), .35), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:hover { background: var(--brand-700); }
.btn-secondary { background: #fff; border-color: var(--line-2); color: var(--ink-2); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { border-color: var(--brand-300); color: var(--brand-700); background: var(--brand-50); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: #eef1f6; color: var(--ink); }
.btn-success { background: #15803d; color: #fff; }
.btn-success:hover { background: #166534; }
.btn-danger { background: #fff; border-color: #fecdd3; color: #e11d48; }
.btn-danger:hover { background: #fff1f2; border-color: #fda4af; }
.btn-sm { height: 2rem; padding: 0 .75rem; border-radius: .6rem; font-size: .8rem; gap: .4rem; }
.btn-xs { height: 1.75rem; padding: 0 .55rem; border-radius: .5rem; font-size: .75rem; gap: .35rem; }
.btn-lg { height: 3rem; padding: 0 1.25rem; border-radius: .9rem; font-size: .95rem; }
.btn-icon { width: 2.5rem; padding: 0; }
.btn-sm.btn-icon { width: 2rem; }
.btn-xs.btn-icon { width: 1.75rem; }
.btn-block { width: 100%; }

/* ---------- การ์ดและส่วนหัวหน้า ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; padding: 1.1rem 1.25rem .4rem; }
.card-h h3 { font-size: 1rem; font-weight: 700; color: var(--ink); line-height: 1.35; }
.card-h p { font-size: .78rem; color: var(--ink-3); margin-top: .15rem; }
.card-b { padding: .9rem 1.25rem 1.25rem; }
.card-f { padding: .75rem 1.25rem; border-top: 1px solid var(--line); font-size: .78rem; color: var(--ink-3); }
.card-tools { display: flex; gap: .4rem; flex-shrink: 0; }
.page { max-width: 1320px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
/* การ์ดหัวหน้าหลักสถานศึกษา — เต็มความกว้างจอ (ส่วนอื่นของหน้าใช้ความกว้างปกติของ .page) */
.sh-wrap { position: relative; padding: 1.25rem 1rem 0; }
/* แถบสีต่อจากแถบบน (สีเดียวกัน) แล้วจางลง — การ์ดหัวลอยอยู่บนแถบ ทำให้แถบบนกับการ์ดกลมกลืนกัน */
.sh-wrap::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 7.5rem; background: linear-gradient(100deg, var(--brand-950) 0%, var(--brand-800) 55%, var(--brand-600) 100%);
  -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.sh-wrap > .sh-card { position: relative; border-color: transparent; box-shadow: 0 14px 34px -14px rgba(11, 37, 71, .4), 0 2px 6px rgba(11, 37, 71, .08); }
#topbar { transition: box-shadow .2s; }
body[data-view="school"]:not(.scrolled) #topbar, body[data-view="form"]:not(.scrolled) #topbar, body[data-view="progress"]:not(.scrolled) #topbar,
body[data-view="public"]:not(.scrolled) #topbar, body[data-view="track"]:not(.scrolled) #topbar, body[data-view="eqa"]:not(.scrolled) #topbar { box-shadow: none; }
@media (min-width: 768px) { .sh-wrap { padding-left: 1.5rem; padding-right: 1.5rem; } }
@media (min-width: 1536px) { .sh-wrap { padding-left: 2.5rem; padding-right: 2.5rem; } }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; color: var(--ink); }
.page-head p { font-size: .8rem; color: var(--ink-3); margin-top: .1rem; }
.page-head .crumb { font-size: .7rem; color: var(--brand-700); font-weight: 600; }
.page-head .btn { height: 2.15rem; padding: 0 .8rem; border-radius: .65rem; font-size: .82rem; gap: .4rem; }
.page-head .btn-icon { width: 2.15rem; padding: 0; }
.page-head .fld { height: 2.15rem; font-size: .84rem; }
.page-head .seg button { height: 1.75rem; }
@media (max-width: 639px) { .page-head .btn:not(.btn-icon) { padding: 0 .6rem; font-size: .8rem; } .page-head > div:last-child { gap: .4rem; } }
.section-title { display: flex; align-items: center; gap: .6rem; font-size: 1.1rem; font-weight: 700; margin: 2rem 0 .9rem; color: var(--ink); }
.section-title::before { content: ''; width: 4px; height: 1.15rem; border-radius: 4px; background: var(--brand-600); }
.section-title small { font-size: .8rem; font-weight: 500; color: var(--ink-3); }

/* ---------- ป้าย ชิป ส่วนควบคุม ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; line-height: 1.3; }
.b-green { background: #dcfce7; color: #166534; }
.b-amber { background: #fef3c7; color: #92400e; }
.b-red { background: #ffe4e6; color: #be123c; }
.b-gray { background: #f1f5f9; color: #475569; }
.b-blue { background: var(--brand-100); color: var(--brand-800); }
.b-brand { background: var(--brand-50); color: var(--brand-700); }
.b-violet { background: var(--accent-50); color: var(--accent-700); box-shadow: inset 0 0 0 1px var(--accent-200); }
.b-dark { background: #0f172a; color: #fff; letter-spacing: .12em; }

.seg { display: inline-flex; padding: .25rem; gap: .2rem; background: #e9edf4; border-radius: .85rem; }
.seg button { height: 2rem; padding: 0 .85rem; border-radius: .65rem; font-size: .82rem; font-weight: 600; color: var(--ink-3); white-space: nowrap; transition: background .15s, color .15s; }
.seg button:hover { color: var(--ink); }
.seg button[aria-selected="true"] { background: #fff; color: var(--brand-700); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.login-tab[aria-selected="true"] { background: #fff; color: var(--brand-700); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.login-tab[aria-selected="false"] { color: var(--ink-3); }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.fchip { display: inline-flex; align-items: center; gap: .45rem; height: 2.1rem; padding: 0 .8rem; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font-size: .82rem; font-weight: 600; color: var(--ink-2); transition: all .15s; }
.fchip:hover { border-color: var(--brand-300); color: var(--brand-700); }
.fchip .n { min-width: 1.5rem; height: 1.3rem; padding: 0 .4rem; border-radius: 999px; background: #eef1f6; color: var(--ink-2); font-size: .72rem; display: inline-grid; place-items: center; }
.fchip[aria-pressed="true"] { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.fchip[aria-pressed="true"] .n { background: rgba(255, 255, 255, .22); color: #fff; }

.switch { position: relative; width: 2.6rem; height: 1.5rem; border-radius: 999px; background: #cbd5e1; transition: background .2s; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 1.125rem; height: 1.125rem; border-radius: 999px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch[aria-checked="true"] { background: #15803d; }
.switch[aria-checked="true"]::after { transform: translateX(1.1rem); }

.alert { display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1rem; border-radius: .9rem; border: 1px solid; font-size: .85rem; line-height: 1.55; }
.alert > i { margin-top: .2rem; }
.alert .grow { flex: 1; min-width: 0; }
@media (max-width: 640px) { .alert { flex-wrap: wrap; } .alert > .acts { width: 100%; padding-left: 1.6rem; } }
.alert-amber { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.alert-violet { background: var(--accent-50); border-color: var(--accent-200); color: var(--accent-900); }
.alert-blue { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-900); }
.alert-gray { background: #f8fafc; border-color: var(--line); color: var(--ink-2); }
.alert-red { background: #fff1f2; border-color: #fecdd3; color: #881337; }
.alert-green { background: #f0fdf4; border-color: #bbf7d0; color: #14532d; }

/* ---------- ตัวเลขสรุป (stat tile) ---------- */
.kpi { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: .8rem 1rem; display: grid; grid-template-columns: auto minmax(0, 1fr); align-content: start; column-gap: .8rem; row-gap: 0; min-width: 0; text-align: left; }
.kpi > .kpi-v { margin-top: .1rem; }
.kpi > .kpi-s { margin-top: .1rem; }
.kpi-h { display: contents; }
.kpi-ic { width: 2.1rem; height: 2.1rem; border-radius: .7rem; display: grid; place-items: center; font-size: .9rem; flex-shrink: 0; }
.kpi > .kpi-h > .kpi-ic { grid-row: 1 / span 4; width: 2.5rem; height: 2.5rem; font-size: 1rem; }
.kpi > *:not(.kpi-h), .kpi-l { grid-column: 2; }
.kpi-l { font-size: .78rem; font-weight: 600; color: var(--ink-3); line-height: 1.3; }
.kpi-v { font-size: 1.5rem; font-weight: 700; color: var(--ink); line-height: 1.15; letter-spacing: -.01em; }
.kpi > .viz-meter, .kpi > .viz-spark { margin-top: .3rem; }
@media (max-width: 639px) {
  .kpi { display: flex; flex-direction: column; gap: .3rem; padding: .75rem .85rem; }
  .kpi-h { display: flex; align-items: center; gap: .5rem; }
  .kpi > .kpi-h > .kpi-ic { width: 1.9rem; height: 1.9rem; font-size: .85rem; }
  .kpi-v { font-size: 1.35rem; }
}
.kpi-u { font-size: .9rem; font-weight: 500; color: var(--ink-3); margin-left: .3rem; letter-spacing: 0; }
.kpi-s { font-size: .76rem; color: var(--ink-3); }
.kpi.clickable { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.kpi.clickable:hover { border-color: var(--brand-300); box-shadow: var(--shadow-lg); }
.tone-brand { background: var(--brand-50); color: var(--brand-600); }
.tone-green { background: #dcfce7; color: #15803d; }
.tone-amber { background: #fef3c7; color: #b45309; }
.tone-red { background: #ffe4e6; color: #be123c; }
.tone-sky { background: var(--brand-100); color: var(--brand-800); }
.tone-violet { background: #e3e9f2; color: var(--brand-900); }
.tone-gray { background: #f1f5f9; color: #475569; }

/* ---------- ตาราง ---------- */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .85rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: .74rem; background: #f8fafc; padding: .65rem .9rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.tbl td { padding: .7rem .9rem; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: #f4f8fd; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow: auto; max-height: 68vh; }
/* รายการครบทุกแถว (หน้าติดตามการส่ง): ไม่มีกล่องเลื่อน · จอกว้างหัวตารางค้างใต้แถบบนขณะเลื่อนหน้า (การ์ดใช้ overflow: clip ไม่ใช่ hidden เพื่อให้ sticky อิงหน้าจอ) */
.tr-card, .tk-card { overflow: clip; }
.tbl-wrap.tbl-all { max-height: none; }
@media (min-width: 1024px) { .tbl-wrap.tbl-all { overflow: visible; } .tbl-all .tbl th, .tbl-all .in-grid th { top: var(--topbar-h); z-index: 2; } }
.scroll-y { max-height: 70vh; overflow: auto; }
.empty { padding: 3rem 1rem; text-align: center; color: var(--ink-3); }
.empty i { font-size: 2rem; color: var(--ink-4); display: block; margin-bottom: .6rem; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; padding: .65rem .9rem; border-bottom: 1px solid var(--line); }
.toolbar .fld { height: 2.2rem; font-size: .85rem; }
.toolbar .fchip { height: 1.95rem; }
.card-f.list-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .75rem; padding: .55rem 1rem; }
.card-f.list-foot:has(button[hidden]) { padding-top: .7rem; padding-bottom: .7rem; }
.search { position: relative; }
.search > i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--ink-4); font-size: .85rem; pointer-events: none; }
.search .fld { padding-left: 2.2rem; }

/* ---------- ฟอร์ม ---------- */
.fld { width: 100%; height: 2.6rem; padding: 0 .8rem; border: 1px solid var(--line-2); border-radius: .7rem; background: #fff; font-size: .9rem; color: var(--ink); outline: none; transition: box-shadow .15s, border-color .15s; }
textarea.fld { height: auto; padding: .6rem .8rem; resize: vertical; min-height: 2.6rem; line-height: 1.55; }
select.fld { padding-right: 2rem; }
.fld:focus { border-color: var(--brand-500); box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .16); }
.fld:disabled, .fld[readonly] { background: #f6f7fa; color: var(--ink-3); }
.fld-sm { height: 2.1rem; font-size: .84rem; border-radius: .6rem; }
.lbl { display: block; font-size: .78rem; font-weight: 600; color: var(--ink-2); margin-bottom: .35rem; }
.req { color: #e11d48; }
.hint { font-size: .75rem; color: var(--ink-3); }

.ck { display: flex; gap: .65rem; align-items: flex-start; padding: .5rem .65rem; border-radius: .65rem; border: 1px solid transparent; cursor: pointer; font-size: .875rem; line-height: 1.5; transition: background .12s, border-color .12s; }
.ck:hover { background: #f6f8fc; }
.ck input { margin-top: .22rem; width: 1.05rem; height: 1.05rem; accent-color: var(--brand-600); flex-shrink: 0; }
.ck:has(input:checked) { background: var(--brand-50); border-color: var(--brand-200); }
.ck:has(input:disabled) { cursor: default; }
.ck .no { color: var(--ink-4); margin-right: .25rem; font-weight: 600; }

.chip { position: relative; display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font-size: .8rem; cursor: pointer; user-select: none; transition: all .12s; line-height: 1.35; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:hover { border-color: var(--brand-300); }
.chip:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .32); }
.chip.s:has(input:checked) { background: #f0fdf4; border-color: #4ade80; color: #14532d; }
.chip.w:has(input:checked) { background: #fff1f2; border-color: #fb7185; color: #9f1239; }
.chip .tick { display: none; }
.chip:has(input:checked) .tick { display: inline; }

.lvl-opt { display: block; position: relative; cursor: pointer; }
.lvl-opt input { position: absolute; opacity: 0; }
.lvl-opt > span { display: flex; gap: .55rem; align-items: flex-start; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: .75rem; font-size: .8rem; line-height: 1.45; background: #fff; transition: all .12s; height: 100%; }
.lvl-opt > span > b { flex-shrink: 0; display: inline-flex; width: 1.5rem; height: 1.5rem; border-radius: .45rem; align-items: center; justify-content: center; background: #f1f5f9; color: var(--ink-2); font-size: .78rem; }
.lvl-opt .lvl-tag { display: block; font-size: 11px; color: var(--ink-4); margin-top: .15rem; }
.lvl-opt:hover > span { border-color: var(--brand-300); }
.lvl-opt input:checked + span { border-color: var(--brand-500); background: var(--brand-50); color: var(--brand-800); box-shadow: 0 0 0 1px var(--brand-500) inset; }
.lvl-opt input:checked + span > b { background: var(--brand-600); color: #fff; }
.lvl-opt input:focus-visible + span { box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .32); }
.lvl-opt input:disabled + span { cursor: default; }

details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary .chev { transform: rotate(180deg); }
.chev { transition: transform .2s; color: var(--ink-4); }

.code-box { width: 2.6rem; height: 3rem; border-radius: .7rem; display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem; font-weight: 800; }
.code-box.sm { width: 1.9rem; height: 2.1rem; font-size: .95rem; border-radius: .5rem; }
.code-box.Y { background: var(--s1); color: #fff; }
.code-box.N { background: #e2e8f0; color: #475569; }
.code-box.Q { background: rgba(255, 255, 255, .06); color: #64748b; border: 1px dashed #64748b; }

/* ---------- หน้าแรก ---------- */
/* ---------- หน้าแรก SmartIQA (index.php) ---------- */
/* แถบบนโปร่งใสบนส่วนหัวสีเข้ม — เลื่อนหน้าลงแล้วพื้นแถบบนค่อย ๆ กลับมา (body.scrolled จาก core.js) */
body[data-view="home"] { background: var(--surface); }
/* หน้าจอสูงกว่าเนื้อหา: ส่วนหัวสีน้ำเงินยืดเต็มจอ (เนื้อหาอยู่กึ่งกลาง) ท้ายหน้าชิดขอบล่าง — ไม่เหลือพื้นที่สีขาวว่างใต้ท้ายหน้า */
body[data-view="home"] main, body[data-view="home"] #v-home, .hm { display: flex; flex-direction: column; }
body[data-view="home"] #v-home, .hm { flex: 1 0 auto; }
.hm-hero { flex: 1 0 auto; display: flex; flex-direction: column; justify-content: center; }
.hm-in { width: 100%; }
body[data-view="home"] #topbar { background: transparent; box-shadow: none; }
body[data-view="home"] #topbar::before { content: ''; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .25s;
  background: linear-gradient(100deg, var(--brand-950) 0%, var(--brand-800) 55%, var(--brand-600) 100%); box-shadow: 0 4px 14px rgba(11, 37, 71, .3); }
body[data-view="home"].scrolled #topbar::before { opacity: 1; }
.hm-hero { position: relative; isolation: isolate; overflow: hidden; margin-top: calc(-1 * var(--topbar-h)); padding-top: var(--topbar-h); color: #fff;
  background: linear-gradient(135deg, #071a35 0%, #0d3060 40%, #164f9a 75%, #1f68c2 100%); }
.hm-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.hm-bg::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1.3px); background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 30% 35%, #000 25%, transparent 75%); mask-image: radial-gradient(ellipse 75% 65% at 30% 35%, #000 25%, transparent 75%); }
.hm-bg span { position: absolute; border-radius: 50%; }
.hm-bg .g1 { width: 46rem; height: 46rem; top: -18rem; right: -12rem; background: radial-gradient(circle, rgba(96, 165, 250, .45), transparent 62%); }
.hm-bg .g2 { width: 40rem; height: 40rem; bottom: -22rem; left: -14rem; background: radial-gradient(circle, rgba(45, 212, 191, .2), transparent 62%); }
.hm-bg .g3 { width: 22rem; height: 22rem; top: 16%; right: 34%; border: 1px solid rgba(255, 255, 255, .07); box-shadow: 0 0 0 3.5rem rgba(255, 255, 255, .025), 0 0 0 7rem rgba(255, 255, 255, .018); }
.hm-in { position: relative; max-width: 80rem; margin: 0 auto; padding: 2.5rem 1rem 2.5rem; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "copy" "login" "more"; gap: 1.25rem; }
@media (min-width: 1024px) {
  .hm-in { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); grid-template-areas: ". login" "copy login" "more login" ". login"; grid-template-rows: 1fr auto auto 1fr;
    column-gap: 3.5rem; row-gap: 0; padding: 3.5rem 1.5rem 2.25rem; }
  .hm-more { margin-top: 1.25rem; }   /* แทน row-gap (แถวว่างบน/ล่างไม่ต้องมีช่องไฟ) */
  .hm-login { padding-bottom: .5rem; }   /* เส้นโค้งด้านขวาสูงกว่า — เว้นใต้กล่องเข้าสู่ระบบเล็กน้อย */
}
.hm-copy { grid-area: copy; }
.hm-more { grid-area: more; }
.hm-login { grid-area: login; align-self: center; }
.hm-title { margin-top: 0; }
.hm-wm { display: block; font-size: clamp(2.8rem, 6.2vw, 4.6rem); font-weight: 800; line-height: 1.02; letter-spacing: -.035em; color: #fff; }
.hm-wm b { font-weight: 800; background: linear-gradient(90deg, #7dd3fc 0%, #a5b4fc 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hm-th { display: block; margin-top: -.25rem; font-size: clamp(1.35rem, 2.8vw, 2.15rem); font-weight: 600; line-height: 1.3; color: rgba(255, 255, 255, .94); }
.hm-lead { margin-top: .5rem; max-width: 38rem; font-size: .8rem; line-height: 1.6; color: rgba(226, 236, 250, .8); }
.hm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem; max-width: 42rem; }
.hm .home-stat { min-width: 0; padding: .65rem .95rem .75rem; border-radius: 1rem; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(8px); }
/* การ์ดเตี้ย: บรรทัดบน = ตัวเลข + ร้อยละ (หรือป้ายเปิดรับรายงาน) ชิดขวา · ชื่อ · แถบบาง */
.hm .home-stat .v { display: flex; align-items: baseline; gap: .3rem; font-size: 1.45rem; font-weight: 700; line-height: 1.2; color: #fff; }
.hm .home-stat .v small { font-size: .76rem; font-weight: 500; color: rgba(255, 255, 255, .62); }
.hm .home-stat .v .pc { margin-left: auto; font-size: .74rem; font-weight: 600; color: #bae6fd; font-variant-numeric: tabular-nums; }
.hm .home-stat .v .hm-open { margin-left: auto; align-self: center; }
.hm .home-stat .l { margin-top: .05rem; font-size: .72rem; color: rgba(226, 236, 250, .74); }
.hm .home-stat .m { margin-top: .5rem; }
.hm .home-stat .l-short { display: none; }
.hm .home-stat .v small, .hm-open { white-space: nowrap; }
/* การ์ดแคบ (จอโน้ตบุ๊กเล็ก · แท็บเล็ต · มือถือ): ชื่อระดับแบบสั้น ตัวเลขเล็กลง ป้าย "เปิดรับ" แบบสั้น — ไม่ล้นการ์ด (ขึ้นกับความกว้างของการ์ดเอง) */
.hm .home-stat { container-type: inline-size; }
.hm .home-stat .v { flex-wrap: wrap; }
@container (max-width: 10.5rem) {   /* ความกว้างภายในการ์ด (ไม่รวม padding) */
  .hm .home-stat .l-full, .hm .home-stat .hm-open-x { display: none; }
  .hm .home-stat .l-short { display: inline; }
  .hm .home-stat .v { font-size: 1.25rem; }
  .hm .home-stat .v small, .hm .home-stat .v .pc { font-size: .7rem; }
}
/* มือถือ: ชื่อระดับแบบสั้น · ตัวเลขเล็กลงให้อยู่บรรทัดเดียว · การ์ดปีการศึกษาเต็มแถว (แถบสั้น) */
@media (max-width: 639px) {
  .hm .home-stat .l-full { display: none; }
  .hm .home-stat .l-short { display: inline; }
  .hm .home-stat { padding: .6rem .8rem .7rem; }
  .hm .home-stat .v { font-size: 1.25rem; }
  .hm .home-stat .v small, .hm .home-stat .v .pc { font-size: .7rem; }
  .hm-stats > .home-stat:last-child { grid-column: 1 / -1; }
}
.hm .home-stat .m .viz-meter { height: 5px; background: rgba(255, 255, 255, .16); }
.hm .home-stat .m .viz-meter > div { background: linear-gradient(90deg, #5eead4, #7dd3fc); }
.hm .skel { background: linear-gradient(90deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .18), rgba(255, 255, 255, .08)); background-size: 200% 100%; }
.hm-open { display: inline-flex; align-items: center; gap: .4rem; padding: .18rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 700; color: #bbf7d0;
  background: rgba(34, 197, 94, .16); border: 1px solid rgba(74, 222, 128, .35); }
.hm-open i { width: .45rem; height: .45rem; border-radius: 50%; background: #4ade80; animation: live-dot 1.8s ease-out infinite; }
.hm-open.off { color: #fecaca; background: rgba(239, 68, 68, .16); border-color: rgba(248, 113, 113, .35); }
.hm-open.off i { width: auto; height: auto; border-radius: 0; background: none; font-size: .65rem; animation: none; }
.hm-cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.4rem; }
.hm-btn { background: #fff; color: var(--brand-800); box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .45); }
.hm-btn:hover { background: var(--brand-50); color: var(--brand-900); }
.hm-btn-ghost { color: #fff; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .34); }
.hm-btn-ghost:hover { color: #fff; background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .55); }
@media (max-width: 639px) { .hm-cta > .btn { flex: 1 1 100%; } }   /* มือถือ: ปุ่มเต็มความกว้าง เรียงบน-ล่าง */
/* กล่องเข้าสู่ระบบ: หัวเรียงแนวนอน (ไอคอนซ้าย · ชื่อและคำอธิบายขวา) ชิดซ้ายแนวเดียวกับช่องกรอก มีเส้นคั่นก่อนแบบฟอร์ม
   · แสงฟ้าจาง ๆ มุมบนซ้ายหลังไอคอน · ช่องกรอกพื้นเทาอ่อน (โฟกัสแล้วเป็นสีขาวมีวงสีหลัก) · ปุ่มไล่สี */
.login-card { position: relative; width: 100%; max-width: 25.5rem; margin-inline: auto; padding: 1.5rem 1.9rem 1.15rem; color: var(--ink); border-radius: 1.75rem;
  background: radial-gradient(90% 42% at 0% 0%, #e6f0fc 0%, rgba(230, 240, 252, 0) 100%), #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .7), 0 0 0 9px rgba(255, 255, 255, .08), 0 40px 80px -30px rgba(2, 12, 32, .8); }
.lc-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.15rem; padding-bottom: 1.1rem; border-bottom: 1px solid #e8edf4; }
.lc-mark { flex: none; width: 2.9rem; height: 2.9rem; display: grid; place-items: center; border-radius: .95rem; font-size: 1.1rem; color: #fff;
  background: linear-gradient(135deg, #3b8bea 0%, var(--brand-700) 55%, var(--brand-900) 100%);
  box-shadow: 0 12px 22px -12px rgba(31, 104, 194, .9), inset 0 1px 0 rgba(255, 255, 255, .25); }
.lc-ht { min-width: 0; }
.lc-t { font-size: 1.3rem; font-weight: 700; line-height: 1.2; color: var(--ink); }
.lc-s { margin-top: .2rem; font-size: .8rem; line-height: 1.45; color: var(--ink-3); }
@media (max-width: 479px) { .login-card { padding-inline: 1.4rem; } }   /* มือถือ: คำอธิบายใต้ชื่ออยู่บรรทัดเดียว */
.lc-form { display: grid; gap: .8rem; }
.lc-form .lbl { margin-bottom: .3rem; font-size: .8rem; color: var(--ink-2); }
.input-ic { position: relative; }
.input-ic > i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: #9aa8bb; pointer-events: none; transition: color .15s; }
.input-ic .fld { height: 2.95rem; padding-left: 2.75rem; border-radius: 1rem; font-size: .95rem; background: #f5f7fb; border-color: #e2e8f0; transition: background .15s, border-color .15s, box-shadow .15s; }
.input-ic .fld::placeholder { color: #a3b0c2; }
.input-ic .fld:hover { border-color: #cbd5e1; }
.input-ic .fld:focus { background: #fff; border-color: var(--brand-500); box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .14); }
.input-ic:focus-within > i { color: var(--brand-600); }
.input-ic .fld.has-eye { padding-right: 3rem; }
.input-ic .pw-eye { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); width: 2.35rem; height: 2.35rem; display: grid; place-items: center; border-radius: .75rem; color: #9aa8bb; }
.input-ic .pw-eye:hover, .input-ic .pw-eye:focus-visible { color: var(--brand-700); background: var(--brand-50); outline: none; }
.lc-btn { height: 2.95rem; margin-top: .3rem; border: 0; border-radius: 1rem; font-size: 1rem; color: #fff;
  background: linear-gradient(135deg, #3b8bea 0%, var(--brand-600) 45%, var(--brand-800) 100%);
  box-shadow: 0 14px 26px -14px rgba(31, 104, 194, .95), inset 0 1px 0 rgba(255, 255, 255, .2); transition: filter .15s, box-shadow .15s, transform .15s; }
.lc-btn:hover { color: #fff; filter: brightness(1.06); box-shadow: 0 18px 30px -14px rgb(31, 104, 194), inset 0 1px 0 rgba(255, 255, 255, .2); }
.lc-btn i { transition: transform .2s; }
.lc-btn:hover i.fa-arrow-right { transform: translateX(3px); }
.lc-hint { display: flex; align-items: flex-start; justify-content: center; gap: .45rem; margin-top: .95rem; padding-top: .75rem; border-top: 1px dashed #e2e8f0;
  font-size: .76rem; line-height: 1.5; color: var(--ink-3); text-align: center; }
.lc-hint i { margin-top: .2rem; color: var(--brand-500); }
.hm-wave { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 1.75rem; fill: var(--surface); }   /* ต่อเนื่องกับท้ายหน้า (สีพื้นเดียวกัน) */
.hm-foot { background: var(--surface); }
.hm-foot .in { max-width: 80rem; margin: 0 auto; padding: .35rem 1rem .9rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; font-size: .8rem; color: var(--ink-3); }
.hm-foot .wm { font-size: 1.05rem; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.hm-foot .who { flex: 1 1 30rem; min-width: 0; display: flex; align-items: center; gap: .75rem; }
.hm-foot .credit { margin-top: .2rem; font-size: .68rem; line-height: 1.5; color: var(--ink-3); }
.hm-foot .credit b { font-weight: 600; color: var(--ink-2); }
.hm-foot .credit .nw { white-space: nowrap; }   /* ไม่ตัดกลางชื่อคน/หน่วยงาน */
.hm-foot .wm b { font-weight: 800; color: var(--brand-600); }
.hm-rise { animation: hm-rise .7s cubic-bezier(.2, .7, .2, 1) both; }
.hm-rise.d1 { animation-delay: .08s; }
.hm-rise.d2 { animation-delay: .16s; }
@keyframes hm-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .hm-rise, .hm-open i { animation: none; } }

.eff-vis { display: inline-flex; align-items: center; gap: .4rem; font-size: .7rem; color: rgba(255, 255, 255, .78); cursor: pointer; }
.switch.sm { width: 2.1rem; height: 1.2rem; }
.switch.sm::after { width: .85rem; height: .85rem; top: .175rem; left: .175rem; }
.switch.sm[aria-checked="true"]::after { transform: translateX(.9rem); }
.switch[aria-checked="mixed"] { background: #86c29a; }
.switch.sm[aria-checked="mixed"]::after { transform: translateX(.45rem); }
.switch:disabled { opacity: .45; cursor: not-allowed; }
.eff-card .switch:not([aria-checked="true"]) { background: rgba(255, 255, 255, .28); }
.eff-vis-note { margin: -.25rem 0 .75rem; padding: .4rem .6rem; border-radius: .6rem; font-size: .72rem; background: rgba(250, 178, 25, .16); border: 1px solid rgba(250, 178, 25, .45); color: #fde68a; }

/* ---------- ประเมินคุณภาพภายนอก (สมศ.) ของสถานศึกษา — school_eqa.php / assets/school_eqa.js ---------- */
/* ต่อจากตาราง 1.1 ในหน้าจัดทำเล่ม: ครูแยกระดับ + บุคลากรอื่น (staffIqaBox) */
.sd-iqastaff .sd-n { max-width: 9rem; height: 2.4rem; }
.sd-calc.sd-iqasum > i { margin-right: .35rem; }
.sd-calc.sd-iqasum { display: block; margin-top: .9rem; padding: .55rem .8rem; border-radius: .7rem; background: #f6f8fc; font-size: .84rem; line-height: 1.55; color: var(--ink-2); white-space: normal; }
.sd-calc.sd-iqasum.is-ok { background: #f0fdf4; color: #14532d; }
.sd-calc.sd-iqasum.is-bad { background: #fff1f2; color: #9f1239; font-weight: 600; box-shadow: inset 0 0 0 1px #fecdd3; }
/* ข้อ 6.1 ในหน้าจัดทำเล่ม (sar_doc.php): ดึงจากหน้านี้ ช่องล็อกไว้ */
.sd-lockset { min-width: 0; margin: 0; padding: 0; border: 0; }
.sd-lockset .ck { cursor: default; }
.sd-eqa-lock { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .9rem; padding: .75rem 1rem; border: 1px solid #fde68a; border-radius: .8rem; background: #fffbeb; font-size: .85rem; line-height: 1.55; color: #78350f; }
.sd-eqa-lock > i { color: #b45309; }
.sd-eqa-lock > span { flex: 1 1 18rem; min-width: 0; }
.eq-jumps { display: flex; flex-wrap: wrap; gap: .35rem; }
.eq-jump { display: inline-flex; align-items: center; height: 2rem; padding: 0 .8rem; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font-size: .8rem; font-weight: 600; color: var(--brand-700); }
.eq-jump:hover { background: var(--brand-50); border-color: var(--brand-200); }
.eq-round { overflow: hidden; scroll-margin-top: 5.5rem; }
.eq-rh { display: flex; gap: 1rem; align-items: flex-start; padding: 1.1rem 1.25rem; background: linear-gradient(135deg, #eef5ff 0%, #f8fbff 60%, #fff 100%); border-bottom: 1px solid var(--line); }
.eq-no { flex-shrink: 0; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: .8rem; background: var(--brand-600); color: #fff; font-size: 1.2rem; font-weight: 700; }
.eq-rh h2 { font-size: 1.1rem; font-weight: 700; line-height: 1.35; color: var(--ink); }
.eq-round.is-shut .eq-rh { border-bottom: 0; align-items: center; }
.eq-fold { flex-shrink: 0; }
.eq-sum-l { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; margin-top: .3rem; font-size: .8rem; line-height: 1.5; color: var(--ink-3); }
.eq-rh h2 small { margin-left: .35rem; font-size: .82rem; font-weight: 600; color: var(--brand-700); }
.eq-def { display: grid; gap: .3rem 1.5rem; margin-top: .55rem; font-size: .8rem; line-height: 1.5; }
.eq-def > div { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: .75rem; }
.eq-def dt { font-weight: 700; color: var(--ink-2); }
.eq-def dd { color: var(--ink-2); }
.eq-rb { padding: 1.1rem 1.25rem 1.25rem; }
.eq-rb > * + * { margin-top: 1rem; }
.eq-top { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: flex-start; }
.eq-date { display: grid; grid-template-columns: 5rem 9.5rem 6.2rem; gap: .35rem; }
.eq-date select.fld { padding-left: .6rem; padding-right: 1.2rem; }
.eq-link { display: flex; gap: .55rem; align-items: baseline; padding: .6rem .8rem; border-radius: .7rem; background: var(--brand-50); font-size: .82rem; line-height: 1.5; color: var(--brand-900); }
.eq-link i { color: var(--brand-600); }
.eq-lv { border: 1px solid var(--line); border-radius: .9rem; overflow: hidden; background: #fff; }
.eq-lv-h { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; padding: .7rem 1rem; background: #f8fafc; border-bottom: 1px solid var(--line); }
.eq-lv-h > i { color: var(--brand-600); }
.eq-lv-h h3 { font-size: .95rem; font-weight: 700; color: var(--ink); }
.eq-lv-h > span { font-size: .76rem; color: var(--ink-3); }
.eq-row { display: grid; align-items: center; gap: .3rem .9rem; padding: .5rem 1rem; border-bottom: 1px solid #eef1f5; font-size: .85rem; }
.eq-row.r3 { grid-template-columns: minmax(0, 1fr) 3.4rem 5.2rem 11.5rem; }
.eq-row.r4 { grid-template-columns: minmax(0, 1fr) 11.5rem; }
.eq-row.r5 { grid-template-columns: minmax(0, 1fr) 7.5rem 10.5rem; }
.eq-rows > .eq-row:last-child { border-bottom: 0; }
.eq-row.eq-head { padding-top: .55rem; padding-bottom: .55rem; font-size: .74rem; font-weight: 600; color: var(--ink-3); }
.eq-row.eq-head > div:not(:first-child) { text-align: center; }
.eq-row.eq-head small { font-weight: 500; }
.eq-row.eq-sum { background: #f8fafc; font-weight: 600; }
.eq-row.eq-sum small { font-weight: 500; color: var(--ink-3); }
.eq-g { padding: .45rem 1rem; border-bottom: 1px solid #eef1f5; background: var(--brand-50); font-size: .8rem; font-weight: 700; line-height: 1.45; color: var(--brand-800); }
.eq-g small { margin-left: .3rem; font-weight: 500; color: var(--brand-700); }
.eq-t { min-width: 0; line-height: 1.5; color: var(--ink); }
.eq-w { text-align: center; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.eq-c { text-align: center; }
.eq-c > b { font-size: 1rem; font-variant-numeric: tabular-nums; }
.eq-num { text-align: center; padding: 0 .4rem; font-variant-numeric: tabular-nums; }
.eq-num.eq-bad { border-color: #e11d48; background: #fff1f2; box-shadow: 0 0 0 3px rgba(225, 29, 72, .14); }
.eq-cert { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .75rem 1rem; border-top: 1px solid var(--line); }
.eq-cert select { width: auto; flex: 1 1 15rem; max-width: 22rem; }
.eq-txt { display: grid; gap: .75rem; padding: .85rem 1rem 1rem; border-top: 1px solid var(--line); }
textarea.eq-ta { height: auto; min-height: 4.2rem; padding: .55rem .8rem; line-height: 1.6; resize: none; overflow: hidden; }
.eq-empty { padding: .85rem 1rem; font-size: .84rem; color: var(--ink-3); }
.eq-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .75rem; padding: 1rem; }
.eq-doc { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: .8rem; background: #f8fafc; text-align: center; transition: border-color .15s, box-shadow .15s; }
.eq-doc:hover, .eq-doc:focus-visible { border-color: var(--brand-200); box-shadow: 0 6px 16px -8px rgba(11, 37, 71, .35); }
.eq-doc img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: top; background: #fff; }
.eq-doc span { padding: .35rem; font-size: .76rem; font-weight: 600; color: var(--ink-2); }
@media (max-width: 767px) {
  .eq-def > div { grid-template-columns: 1fr; gap: 0; }
  .eq-rh { padding: .9rem 1rem; gap: .75rem; flex-wrap: wrap; }
  .eq-rh > .min-w-0 { flex-basis: calc(100% - 3.5rem); }
  .eq-fold { margin-left: 3.35rem; }
  .eq-rb { padding: .9rem .75rem 1rem; }
  /* จอแคบ: ชื่อรายการเต็มบรรทัด ช่องกรอกเรียงบรรทัดถัดไป พร้อมชื่อช่องกำกับ (data-l) */
  .eq-row.eq-head { display: none; }
  .eq-row.r3, .eq-row.r4, .eq-row.r5 { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .65rem .75rem; }
  .eq-row.r3 { grid-template-columns: 3.4rem 5.2rem minmax(0, 1fr); }
  .eq-row .eq-t { grid-column: 1 / -1; }
  .eq-row [data-l]::before { content: attr(data-l); display: block; margin-bottom: .15rem; font-size: .68rem; font-weight: 600; color: var(--ink-3); }
  .eq-row [data-l] { text-align: left; }
  .eq-date { grid-template-columns: 4.8rem minmax(0, 1fr) 6rem; }
}

/* ---------- หัวแบบรายงาน SAR (ใช้การ์ดหัวแบบหน้าหลักสถานศึกษา: .sh-wrap / .sh-card / .sh-top) ---------- */
.fh-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .5rem; }
.fh-chip { display: inline-flex; align-items: center; gap: .35rem; height: 1.6rem; padding: 0 .65rem; border-radius: 999px; font-size: .76rem; font-weight: 600; color: var(--ink-2); background: #fff; border: 1px solid var(--line); }
.fh-chip i { font-size: .72rem; color: var(--brand-600); }
.fh-chip.strong { color: var(--brand-800); background: var(--brand-50); border-color: var(--brand-100); }
.fh-meta .badge { height: 1.6rem; padding: 0 .65rem; }
.fh-saved { margin-top: .45rem; font-size: .74rem; color: var(--ink-3); }
.fh-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
@media (max-width: 767px) { .fh-acts { width: 100%; justify-content: flex-start; } .fh-acts .btn { flex: 1 1 auto; } }
/* แถบประกาศในการ์ดหัว */
.sh-note { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .7rem; padding: .55rem 1.25rem; font-size: .82rem; line-height: 1.5; border-top: 1px solid; }
.sh-note > i { flex-shrink: 0; }
.sh-note.sm { padding-top: .4rem; padding-bottom: .4rem; font-size: .72rem; line-height: 1.45; }   /* ข้อความแนะนำขั้นตอน (หน้าจัดทำเล่ม): ตัวเล็กกว่าข้อความแจ้งอื่น */
.sh-note.amber { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.sh-note.amber > i { color: #d97706; }
.sh-note.violet { background: var(--accent-50); border-color: var(--accent-200); color: var(--accent-900); }
.sh-note.violet > i { color: var(--accent-700); }
.sh-note.gray { background: #f8fafc; border-color: var(--line); color: var(--ink-2); }
.sh-note.gray > i { color: var(--ink-3); }
/* คำแนะนำการกรอก (แถบล่างของการ์ดหัว เปิด/ปิดได้) */
.sh-guide { border-top: 1px solid var(--line); }
.sh-guide > summary { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem 1.25rem; font-size: .84rem; font-weight: 600; color: var(--brand-700); cursor: pointer; list-style: none; }
.sh-guide > summary::-webkit-details-marker { display: none; }
.sh-guide > summary:hover { background: #f8fbff; }
.sh-guide > ol { margin: 0 1.25rem 1rem; padding-left: 1.25rem; list-style: decimal; display: grid; gap: .35rem; font-size: .84rem; color: var(--ink-2); }
@media (min-width: 768px) { .sh-note, .sh-guide > summary { padding-left: 1.5rem; padding-right: 1.5rem; } .sh-guide > ol { margin-left: 1.5rem; margin-right: 1.5rem; } }

/* ---------- เปรียบเทียบรายปี ---------- */
.delta { display: inline-flex; align-items: center; gap: .25rem; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.delta i { font-size: .62rem; }
.delta.up { color: #08790a; }
.delta.down { color: #b42323; }
.delta.flat { color: var(--ink-3); font-weight: 500; }
.cmp-pick { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--ink-3); }
.cmp-pick > i { color: var(--ink-4); }
.std-chg { display: inline-flex; align-items: center; gap: .15rem; margin-right: .45rem; font-size: .72rem; }
.std-chg small { color: var(--ink-4); font-size: .66rem; }
.std-chg.up i { color: #08790a; }
.std-chg.down i { color: #b42323; }
.std-chg.same i, .std-chg.na i { color: var(--ink-4); }

/* ---------- แบบสังเคราะห์ SAR (admin_workbook.php): ตารางแบบแผ่นงาน ---------- */
.wb-tabs { display: flex; gap: .15rem; padding: 0 .75rem; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
.wb-tabs button { display: inline-flex; align-items: center; gap: .45rem; padding: .75rem .8rem .65rem; font-size: .84rem; font-weight: 600; color: var(--ink-3); border-bottom: 2.5px solid transparent; white-space: nowrap; transition: color .15s, border-color .15s; }
.wb-tabs button i { font-size: .74rem; }
.wb-tabs button:hover { color: var(--ink); }
.wb-tabs button[aria-selected="true"] { color: var(--brand-700); border-bottom-color: var(--brand-600); }
.wb-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1rem; padding: .55rem 1rem; font-size: .78rem; color: var(--ink-3); background: #f8fafc; border-bottom: 1px solid var(--line); }
.wb-bar > span > i { color: var(--brand-600); margin-right: .2rem; }
.wb-wrap { max-height: calc(100vh - 13rem); overflow: auto; }
.wb-wrap.wb-all { max-height: none; }   /* แสดงครบทุกแถว — หัวตารางเลื่อนตามหน้าด้วย wbFollowHead() */
.wb-all thead { position: relative; z-index: 4; }
.wb-all thead.wb-float th { box-shadow: 0 6px 10px -8px rgba(15, 23, 42, .35); }
.wb-all thead.wb-float th.wb-cn { box-shadow: 1px 0 0 #cbd5e1, 0 6px 10px -8px rgba(15, 23, 42, .35); }
.wb-tbl { border-collapse: separate; border-spacing: 0; font-size: .78rem; color: var(--ink-2); }
.wb-tbl th, .wb-tbl td { padding: .32rem .5rem; border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; }
.wb-tbl thead th { position: sticky; top: 0; z-index: 2; min-width: 3.2rem; background: #eef5fd; color: var(--ink); font-weight: 600; text-align: center; vertical-align: middle; line-height: 1.35; }
.wb-tbl thead th.wb-title { background: #dbeafb; font-size: .84rem; font-weight: 700; }
.wb-tbl thead th.wb-item { background: #f6f9fe; font-size: .74rem; font-weight: 600; color: var(--brand-800); white-space: nowrap; cursor: help; }
.wb-tbl thead th.wb-item.full { min-width: 9.5rem; max-width: 11rem; white-space: normal; text-align: left; vertical-align: top; font-weight: 400; color: var(--ink-2); }
.wb-tbl .wb-c0, .wb-tbl .wb-cn { position: sticky; z-index: 1; background: #fff; }
.wb-tbl .wb-c0 { left: 0; width: 3.2rem; min-width: 3.2rem; max-width: 3.2rem; }
.wb-tbl .wb-cn { left: 3.2rem; width: 15rem; min-width: 15rem; max-width: 15rem; box-shadow: 1px 0 0 #cbd5e1; }
.wb-tbl thead th.wb-wide { text-align: left; }
.wb-note-ic { margin-left: .3rem; font-size: .78em; color: var(--brand-500); cursor: help; outline: none; }   /* คำอธิบายในวงเล็บของหัวตาราง (ชี้เพื่ออ่าน) */
.wb-note-ic:hover, .wb-note-ic:focus-visible { color: var(--brand-700); }
.wb-tbl thead th.wb-wide > .wb-lbl { position: sticky; left: 19rem; display: inline-block; max-width: 42rem; }
.wb-tbl thead .wb-c0, .wb-tbl thead .wb-cn { z-index: 3; background: #eef5fd; }
/* จอเล็ก: คอลัมน์ที่และชื่อโรงเรียนที่ค้างไว้แคบลง เหลือที่ให้ข้อมูล */
@media (max-width: 639px) {
  .wb-tbl .wb-c0 { width: 2.4rem; min-width: 2.4rem; max-width: 2.4rem; }
  .wb-tbl .wb-cn { left: 2.4rem; width: 8.5rem; min-width: 8.5rem; max-width: 8.5rem; }
  .wb-tbl thead th.wb-wide > .wb-lbl { left: 11.4rem; }
}
.wb-tbl td { text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wb-tbl td.num { text-align: right; }
.wb-tbl td.wb-name { text-align: left; white-space: normal; font-weight: 500; color: var(--ink); }
.wb-tbl td.wb-b { color: #b6c0ce; }
.wb-tbl td.wb-b.on { color: #166534; background: #e7f8ee; font-weight: 700; }
.wb-tbl td.wb-code { cursor: help; }
.wb-tbl td.wb-text { min-width: 15rem; max-width: 21rem; text-align: left; vertical-align: top; white-space: normal; line-height: 1.5; }
.wb-tbl tbody tr:hover td { background-color: #f6faff; }
.wb-tbl tbody tr:hover td.wb-b.on { background-color: #d8f2e2; }
.wb-tbl tfoot th, .wb-tbl tfoot td { background: #f1f5f9; font-weight: 700; color: var(--ink); }
.wb-tbl tfoot .wb-fl { text-align: right; }
.wb-tbl tfoot tr.pct td { color: var(--brand-800); }
.wb-legend { border-top: 1px solid var(--line); }
.wb-legend > summary { padding: .65rem 1rem; font-size: .8rem; font-weight: 600; color: var(--brand-700); cursor: pointer; }
.wb-legend > summary i { margin-right: .3rem; }
.wb-lg { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .75rem 1.25rem; padding: 0 1rem 1rem; font-size: .76rem; color: var(--ink-2); }
.wb-lg b { display: block; margin-bottom: .2rem; color: var(--ink); }
.wb-lg span { display: block; }
.wb-lg em { display: inline-block; min-width: 1.4rem; font-style: normal; font-weight: 700; color: var(--brand-700); }
/* ประสิทธิภาพและโอกาสในการพัฒนา (admin_effsheet.php · kind 'eff'): สีกลุ่มคอลัมน์ตามแบบฟอร์ม สพฐ. แบบจางลง · หัวรายการแนวตั้ง */
.wb-tbl thead th.wb-rot { vertical-align: bottom; min-width: 2.4rem; padding: .5rem .25rem; }
.wb-eff thead th.wb-wide { text-align: center; }   /* หัวกว้างจัดกลางตามแบบฟอร์ม (ป้ายยังค้างข้างคอลัมน์ชื่อขณะเลื่อน) */
.wb-tbl .wb-rt { display: inline-block; max-height: 8.5rem; writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; white-space: normal; line-height: 1.3; }
.wb-eff thead th.ef-title { background: #fcefc4; }
.wb-eff thead th.ef-base { background: #e3eefa; }
.wb-eff thead th.ef-in { background: #fbe3d4; }
.wb-eff thead th.ef-phy { background: #e1efd5; }
.wb-eff thead th.ef-per, .wb-eff thead th.ef-out { background: #fff0c2; }
.wb-eff thead th.ef-ext { background: #fcebdf; }
.wb-eff thead th.ef-proc { background: #e8f2df; }
.wb-eff thead th.ef-res, .wb-eff thead th.ef-grp { background: #fff3a6; }
.wb-eff thead th.ef-yn { background: #eef2f6; }
.wb-eff thead th.wb-item { color: var(--ink); font-weight: 600; }
/* กระชับให้ครบทุกคอลัมน์ในกล่อง (จอกว้าง 1280px ขึ้นไป): ตารางเต็มความกว้าง · คอลัมน์ตัวเลขแคบ · หัวแนวตั้งตัวเล็กลง · ชื่อโรงเรียนตัดบรรทัดได้ */
.wb-tbl.wb-eff { width: 100%; }
.wb-eff th, .wb-eff td { padding-left: .2rem; padding-right: .2rem; }
.wb-eff thead th { min-width: 2.6rem; }
.wb-eff thead th.wb-rot { min-width: 1.85rem; padding: .45rem .1rem; }
.wb-eff thead th.wb-item { font-size: .7rem; }
.wb-eff thead th.ef-out:not(.wb-rot) { min-width: 3.6rem; }
.wb-eff thead th.ef-grp { min-width: 4.2rem; }
.wb-eff td.wb-name { padding-left: .5rem; padding-right: .4rem; }
/* แบบสังเคราะห์ SAR แบบกระชับ (ข้อมูลพื้นฐาน · มฐ. · แผน): เต็มความกว้างกล่อง คอลัมน์แคบ — จอกว้าง 1280px ขึ้นไปเห็นครบทุกคอลัมน์
   (แผ่นงานที่มีรายการมากเกินความกว้างจอ เช่น มฐ.1 ขั้นพื้นฐาน 66 รายการ ยังเลื่อนแนวนอนได้) */
.wb-tbl.wb-info, .wb-tbl.wb-items, .wb-tbl.wb-plan { width: 100%; }
.wb-info th, .wb-info td, .wb-items th, .wb-items td, .wb-plan th, .wb-plan td { padding-left: .25rem; padding-right: .25rem; }
.wb-info thead th { min-width: 2.6rem; font-size: .74rem; }
.wb-items thead th, .wb-plan thead th { min-width: 1.55rem; }
.wb-items thead th.wb-rot { min-width: 1.55rem; padding: .35rem .1rem; font-size: .7rem; }
.wb-items thead th.wb-item:not(.full), .wb-plan thead th.wb-item:not(.full) { padding-left: .1rem; padding-right: .1rem; }
.wb-info td.wb-name, .wb-items td.wb-name, .wb-plan td.wb-name { padding-left: .5rem; padding-right: .4rem; }
@media (min-width: 640px) {
  .wb-info .wb-c0, .wb-items .wb-c0, .wb-plan .wb-c0 { width: 2.4rem; min-width: 2.4rem; max-width: 2.4rem; }
  .wb-info .wb-cn, .wb-items .wb-cn, .wb-plan .wb-cn { left: 2.4rem; width: 11.5rem; min-width: 11.5rem; max-width: 11.5rem; }
  .wb-info .wb-cn { width: 11.25rem; min-width: 11.25rem; max-width: 11.25rem; }
  .wb-items thead th.wb-wide > .wb-lbl, .wb-plan thead th.wb-wide > .wb-lbl { left: 14.25rem; }
}
@media (min-width: 640px) {
  .wb-eff .wb-c0 { width: 2.4rem; min-width: 2.4rem; max-width: 2.4rem; }
  .wb-eff .wb-cn { left: 2.4rem; width: 11.75rem; min-width: 11.75rem; max-width: 11.75rem; }
  .wb-eff thead th.wb-wide > .wb-lbl { left: 14.5rem; }
}
.wb-eff td.ef-phy { background: #f3f9ee; }
.wb-eff td.ef-per, .wb-eff td.ef-out { background: #fffaea; }
.wb-eff td.ef-ext { background: #fef6f0; }
.wb-eff td.ef-proc { background: #f5faf1; }
.wb-eff td.ef-res, .wb-eff td.ef-grp { background: #fffbd9; }
.wb-eff tbody tr:hover td { background-color: #f0f6ff; }
.wb-eff td { cursor: default; }
.wb-eff td[title] { cursor: help; }
.wb-eff td.ef-l3 { font-weight: 700; color: var(--ink); }
.wb-eff td.ef-l1, .wb-eff td.ef-l2 { color: var(--ink-3); }
.wb-eff td.ef-n3 { font-weight: 700; color: var(--ink); }
.wb-eff td.ef-g { font-size: .84rem; font-weight: 800; letter-spacing: .06em; }
.wb-eff td.ef-yn { font-weight: 700; }
.wb-eff .ef-na { color: #cbd5e1; }
.ef-y { color: var(--s1); }
.ef-n { color: #94a3b8; }
.ef-bar { justify-content: flex-start; }
.ef-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-right: auto; }
.ef-chip { display: inline-flex; align-items: center; gap: .45rem; padding: .2rem .65rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: .76rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; transition: border-color .15s, background .15s; }
.ef-chip b { color: var(--ink); font-variant-numeric: tabular-nums; }
.ef-chip:hover { border-color: var(--brand-300); }
.ef-chip[aria-pressed="true"] { background: var(--brand-50); border-color: var(--brand-500); color: var(--brand-800); }
.ef-cd { font-weight: 800; letter-spacing: .06em; }
.ef-lg .ef-lg-wide { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); column-gap: 1.25rem; }
.ef-lg .ef-lg-wide > b { grid-column: 1 / -1; }
.ef-lg b.mt-2 { margin-top: .5rem; }
.ef-lg em .ef-y { font-style: normal; }
.ef-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr)); gap: .75rem; padding: 0 1rem 1rem; }
.ef-gr { padding: .75rem .9rem; border: 1px solid var(--line); border-radius: .75rem; font-size: .76rem; line-height: 1.6; color: var(--ink-2); }
.ef-gr > .ef-cd { margin-right: .5rem; font-size: 1rem; }
.ef-gr > b { font-size: .8rem; color: var(--ink); }
.ef-gr p { margin-top: .4rem; }
.ef-gr p > span { display: block; font-weight: 600; color: var(--ink); }
.wbf-ef { display: flex; align-items: center; min-height: 2.9rem; padding: .4rem .75rem; }
.wbf-ctx b { font-weight: 600; color: var(--ink-2); }
/* สถานะการส่งรายงานแบบกระชับ (หน้าติดตามการส่ง): หัว + คำอธิบายสีบรรทัดเดียว · ระดับละหนึ่งบรรทัด แถบบาง */
.trs-card .card-h { align-items: center; padding: .85rem 1.25rem .2rem; }
.trs-card .card-tools { align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.trs-legend { margin: 0 .5rem 0 0; }
.trs-card .card-b { padding: .55rem 1.25rem 1rem; }
.trs-wrap { display: grid; gap: .75rem 2.5rem; }
@media (min-width: 768px) { .trs-wrap { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.trs-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; margin-bottom: .35rem; font-size: .8rem; color: var(--ink-3); }
.trs-h > b { font-size: .88rem; color: var(--ink); }
.trs-n { font-variant-numeric: tabular-nums; }
.trs-n b { font-size: 1rem; color: var(--ink); }
.trs-o { margin-left: auto; font-variant-numeric: tabular-nums; }
.trs-bar { display: flex; gap: 2px; height: .65rem; overflow: hidden; border-radius: 999px; background: var(--viz-zero); }
.trs-bar > i { display: block; min-width: 3px; outline: none; transition: filter .15s; }
.trs-bar > i:hover, .trs-bar > i:focus-visible { filter: brightness(1.1); }
/* ติดตามการส่งรายงาน SAR แบบสาธารณะ (track.php) — ผู้บริหารสถานศึกษาเปิดจากลิงก์ (ส่วนใหญ่บนมือถือ) */
.tk-sum { display: grid; gap: 1rem 2.5rem; padding: 1rem 1.25rem 1.2rem; border-top: 1px solid var(--line); }
@media (min-width: 900px) { .tk-sum { grid-template-columns: minmax(0, 17rem) minmax(0, 1fr); align-items: center; padding: 1.1rem 1.5rem 1.3rem; } }
.tk-big-v { display: flex; align-items: baseline; gap: .4rem; }
.tk-big-v b { font-size: 2rem; font-weight: 800; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.tk-big-v span { font-size: .9rem; font-weight: 600; color: var(--ink-3); }
.tk-big-l { margin: .25rem 0 .55rem; font-size: .84rem; font-weight: 700; color: #15803d; }
.tk-big .viz-meter > div { background: var(--st-good); }
.tk-big-s { margin-top: .5rem; font-size: .76rem; color: var(--ink-3); }
.tk-big-s b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tk-lvs { display: grid; gap: .85rem 2rem; }
@media (min-width: 640px) { .tk-lvs { grid-template-columns: 1fr 1fr; } }
.tk-lv-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; margin-bottom: .35rem; font-size: .8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tk-lv-h > b { font-size: .88rem; color: var(--ink); }
.tk-lv-h span b { font-size: 1rem; color: var(--ink); }
.tk-lv-o { margin-left: auto; }
.tk-lv-bar { display: flex; gap: 2px; height: .65rem; overflow: hidden; border-radius: 999px; background: var(--viz-zero); }
.tk-lv-bar > i { display: block; min-width: 3px; outline: none; }
.tk-lv-bar > i.ok { background: var(--st-good); }
.tk-lv-bar > i.draft { background: var(--st-warn); }
.tk-lv-bar > i.none { background: var(--st-crit); }
/* การ์ดหัวกว้างเท่ารายการด้านล่าง (ขอบซ้าย-ขวาตรงกัน) */
body[data-view="track"] .sh-wrap > .sh-card { max-width: calc(1320px - 2rem); margin-inline: auto; }
@media (min-width: 768px) { .tk-page { padding-left: 1.5rem; padding-right: 1.5rem; } body[data-view="track"] .sh-wrap > .sh-card { max-width: calc(1320px - 3rem); } }
.tk-card { margin-top: .25rem; }
.tk-find { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .6rem; padding: 1rem 1rem .7rem; }
.tk-q { grid-column: 1 / -1; }
.tk-q > i { left: .95rem; font-size: .95rem; }
.tk-find .fld { height: 2.9rem; border-radius: .85rem; font-size: .92rem; }
.tk-q .fld { padding-left: 2.6rem; font-size: .95rem; }
.tk-chips { padding: 0 1rem .9rem; border-bottom: 1px solid var(--line); }
@media (min-width: 900px) {
  .tk-find { grid-template-columns: minmax(0, 1fr) 12rem 12rem; padding: 1.1rem 1.25rem .7rem; }
  .tk-q { grid-column: auto; }
  .tk-chips { padding: 0 1.25rem .9rem; }
}
.tk-res { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .75rem; padding: .55rem 1rem; font-size: .8rem; color: var(--ink-3); background: #f8fafc; border-bottom: 1px solid var(--line); }
.tk-res b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tk-res.narrow { background: #fffbeb; color: #78350f; }
.tk-res.narrow b { color: #78350f; }
@media (min-width: 900px) { .tk-res { padding: .55rem 1.25rem; } }
.tk-tbl td { vertical-align: middle; }
.tk-tbl td.tk-no { color: var(--ink-4); font-variant-numeric: tabular-nums; }
.tk-tbl tr.is-todo td.tk-no { box-shadow: inset 3px 0 0 var(--st-crit); }
.tk-sch b { display: block; font-weight: 600; color: var(--ink); }
.tk-sch small { display: block; margin-top: .1rem; font-size: .74rem; color: var(--ink-3); }
.tk-at { display: block; margin-top: .25rem; font-size: .72rem; color: var(--ink-3); white-space: nowrap; }
.tk-na { font-size: .76rem; color: var(--ink-4); }
.tk-all { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.tk-all.ok { background: #15803d; color: #fff; }
.tk-all.no { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }
/* ส่วนที่ใช้เฉพาะมือถือ (ซ่อนบนจอใหญ่): ปีแบบชิปเลือกได้ · ปุ่มตัวกรองในช่องค้นหา · ป้ายสรุปข้างชื่อโรงเรียน */
.tk-pm, .tk-ysel-m, .tk-flt, .tk-narrow { display: none; }
.tk-ysel-m { position: relative; padding-right: .55rem; cursor: pointer; }
.tk-ysel-m select { appearance: none; -webkit-appearance: none; padding: 0 .85rem 0 0; border: 0; background: transparent; font: inherit; color: inherit; outline: none; cursor: pointer; }
.tk-ysel-m .tk-car { position: absolute; right: .6rem; font-size: .55rem; pointer-events: none; }
.tk-ysel-m:focus-within { box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .2); }
.tk-flt { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); width: 2.5rem; height: 2.5rem; place-items: center; border-radius: .8rem; color: var(--brand-700); }
.tk-flt:hover, .tk-flt[aria-expanded="true"] { background: var(--brand-50); }
.tk-flt.on::after { content: ''; position: absolute; top: .5rem; right: .5rem; width: .5rem; height: .5rem; border-radius: 50%; background: var(--s2); box-shadow: 0 0 0 2px #fff; }
/* มือถือ: แต่ละโรงเรียนเป็นการ์ด — ชื่อ → สรุป → สถานะรายระดับ (สองคอลัมน์) */
@media (max-width: 767px) {
  .tk-tbl thead { display: none; }
  .tk-tbl, .tk-tbl tbody { display: block; }
  .tk-tbl tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .55rem .8rem; padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
  .tk-tbl tbody tr.is-todo { box-shadow: inset 3px 0 0 var(--st-crit); }
  .tk-tbl tbody td { display: block; padding: 0; border: 0; }
  .tk-tbl td.tk-no { display: none; }
  .tk-tbl td.tk-sch, .tk-tbl td.tk-sum-c, .tk-tbl td[colspan] { grid-column: 1 / -1; }
  .tk-tbl td.tk-sch { order: -2; }
  .tk-tbl td.tk-sum-c { order: -1; }
  .tk-tbl td.tk-sum-c .tk-at { display: inline; margin-left: .45rem; }
  .tk-tbl td[data-l]::before { content: attr(data-l); display: block; margin-bottom: .25rem; font-size: .7rem; font-weight: 600; color: var(--ink-3); }
  .tk-tbl td[data-l] .badge { white-space: normal; }
}
.tk-help { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem 1.1rem; margin-top: 1rem; padding: 1rem 1.25rem; font-size: .86rem; line-height: 1.6; color: var(--ink-2); }
.tk-help b { color: var(--ink); }
.tk-help ol { margin-top: .3rem; padding-left: 1.15rem; list-style: decimal; display: grid; gap: .15rem; }
.tk-help > div { flex: 1 1 18rem; }
@media (max-width: 639px) { .tk-help > .kpi-ic { display: none; } .tk-help > .btn { width: 100%; } }
/* มือถือ: ประหยัดพื้นที่ที่สุด แต่ช่องค้นหาเด่น */
@media (max-width: 767px) {
  /* หัว: ชื่อเขตอยู่ในแถบบนแล้ว · ปีเป็นชิปเลือกได้ · ซ่อนเวลาข้อมูลและตัวเลขใหญ่ (ตัวเลขเดียวกันอยู่บนปุ่มกรอง) · แถบรายระดับสองคอลัมน์ */
  body[data-view="track"] #tb-right > a.btn { display: none; }   /* แถบบน: ไม่แสดงลิงก์ e-SAR และปุ่มเข้าสู่ระบบ (มีปุ่มเข้าสู่ระบบท้ายหน้า · เมนูผู้ใช้ยังแสดง) */
  body[data-view="track"] .sh-wrap { padding-top: .7rem; }
  body[data-view="track"] .sh-top { gap: 0; padding: .8rem 1rem .7rem; }
  body[data-view="track"] .sh-top h1 { font-size: 1.2rem; }
  body[data-view="track"] .sh-top .fh-meta { margin-top: .4rem; }
  .tk-area, .tk-ychip, .tk-asof, .tk-big, body[data-view="track"] .sh-ctl, .tk-lv-o, .tk-lv-w { display: none; }
  .tk-ysel-m { display: inline-flex; }
  .tk-sum { gap: 0; padding: .6rem 1rem .75rem; }
  .tk-lvs { grid-template-columns: 1fr 1fr; gap: 1rem; }
  .tk-lv-h { margin-bottom: .25rem; font-size: .72rem; }
  .tk-lv-h > b { font-size: .78rem; }
  .tk-lv-h span b { font-size: .9rem; }
  .tk-lv-bar { height: .45rem; }
  /* ค้นหา: ช่องใหญ่ ขอบสีหลัก มีเงา · อำเภอ/เครือข่ายพับไว้หลังปุ่มในช่องค้นหา */
  .tk-page { padding-top: .85rem; }
  .tk-find { gap: .5rem; padding: .8rem .8rem .6rem; }
  .tk-q .fld { height: 3.25rem; padding-left: 2.85rem; padding-right: 3.2rem; font-size: 1rem; border: 2px solid var(--brand-400); border-radius: 1rem; background: #fff;
    box-shadow: 0 10px 22px -14px rgba(31, 104, 194, .8); }
  .tk-q .fld::placeholder { color: #7d8da3; }
  .tk-q .fld:focus { border-color: var(--brand-600); box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .18); }
  .tk-q > i { left: 1.05rem; font-size: 1.1rem; color: var(--brand-600); }
  .tk-flt { display: grid; }
  .tk-find select.fld { display: none; height: 2.5rem; font-size: .84rem; border-radius: .75rem; }
  .tk-find.flt-open select.fld { display: block; }
  /* ปุ่มกรองสถานะ 4 ช่องเท่ากันเต็มความกว้าง เห็นครบไม่ต้องเลื่อน: ตัวเลขด้านบน ชื่อด้านล่าง */
  .tk-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .35rem; padding: 0 .8rem .65rem; }
  .tk-chips .fchip { width: 100%; height: auto; min-height: 2.85rem; flex-direction: column-reverse; justify-content: center; gap: 0; padding: .3rem .15rem; border-radius: .8rem;
    font-size: .66rem; line-height: 1.2; text-align: center; white-space: normal; }
  .tk-chips .fchip .n { min-width: 0; height: auto; padding: 0; background: none; font-size: 1rem; font-weight: 800; line-height: 1.15; color: var(--ink); }
  .tk-chips .fchip[aria-pressed="true"] .n { background: none; color: #fff; }
  .tk-res { padding: .4rem .8rem; font-size: .74rem; }
  /* การ์ดโรงเรียน: ส่งครบ = ชื่อ + ป้าย · ยังไม่ครบ = เพิ่มสถานะรายระดับ (ไม่แสดงวันที่) */
  .tk-tbl tbody tr { gap: .4rem .7rem; padding: .6rem .85rem; }
  .tk-tbl tbody tr.is-done td[data-l], .tk-tbl td.tk-sum-c, .tk-tbl td[data-l] .tk-at { display: none; }
  .tk-nm { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
  .tk-pm { display: inline-flex; flex-shrink: 0; padding: .15rem .55rem; font-size: .72rem; }
  .tk-sch small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .72rem; }
  /* สถานะรายระดับ: ชื่อระดับอยู่บรรทัดเดียวกับป้าย · ป้ายร่างแบบสั้น */
  .tk-tbl tbody td[data-l] { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
  .tk-tbl td[data-l]::before { margin: 0; font-size: .7rem; }
  .tk-dl { display: none; }
  .tk-res > span { flex: 1 1 auto; }
  .tk-res .btn { flex-shrink: 0; height: 1.85rem; padding: 0 .6rem; font-size: .74rem; }
  .tk-wide { display: none; }
  .tk-narrow { display: inline; }
  .tk-help { gap: .7rem; padding: .85rem 1rem; font-size: .8rem; }
}
/* แบบสังเคราะห์ SAR แบบเต็มจอ (admin_workbook_full.php): ไม่มีแถบบน — แถบแผ่นงานด้านบน ตารางสูงเต็มหน้าต่างและเลื่อนในตัว */
body[data-view="wbfull"] { height: 100vh; height: 100dvh; overflow: hidden; background: var(--surface); }
body[data-view="wbfull"] main, #v-wbfull { display: flex; flex-direction: column; min-height: 0; }
#v-wbfull { flex: 1; }
.wbf { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.wbf-bar { position: relative; z-index: 5; display: flex; align-items: center; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 1px 4px rgba(15, 23, 42, .06); }
.wbf-tabs { flex: 1; min-width: 0; }
.wbf-tabs .wb-tabs { border-bottom: 0; }
.wbf-tools { display: flex; align-items: center; gap: .3rem; flex-shrink: 0; padding: .3rem .75rem .3rem .5rem; }
.wbf-ctx { margin-right: .35rem; font-size: .76rem; color: var(--ink-3); white-space: nowrap; }
.wbf .wb-wrap { flex: 1; min-height: 0; max-height: none; }
@media (max-width: 1279px) {
  .wbf-bar { flex-wrap: wrap; }
  .wbf-tabs { flex-basis: 100%; }
  .wbf-tools { width: 100%; padding-top: .25rem; padding-bottom: .25rem; border-top: 1px solid var(--line); }
  .wbf-ctx { margin-right: auto; }
}
@media (max-width: 639px) { .wbf-tools .btn > span { display: none; } }

/* ---------- ภาพรวมสาธารณะ (overview.php): การ์ดหัว + แท็บ ---------- */
.pv-ctl { gap: .6rem; }
.pv-ctl-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; }
.pv-find { width: min(22rem, 100%); }
.pv-find .fld::-webkit-calendar-picker-indicator { display: none !important; }
@media (max-width: 767px) { .pv-ctl, .pv-ctl-row { width: 100%; justify-content: flex-start; } .pv-find { width: 100%; } }
.pv-tabs { display: flex; gap: .15rem; padding: 0 .75rem; border-top: 1px solid var(--line); background: #fff; overflow-x: auto; scrollbar-width: none; }
.pv-tabs::-webkit-scrollbar { display: none; }
.pv-tabs button { display: inline-flex; align-items: center; gap: .45rem; padding: .8rem .85rem .7rem; font-size: .88rem; font-weight: 600; color: var(--ink-3); border-bottom: 2.5px solid transparent; white-space: nowrap; transition: color .15s, border-color .15s; }
.pv-tabs button i { font-size: .82rem; }
.pv-tabs button:hover { color: var(--ink); }
.pv-tabs button[aria-selected="true"] { color: var(--brand-700); border-bottom-color: var(--brand-600); }
.pv-tabs button:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; border-radius: .4rem; }
.pv-tabs .n { min-width: 1.4rem; height: 1.25rem; padding: 0 .4rem; border-radius: 999px; font-size: .7rem; display: inline-grid; place-items: center; background: #eef1f6; color: var(--ink-2); }
.pv-tabs button[aria-selected="true"] .n { background: var(--brand-50); color: var(--brand-700); }
@media (min-width: 768px) { .pv-tabs { padding: 0 1.25rem; } }
/* ทางลัดไปหัวข้อ · ความคืบหน้ารายพื้นที่ · ชื่อโรงเรียนที่คลิกได้ */
.pv-jump { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.pv-jump a { display: inline-flex; align-items: center; height: 1.9rem; padding: 0 .75rem; border-radius: 999px; font-size: .78rem; font-weight: 600; color: var(--ink-2); background: #fff; border: 1px solid var(--line); transition: color .15s, border-color .15s; }
.pv-jump a:hover { color: var(--brand-700); border-color: var(--brand-300); }
.pv-prog { display: grid; gap: .25rem; min-width: 8rem; max-width: 14rem; font-size: .8rem; font-variant-numeric: tabular-nums; }
/* ผลรายเครือข่าย/อำเภอ (public.js areaCard) — แถวคลิกได้ · ป้ายเลขหน้าชื่อ · แถบการส่ง + ป้ายครบ/ขาด · แถบสั้นร้อยละ · จุดค่าเฉลี่ย 5 จุด · ป้าย YYY */
.ar-tbl td { padding-top: .6rem; padding-bottom: .6rem; }
.ar-tbl tr.ar-go { cursor: pointer; }
.ar-nm { display: flex; align-items: center; gap: .65rem; white-space: nowrap; }
.ar-badge { flex: none; width: 1.8rem; height: 1.8rem; display: grid; place-items: center; border-radius: .6rem; background: var(--brand-50); color: var(--brand-700); font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ar-nm button, .ar-nm > span { font-weight: 600; color: var(--ink); text-align: left; transition: color .12s; }
.ar-go:hover .ar-nm button, .ar-nm button:focus-visible { color: var(--brand-700); }
.ar-go:hover .ar-badge { background: var(--brand-100); }
.ar-tbl td.ar-sub { width: 40%; }
.ar-prog { display: grid; grid-template-columns: 3.6rem minmax(5rem, 1fr) 4.6rem; align-items: center; gap: .7rem; font-variant-numeric: tabular-nums; }
.ar-prog b { font-weight: 700; color: var(--ink); text-align: right; white-space: nowrap; }
.ar-prog b small { font-size: .78rem; font-weight: 500; color: var(--ink-4); }
.ar-prog .viz-meter { height: 6px; border-radius: 3px; background: #e6edf6; }
.ar-prog .viz-meter > div { border-radius: 3px; }
.ar-st { justify-self: start; display: inline-flex; align-items: center; gap: .3rem; height: 1.45rem; padding: 0 .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.ar-st.ok { background: #e8f6e8; color: #0b6e0b; }
.ar-st.ok i { color: var(--st-good); }
.ar-st.miss { background: #fff4dc; color: #8a5a00; }
.ar-st.miss i { color: #d99200; }
.ar-mv { display: inline-flex; align-items: center; justify-content: flex-end; gap: .6rem; }
.ar-mv b { min-width: 3.1rem; font-weight: 600; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.ar-mini { width: 3.4rem; height: 5px; border-radius: 3px; background: #e6edf6; overflow: hidden; }
.ar-mini i { display: block; height: 100%; border-radius: 3px; background: var(--s1); }
.ar-pips { display: inline-flex; gap: 3px; }
.ar-pips i { width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(90deg, var(--s1) var(--f), #dde5ef var(--f)); }
.ar-y { display: inline-flex; align-items: center; gap: .3rem; height: 1.5rem; padding: 0 .6rem; border-radius: 999px; background: #dcfce7; color: #15803d; font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ar-y i { font-size: .62rem; }
.ar-y.zero { background: #f1f5f9; color: var(--ink-4); }
.ar-na { color: var(--ink-4); }
.ar-chev { width: 2.25rem; padding-left: 0 !important; text-align: right; color: #c3ccd9; font-size: .75rem; }
.ar-go:hover .ar-chev { color: var(--brand-600); }
.ar-go .ar-chev i { transition: transform .15s; }
.ar-go:hover .ar-chev i { transform: translateX(2px); }
@media (max-width: 1023px) { .ar-mini, .ar-pips { display: none; } }   /* แท็บเล็ต: เหลือตัวเลข ตารางพอดีจอไม่ต้องเลื่อนด้านข้าง */
/* มือถือ: รายการแบบย่อแทนตาราง (public.js areaCard item) — ชื่อ · จำนวน · ป้าย · ลูกศร / แถบ / ตัวชี้วัดบรรทัดเดียว */
.ar-list { display: none; }
.ar-li { display: grid; gap: .45rem; padding: .75rem 1rem .8rem; border-top: 1px solid #eef1f5; }
.ar-li.ar-go { cursor: pointer; }
.ar-li.ar-go:active { background: #f4f8fd; }
.ar-li-h { display: flex; align-items: center; gap: .5rem; }
.ar-li-h .ar-nm { flex: 1; min-width: 0; }
.ar-li-h .ar-nm button, .ar-li-h .ar-nm > span { overflow: hidden; text-overflow: ellipsis; }
.ar-li-n { font-weight: 700; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ar-li-n small { font-size: .76rem; font-weight: 500; color: var(--ink-4); }
.ar-li-chev { margin-left: .1rem; font-size: .72rem; color: #c3ccd9; }
.ar-li .viz-meter { height: 6px; border-radius: 3px; background: #e6edf6; }
.ar-li .viz-meter > div { border-radius: 3px; }
.ar-li-m { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; font-size: .76rem; color: var(--ink-3); }
.ar-li-m b { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.ar-li-m .ar-y { height: 1.35rem; padding: 0 .5rem; font-size: .72rem; }
@media (max-width: 767px) {   /* มือถือและแท็บเล็ตแนวตั้งเล็ก: ตารางไม่พอดีจอ */
  .ar-wide { display: none; }
  .ar-list { display: block; }
}
.pv-school { font-weight: 600; color: var(--ink); text-align: left; }
.pv-school:hover { color: var(--brand-700); text-decoration: underline; }
/* หน้าต่างข้อมูลรายโรงเรียน */
.ps-box { display: flex; flex-direction: column; width: min(1040px, 100%); max-height: min(92vh, 100%); background: var(--bg); border-radius: 1rem; overflow: hidden; box-shadow: 0 24px 60px rgba(15, 23, 42, .35); outline: none; }
.ps-load { padding: 3rem 1.5rem; text-align: center; color: var(--ink-3); background: #fff; }
.ps-head { display: flex; align-items: flex-start; gap: .85rem; padding: 1rem 1rem .85rem 1.25rem; background: linear-gradient(135deg, #eef5ff 0%, #f8fbff 45%, #fff 75%); border-bottom: 1px solid var(--line); }
.ps-title { font-size: 1.25rem; font-weight: 700; line-height: 1.3; color: var(--ink); }
.ps-head .sp-contact { margin-top: .4rem; }
.ps-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; padding: .6rem 1.25rem; background: #fff; border-bottom: 1px solid var(--line); }
.ps-years { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font-size: .78rem; color: var(--ink-3); }
.ps-years .fchip { height: 1.85rem; }
.ps-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 1rem 1.25rem 1.25rem; display: grid; gap: 1rem; align-content: start; }
.ps-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; padding: .7rem 1.25rem; border-top: 1px solid var(--line); background: #fff; }
.ps-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .75rem; }
.ps-tile { display: grid; gap: .3rem; align-content: start; padding: .75rem .9rem; border-radius: .85rem; background: #fff; border: 1px solid var(--line); }
.ps-tile .l { font-size: .74rem; font-weight: 600; color: var(--ink-3); }
.ps-tile .v { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; font-size: 1.1rem; font-weight: 700; color: var(--ink); }
.ps-tile .v small { font-weight: 500; color: var(--ink-3); }
.ps-tile > small { font-size: .72rem; color: var(--ink-3); line-height: 1.45; }
.ps-tile > small.ok { color: #047857; }
.ps-tile > small.warn { color: #b45309; }
.ps-ytbl th.cur, .ps-ytbl td.cur { background: var(--brand-50); }
@media (max-width: 640px) {
  .ps-box { width: 100%; height: 100%; max-height: none; border-radius: 0; }
  .ps-head, .ps-bar, .ps-body, .ps-foot { padding-left: 1rem; padding-right: 1rem; }
}

/* ---------- เลย์เอาต์ผู้ดูแลระบบ ---------- */
.adm-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
.adm-side { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; background: #fff; border-right: 1px solid var(--line); padding: 1rem .8rem 1.25rem; display: flex; flex-direction: column; gap: .75rem; }
.side-ctl { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 .25rem; }
/* ปีที่ดูข้อมูล บนสุดของเมนูด้านซ้าย — เต็มความกว้างเมนู */
.side-year { padding: 0 .25rem; }
.side-year .ctl-year { display: flex; width: 100%; height: 2.4rem; }
.side-year .ctl-year select { width: 100%; font-size: .88rem; font-weight: 700; color: var(--brand-800); }
.side-year .ctl-year.other select { color: #78350f; }
.side-year .ctl-year > i { color: var(--brand-600); }
.side-year .ctl-year.other > i { color: #92400e; }
.tb-ctl { align-items: center; gap: .4rem; margin-right: .25rem; }
.ctl-year { position: relative; display: inline-flex; align-items: center; height: 2.1rem; border: 1px solid var(--line-2); border-radius: 999px; background: #fff; color: var(--ink-2); font-size: .82rem; font-weight: 600; }
.ctl-year:focus-within { border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-100); }
.ctl-year.other { background: #fef3c7; border-color: #fcd34d; color: #78350f; }
.ctl-year > i { position: absolute; left: .75rem; font-size: .8rem; color: var(--ink-3); pointer-events: none; }
.ctl-year select { appearance: none; -webkit-appearance: none; height: 100%; padding: 0 1.8rem 0 2rem; border: 0; background: transparent; font: inherit; color: inherit; outline: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; }
.ctl-open { display: inline-flex; align-items: center; gap: .4rem; height: 2.1rem; padding: 0 .8rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; border: 1px solid; transition: background .15s, border-color .15s; }
.ctl-open[aria-checked="true"] { background: #ecfdf3; border-color: #a7e3bd; color: #08660f; }
.ctl-open[aria-checked="true"]:hover { background: #d9f7e5; }
.ctl-open[aria-checked="false"] { background: #fff1f2; border-color: #fecdd3; color: #b42323; }
.ctl-open[aria-checked="false"]:hover { background: #ffe4e6; }
.ctl-open i { font-size: .75rem; }
/* สวิตช์ในปุ่มรับรายงาน (รูปแบบเดียวกับ .switch.sm) — สถานะอยู่ที่ปุ่ม role="switch" aria-checked */
.ctl-open .sw { position: relative; width: 2.1rem; height: 1.2rem; flex-shrink: 0; border-radius: 999px; background: #cbd5e1; transition: background .2s; }
.ctl-open .sw::after { content: ''; position: absolute; top: .175rem; left: .175rem; width: .85rem; height: .85rem; border-radius: 999px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .2s; }
.ctl-open[aria-checked="true"] .sw { background: #16a34a; }
.ctl-open[aria-checked="true"] .sw::after { transform: translateX(.9rem); }
.ctl-open[aria-checked="false"] .sw { background: #fca5a5; }
.side-group { display: grid; gap: .1rem; }
.side-group > span { font-size: .7rem; font-weight: 700; color: var(--ink-4); padding: .1rem .65rem; letter-spacing: .02em; }
.side-sep { margin: .25rem .65rem; border: 0; border-top: 1px solid var(--line); }   /* เส้นคั่นภายในกลุ่มเมนู */
.side-link { display: flex; align-items: center; gap: .7rem; height: 2.3rem; padding: 0 .65rem; border-radius: .7rem; font-size: .88rem; font-weight: 500; color: var(--ink-2); text-align: left; width: 100%; position: relative; transition: background .12s, color .12s; }
.side-link i.ic { width: 1.1rem; text-align: center; color: var(--ink-4); transition: color .12s; }
.side-link:hover { background: #f3f5fa; color: var(--ink); }
.side-link[aria-current="page"] { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.side-link[aria-current="page"] i.ic { color: var(--brand-600); }
@media (min-width: 1024px) {
  .adm-side { gap: .45rem; }
  .side-link { height: 2rem; }
  .side-group > span { padding-top: .25rem; }
  .side-link[aria-current="page"]::before { top: .3rem; bottom: .3rem; }
}
.side-link[aria-current="page"]::before { content: ''; position: absolute; left: -.8rem; top: .4rem; bottom: .4rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-600); }
.side-link .cnt { margin-left: auto; min-width: 1.5rem; height: 1.3rem; padding: 0 .4rem; border-radius: 999px; font-size: .7rem; font-weight: 700; display: inline-grid; place-items: center; background: #eef1f6; color: var(--ink-2); }
.side-link .cnt.warn { background: #fef3c7; color: #92400e; }
.side-link .cnt.crit { background: #ffe4e6; color: #be123c; }
.adm-main { min-width: 0; }
@media (min-width: 1024px) { #nav-btn { display: none !important; } }
.adm-overlay { display: none; }
@media (max-width: 1023px) {
  .adm-shell { grid-template-columns: minmax(0, 1fr); }
  .adm-side { position: fixed; z-index: 60; top: var(--topbar-h); left: 0; width: 284px; transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .adm-side { transform: none; }
  body.nav-open .adm-overlay { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 55; background: rgba(15, 23, 42, .35); }
}

/* ---------- แบบรายงาน ---------- */
.stepper { display: grid; gap: .2rem; }
.step { display: flex; align-items: center; gap: .7rem; padding: .55rem .6rem; border-radius: .7rem; font-size: .84rem; color: var(--ink-2); transition: background .12s; }
.step:hover { background: #f5f7fb; }
.step .sd { width: 1.75rem; height: 1.75rem; border-radius: 999px; display: grid; place-items: center; font-size: .75rem; font-weight: 700; border: 2px solid var(--line-2); color: var(--ink-3); background: #fff; flex-shrink: 0; }
.step.done .sd { background: #15803d; border-color: #15803d; color: #fff; }
.step.part .sd { border-color: #f59e0b; color: #b45309; }
.step .sv { margin-left: auto; font-size: .74rem; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.step.done .sv { color: #166534; }
/* สีสถานะการดำเนินงานรายปี (หน้าสถานศึกษา) — แดง/ส้ม/เขียว/เทา (รอขั้นตอนก่อนหน้า) คู่ไอคอนและข้อความเสมอ */
.ys-crit { --ys: #d03b3b; --ys-bg: #fff1f2; --ys-ink: #9f1239; --ys-line: #fecdd3; }
.ys-warn { --ys: #ea7a0c; --ys-bg: #fff4e6; --ys-ink: #9a3412; --ys-line: #fed7aa; }
.ys-good { --ys: #15803d; --ys-bg: #ecfdf3; --ys-ink: #166534; --ys-line: #bbf7d0; }
.ys-lock { --ys: #94a3b8; --ys-bg: #f8fafc; --ys-ink: #64748b; --ys-line: #e2e8f0; }
/* การ์ดหัวหน้าสถานศึกษา (ข้อมูลโรงเรียน ผู้ประสานงาน เลือกปี) */
.sh-card { overflow: hidden; }
.sh-top { display: flex; flex-direction: column; gap: 1.1rem; padding: 1.25rem; background: linear-gradient(135deg, #eef5ff 0%, #f8fbff 45%, #fff 75%); }
.sh-ctl { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.sh-top > .kpi-ic { background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 14px rgba(31, 104, 194, .14); }
@media (max-width: 767px) { .sh-top > .kpi-ic { display: none; } }
.sh-past { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding: .6rem 1.25rem; font-size: .84rem; background: var(--brand-50); color: var(--brand-900); border-top: 1px solid var(--brand-100); }
.sh-past > i { color: var(--brand-600); }
@media (min-width: 768px) {
  .sh-top { flex-direction: row; align-items: center; gap: 1.25rem; padding: 1.5rem; }
  .sh-ctl { align-items: flex-end; }
  .sh-past { padding-left: 1.5rem; padding-right: 1.5rem; }
}
.ys-sum { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; font-size: .74rem; }
.ys-sum-l { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; color: var(--ys-ink); }
.ys-sum-l i { color: var(--ys); }
.ys-track { display: inline-flex; gap: 3px; }
.ys-track i { width: 1.4rem; height: 6px; border-radius: 3px; background: var(--ys); }
.ys-sum b { font-size: .88rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.ys-sum b small { margin-left: .05rem; font-size: .74rem; font-weight: 600; color: var(--ink-3); }
/* ---------- ขั้นตอนการดำเนินงานของปี (หน้าหลักสถานศึกษา): การ์ดเดียว รายการเดียวเรียงตามลำดับ ----------
   หัวการ์ด = ชื่อ + ภาพรวม (.ys-sum) · แต่ละขั้น = วงกลมเลขขั้นตอนบนเส้นเชื่อม + ชื่อ/ป้ายสถานะ/รายละเอียด + ปุ่มชิดขวา · สีตาม .ys-* */
.fl { margin-top: 1.25rem; overflow: hidden; }
.fl-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1.25rem; padding: .6rem 1.25rem; border-bottom: 1px solid var(--line); }
.fl-ttl { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.fl-ttl > i { width: 2rem; height: 2rem; flex-shrink: 0; display: grid; place-items: center; border-radius: .65rem; font-size: .9rem; background: var(--brand-50); color: var(--brand-600); }
.fl-ttl h2 { font-size: 1rem; font-weight: 700; line-height: 1.3; color: var(--ink); }
.fl-ttl h2 small { margin-left: .3rem; font-size: .8rem; font-weight: 500; color: var(--ink-3); white-space: nowrap; }
.fl-ttl p { font-size: .74rem; line-height: 1.35; color: var(--ink-3); }
.fl .ys-sum { padding: .25rem .75rem; border-radius: 999px; background: var(--ys-bg); border: 1px solid var(--ys-line); }
.fl-list { list-style: none; margin: 0; padding: 0; }
.fl-step { --fl-bg: #fff; position: relative; display: grid; grid-template-columns: 1.8rem minmax(0, 1fr); column-gap: .8rem; padding: 0 1.25rem; background: var(--fl-bg); }
.fl-step.is-now { --fl-bg: color-mix(in srgb, var(--ys-bg) 70%, #fff); box-shadow: inset 3px 0 0 var(--ys); }
/* เส้นเชื่อมระหว่างวงกลม (ขั้นแรกเริ่มที่วงกลม ขั้นสุดท้ายจบที่วงกลม) */
.fl-rail { position: relative; display: flex; justify-content: center; padding-top: .6rem; }
.fl-rail::before { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: var(--line-2); }
.fl-step:first-child .fl-rail::before { top: 1.5rem; }
.fl-step:last-child .fl-rail::before { bottom: auto; height: 1.5rem; }
.fl-step:only-child .fl-rail::before { display: none; }
.fl-no { position: relative; z-index: 1; width: 1.8rem; height: 1.8rem; display: grid; place-items: center; border-radius: 999px; font-size: .85rem; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums; color: #fff; background: var(--ys); box-shadow: 0 0 0 3px var(--fl-bg); }
.fl-step.ys-lock .fl-no { color: var(--ys-ink); background: #fff; border: 2px solid var(--line-2); }
.fl-main { min-width: 0; padding: .6rem 0 .65rem; }
.fl-step + .fl-step .fl-main { border-top: 1px solid var(--line); }
.fl-step.is-now .fl-main, .fl-step.is-now + .fl-step .fl-main { border-top-color: transparent; }
.fl-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.25rem; }
.fl-tx { flex: 1 1 20rem; min-width: 0; }
.fl-title { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .6rem; min-height: 1.8rem; font-size: .98rem; font-weight: 700; line-height: 1.35; color: var(--ink); }
.fl-name { display: inline-flex; align-items: baseline; gap: .55rem; min-width: 0; }
.fl-name > i { width: 1.15rem; flex-shrink: 0; text-align: center; font-size: .95rem; color: var(--ys); }
.fl-step.ys-lock .fl-title { color: var(--ink-3); }
.fl-meta { min-width: 0; max-width: 100%; font-size: .75rem; font-weight: 400; color: var(--ink-3); }
.fl-meta i { font-size: .68rem; }
.fl-file { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.fl-desc { font-size: .78rem; line-height: 1.45; color: var(--ink-3); }
.fl-step.ys-lock .fl-desc { color: var(--ink-4); }
.fl-acts { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; margin-left: auto; }
/* สังเคราะห์ IQA ที่มีรายงานแล้ว: ความครบถ้วน + รายการตรวจ (ซ้าย) · ค่าสำคัญ 3 ช่อง (ขวา) */
.fl-body { display: grid; gap: .7rem 1.5rem; margin-top: .55rem; padding: .7rem 1rem; border-radius: .9rem; background: #fbfcfe; border: 1px solid var(--line); }
.fl-alert { margin-top: .75rem; }
/* ข้อมูลตั้งต้นที่ต้องกรอกก่อนขั้นตอนที่ 1 (prereqList ใน core.js): 2 รายการเคียงกันบนจอกว้าง — ไอคอนสถานะ · ชื่อหน้า + สิ่งที่ยังขาด · ปุ่มไปกรอก */
.fl-body.fl-pre { list-style: none; margin: .5rem 0 0; padding: .5rem .8rem; align-items: stretch; }
@media (min-width: 1100px) { .fl-body.fl-pre { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fl-pre > li { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.fl-pre > li > i { flex-shrink: 0; font-size: 1.05rem; }
.fl-pre > li.ok > i { color: #059669; }
.fl-pre > li.no > i { color: #dc2626; }
.fl-pre-t { flex: 1 1 0; min-width: 0; font-size: .78rem; line-height: 1.4; color: var(--ink-3); }
.fl-pre-t b { display: block; font-size: .85rem; color: var(--ink); }
.fl-pre > li.no .fl-pre-t span { color: #b91c1c; }
.fl-pre .btn { flex-shrink: 0; }
.sd-pre { max-width: 52rem; margin: 1rem auto 0; padding: 1.25rem 1.5rem; }
.sd-pre h1 { font-size: 1.1rem; font-weight: 700; color: var(--ink); }
.sd-pre h1 i { margin-right: .35rem; color: var(--ink-4); }
.sd-pre > p { margin-top: .25rem; font-size: .85rem; color: var(--ink-3); }
@media (min-width: 1100px) { .fl-body { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: center; } }
@media (min-width: 768px) { .fl-head { padding: .65rem 1.5rem; } .fl-step { padding: 0 1.5rem; } }
@media (max-width: 640px) {
  .fl-step { grid-template-columns: 1.6rem minmax(0, 1fr); column-gap: .65rem; padding: 0 1rem; }
  .fl-no { width: 1.6rem; height: 1.6rem; font-size: .8rem; }
  .fl-step:first-child .fl-rail::before { top: 1.4rem; }
  .fl-step:last-child .fl-rail::before { height: 1.4rem; }
  .fl-title { min-height: 1.6rem; font-size: .95rem; }
  .fl-acts { width: 100%; justify-content: flex-start; margin-left: 0; }
}
/* เนื้อหาของขั้นตอนสังเคราะห์ IQA (ความครบถ้วน · ค่าสำคัญ) */
.lv-body { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 1.1rem; }
.lv-ring { display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.lv-ring .viz-ring .c { font-size: .85rem; }
.lv-ring small { font-size: .64rem; color: var(--ink-4); }
.lv-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .2rem 1.25rem; }
.lv-step { display: flex; align-items: center; gap: .45rem; min-width: 0; padding: .14rem 0; font-size: .76rem; color: var(--ink-3); }
.lv-step .lv-ck { width: .95rem; height: .95rem; flex-shrink: 0; display: grid; place-items: center; border-radius: 999px; font-size: .46rem; border: 1.5px solid var(--line-2); background: #fff; }
.lv-step.done .lv-ck { background: #dcfce7; border-color: #86efac; color: #15803d; }
.lv-step.part .lv-ck { border-color: #fcd34d; background: #fffbeb; }
.lv-step .v { margin-left: auto; font-size: .7rem; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.lv-step.part .v { color: #b45309; }
.lv-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
/* ค่าสำคัญแบบเด่น — --k = สีหลักของช่อง (ระดับคุณภาพ/โทนกลุ่ม/ผลเทียบเกณฑ์) */
.lv-kpi { --k: var(--brand-600); --kbg: color-mix(in srgb, var(--k) 8%, #fff); --kln: color-mix(in srgb, var(--k) 28%, #fff);
  display: flex; flex-direction: column; gap: .4rem; min-width: 0; padding: .6rem .75rem .7rem; border-radius: .85rem;
  background: linear-gradient(160deg, var(--kbg), #fff 75%); border: 1px solid var(--kln); box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.lv-kpi.is-empty { --k: #94a3b8; }
.lv-kpi.tone-good { --k: #15803d; }
.lv-kpi.tone-mid { --k: var(--brand-600); }
.lv-kpi.tone-warn { --k: #d97706; }
.lv-kpi.tone-bad { --k: #dc2626; }
.lv-kpi .kh { display: flex; align-items: center; gap: .4rem; min-width: 0; font-size: .72rem; font-weight: 600; color: var(--ink-2); }
.lv-kpi .kt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-kpi .kic { width: 1.45rem; height: 1.45rem; flex-shrink: 0; display: grid; place-items: center; border-radius: .45rem; font-size: .68rem; color: #fff; background: var(--k); }
.lv-kpi .kv { display: flex; align-items: baseline; gap: .4rem; line-height: 1; }
.lv-kpi .kv b { font-size: 1.7rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.lv-kpi .kv span { font-size: .85rem; font-weight: 700; color: var(--ink-2); }
.lv-kpi .kv small { margin-left: auto; font-size: .68rem; color: var(--ink-3); white-space: nowrap; }
.lv-kpi.tone-good .kv small, .lv-kpi.tone-warn .kv small { font-weight: 700; color: var(--k); }
.lv-kpi.is-empty .kv span { font-size: .85rem; font-weight: 500; color: var(--ink-4); }
.lv-kpi .kscale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; margin-top: auto; }
.lv-kpi .kscale i { height: 5px; border-radius: 3px; background: #e6ebf2; }
.lv-kpi .kscale i.on { background: var(--k); }
.lv-kpi .kcodes { display: flex; justify-content: space-between; gap: .3rem; }
.lv-kpi .kcodes > span { display: flex; flex-direction: column; align-items: center; gap: .15rem; min-width: 0; flex: 1; }
.lv-kpi .kcodes small { font-size: .58rem; line-height: 1.1; text-align: center; color: var(--ink-3); }
.lv-kpi .kcodes .code-box { width: 100%; max-width: 2.5rem; height: 2.05rem; font-size: 1.05rem; border-radius: .55rem; }
.lv-kpi .kcodes .code-box.Q { background: #fff; }
.lv-kpi .kstd { width: 100%; max-width: 2.5rem; height: 2.05rem; display: grid; place-items: center; border-radius: .55rem; font-size: 1.02rem; font-weight: 800; color: #fff; background: var(--k); }
.lv-kpi .kstd.lt { color: #0b2e5c; }
.lv-kpi .kbar { position: relative; height: 6px; margin-top: auto; border-radius: 999px; background: #e6ebf2; }
.lv-kpi .kbar > i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--k); }
.lv-kpi .kbar > em { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink-2); }
.st-tip { text-decoration: underline dotted var(--ink-4); text-underline-offset: 3px; cursor: help; }
@media (max-width: 520px) {
  .lv-body { grid-template-columns: 1fr; justify-items: center; gap: .6rem; }
  .lv-steps { grid-template-columns: 1fr; }
  .lv-steps { width: 100%; column-gap: .9rem; }
  .lv-tiles { grid-template-columns: 1fr; }
}

/* สรุปข้อมูลจากรายงาน SAR (หน้าสถานศึกษา) */
.sum-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
@media (min-width: 768px) { .sum-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .sum-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.sum-stat { display: flex; align-items: center; gap: .7rem; min-width: 0; padding: .7rem .8rem; border-radius: .8rem; background: #f8fafc; border: 1px solid var(--line); }
.sum-stat .ic { width: 2.2rem; height: 2.2rem; flex-shrink: 0; display: grid; place-items: center; border-radius: .6rem; background: var(--brand-50); color: var(--brand-600); }
.sum-stat .l { font-size: .72rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum-stat .v { font-size: 1.2rem; font-weight: 700; color: var(--ink); line-height: 1.25; font-variant-numeric: tabular-nums; }
.sum-stat .v small { margin-left: .25rem; font-size: .72rem; font-weight: 500; color: var(--ink-3); }
.sum-stat .v.txt { font-size: .9rem; }
.sum-sub { margin-bottom: .2rem; font-size: .74rem; font-weight: 700; color: var(--brand-700); }
.sum-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .42rem 0; border-bottom: 1px dashed var(--line); font-size: .83rem; }
.sum-row:last-child { border-bottom: 0; }
.sum-row .t { min-width: 0; color: var(--ink-2); }
.sum-row .v { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .4rem; text-align: right; font-weight: 600; color: var(--ink); }
.sum-std { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.sum-std:first-child { padding-top: 0; }
.sum-std:last-child { border-bottom: 0; padding-bottom: 0; }
.sum-std .hd { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem .75rem; margin-bottom: .4rem; font-size: .84rem; }
.sum-std .hd > b { font-weight: 600; }
.sum-std .hd > span { font-size: .76rem; color: var(--ink-3); white-space: nowrap; }
.sum-std .hd > span b { color: var(--ink); }
.sum-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .45rem; }
.sum-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: .14rem .5rem; border-radius: 999px; font-size: .7rem; background: #fff; color: var(--ink-2); border: 1px solid var(--line); }
.sum-chip.more { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); font-weight: 600; }
.sum-sw { list-style: none !important; padding-left: 0 !important; gap: .7rem !important; }
.sum-sw b { font-size: .76rem; color: var(--ink); }
.sum-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.sum-clamp.open { display: block; -webkit-line-clamp: unset; }
.lvl-chip.l0 { background: #f1f4f9; color: var(--ink-4); }

/* แถบข้างแบบรายงาน (กะทัดรัด) */
.stepper.compact { gap: 0; margin: .55rem -.35rem 0; }
.stepper.compact .step { gap: .55rem; padding: .32rem .45rem; font-size: .8rem; }
.stepper.compact .step .sd { width: 1.3rem; height: 1.3rem; font-size: .66rem; border-width: 1.5px; }
.stepper.compact .step .sv { font-size: .7rem; }
.sb-prog { padding: .9rem 1rem; }
.sb-ring .viz-ring .c { font-size: .72rem; }
.sb-actions { margin-top: .7rem; padding-top: .75rem; border-top: 1px solid var(--line); display: grid; gap: .45rem; }
.sb-btns { display: flex; gap: .5rem; }
.sb-btns > .btn { flex: 1; min-width: 0; }
.sb-eff { padding: .9rem 1rem; }
.sb-eff .eff-vis { white-space: nowrap; font-size: .64rem; gap: .3rem; }
.sb-ipo { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; }
.sb-ipo > div { text-align: center; }
.sb-ipo .code-box { width: 100%; height: 2.15rem; font-size: 1.05rem; border-radius: .55rem; }
.sb-ipo small { display: block; margin-top: .25rem; font-size: .66rem; color: #cbd5e1; }
.sb-group { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: .65rem; font-size: .72rem; line-height: 1.5; color: #cbd5e1; }
.sb-group:hover { color: #fff; }
.sec-head { display: flex; align-items: center; gap: .8rem; padding: 1.05rem 1.25rem; border-bottom: 1px solid var(--line); }
.sec-head .n { width: 2.2rem; height: 2.2rem; border-radius: .7rem; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--brand-600); flex-shrink: 0; }
.sec-head h2 { font-size: 1.02rem; font-weight: 700; line-height: 1.35; }
.sec-head .st { margin-left: auto; }
.issue { border: 1px solid var(--line); border-left: 4px solid var(--line-2); border-radius: .9rem; background: #fff; transition: border-color .2s; }
.issue.full { border-left-color: #16a34a; }
.issue.part { border-left-color: #f59e0b; }
.eff-card { background: radial-gradient(120% 120% at 0% 0%, var(--brand-800) 0%, var(--brand-950) 65%); color: #fff; border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-lg); }

/* ---------- กราฟ (ทั่วไป) ---------- */
.viz-card { background: var(--viz-surface); }
.viz-legend { display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: .76rem; color: var(--viz-ink-2); margin-bottom: .8rem; }
.viz-legend span { display: inline-flex; align-items: center; }
.viz-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.viz-legend .ln { display: inline-block; width: 16px; height: 2px; margin-right: 6px; border-radius: 1px; }
.viz-empty { flex: 1; height: 22px; border: 1px dashed var(--viz-axis); border-radius: 4px; font-size: 11px; color: var(--viz-muted); display: flex; align-items: center; justify-content: center; }
.viz-empty.big { height: 160px; font-size: .85rem; }
.viz-none { font-size: .84rem; color: var(--viz-muted); }
.viz-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.viz-table th, .viz-table td { border-bottom: 1px solid #eef0f4; padding: .45rem .6rem; text-align: right; font-variant-numeric: tabular-nums; }
.viz-table th:first-child, .viz-table td:first-child { text-align: left; }
.viz-table thead th { color: var(--viz-ink-2); font-weight: 600; background: #f8fafc; position: sticky; top: 0; }
.table-view { max-height: 26rem; overflow: auto; }

/* tooltip: ค่านำ ป้ายตาม */
.viz-tip { position: fixed; z-index: 90; pointer-events: none; background: #fff; border: 1px solid rgba(15, 23, 42, .1); box-shadow: 0 10px 28px rgba(15, 23, 42, .16); border-radius: 10px; padding: .45rem .7rem; font-size: 12px; color: var(--viz-ink-2);
  opacity: 0; transform: translate(-50%, -100%); transition: opacity .12s; max-width: 300px; line-height: 1.45; }
.viz-tip.on { opacity: 1; }
.viz-tip > strong { display: block; color: var(--viz-ink); font-size: 13px; }
.viz-tip .tt { display: block; font-size: 11.5px; color: var(--viz-muted); margin-bottom: .2rem; font-weight: 600; }
.viz-tip .tr { display: flex; align-items: center; gap: .45rem; }
.viz-tip .tr strong { color: var(--viz-ink); font-size: 13px; }
.viz-tip .key { width: 12px; height: 2px; border-radius: 1px; flex-shrink: 0; }

/* แถบซ้อน 100% */
.viz-stack-row { display: grid; grid-template-columns: min(var(--lw, 8rem), 42%) minmax(0, 1fr); gap: .75rem; align-items: center; padding: .3rem 0; }
.viz-stack-row .lbl { font-size: .8rem; color: var(--viz-ink); line-height: 1.25; }
.viz-stack-row .lbl small { display: block; font-size: 11px; color: var(--viz-muted); }
.viz-stack { display: flex; gap: 2px; height: 22px; }
.viz-stack .sgm { height: 100%; min-width: 2px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; cursor: default; transition: filter .15s; }
.viz-stack .sgm:last-child { border-radius: 0 4px 4px 0; }
.viz-stack .sgm:hover, .viz-stack .sgm:focus-visible { filter: brightness(1.12); }
/* แถบซ้อนแบบละเอียด — ชื่อ/คำอธิบายเหนือแถบ ค่าสรุปชิดขวา */
.viz-stack-item { padding: .7rem 0 .75rem; border-top: 1px solid var(--viz-grid); }
.viz-stack-wrap.detail .items > .viz-stack-item:first-child { border-top: 0; padding-top: .2rem; }
@media (min-width: 1024px) {
  .viz-stack-wrap.detail.two .items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2.5rem; }
  .viz-stack-wrap.detail.two .items > .viz-stack-item:nth-child(2) { border-top: 0; padding-top: .2rem; }
}
.viz-stack-item .hd { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .35rem 1rem; margin-bottom: .45rem; }
.viz-stack-item .lbl { min-width: 0; font-size: .86rem; font-weight: 600; color: var(--viz-ink); line-height: 1.3; }
.viz-stack-item .lbl small { display: block; font-size: .74rem; font-weight: 400; color: var(--viz-muted); }
.viz-stack-item.strong .lbl { font-weight: 700; }
.viz-stack-item .aside { display: flex; gap: 1.1rem; flex-shrink: 0; }
.viz-stack-item .st { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.viz-stack-item .st b { font-size: 1.05rem; color: var(--viz-ink); font-variant-numeric: tabular-nums; }
.viz-stack-item .st span { font-size: .68rem; color: var(--viz-muted); }
.viz-stack-item .viz-stack { height: 24px; }
.viz-stack .sgm .pc { margin-left: .35rem; font-weight: 500; font-size: 10.5px; opacity: .85; }

/* คอลัมน์ */
.viz-cols { --h: 168px; }
.viz-col-bars { display: flex; align-items: flex-end; gap: 8px; height: var(--h); padding: 0 4px; border-bottom: 1px solid var(--viz-axis); }
.viz-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.viz-col .cap { font-size: 12px; font-weight: 600; color: var(--viz-ink); margin-bottom: 4px; }
.viz-col .bar { width: 100%; max-width: 24px; background: var(--s1); border-radius: 4px 4px 0 0; transition: filter .15s; }
.viz-col.dim .bar { background: var(--viz-axis); }
.viz-col.dim .cap { color: var(--viz-muted); font-weight: 500; }
.viz-col .bar:hover, .viz-col .bar:focus-visible { filter: brightness(1.1); }
.viz-col-labels { display: flex; gap: 8px; padding: 6px 4px 0; }
.viz-col-labels span { flex: 1; text-align: center; font-size: 11px; font-weight: 600; color: var(--viz-ink-2); letter-spacing: .06em; min-width: 0; }
.viz-col-labels span.hi { color: var(--viz-ink); font-weight: 700; }
/* คอลัมน์ซ้อนค่าจริง (VIZ.stackCols) — ชิ้นห่างกัน 2px ปลายบนมน */
.viz-scols > .viz-legend { margin-bottom: .6rem; }
.viz-scol .stk { display: flex; flex-direction: column; gap: 2px; width: 100%; max-width: 44px; }
.viz-scol .sgm { display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; outline: none; transition: filter .15s; }
.viz-scol .stk > .sgm:first-child { border-radius: 4px 4px 0 0; }
.viz-scol .sgm:hover, .viz-scol .sgm:focus-visible { filter: brightness(1.08); }
.viz-scols .viz-col-labels span, .es-cols .viz-col-labels span { letter-spacing: 0; }
/* e-SAR สพฐ. (admin_esar.php) — วงผลการประเมินตนเองรายระดับ */
.es-hl { color: var(--brand-600); }
.es-year { display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--ink-3); }
.es-year select { padding: .25rem 1.6rem .25rem .55rem; border: 1px solid var(--line); border-radius: .5rem; background-color: var(--surface); font-size: .82rem; color: var(--ink); }
.es-lvs { display: grid; gap: 1.25rem 1.5rem; margin-top: .75rem; }
@media (min-width: 1024px) { .es-lvs { grid-template-columns: 1fr 1fr; } .es-lv + .es-lv { padding-left: 1.5rem; border-left: 1px solid var(--line); } }
.es-lv h4 { margin-bottom: .55rem; font-size: .9rem; font-weight: 700; color: var(--brand-700); }
.es-lv h4 small { margin-left: .35rem; font-size: .72rem; font-weight: 500; color: var(--ink-3); }
.es-rings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; }
@media (max-width: 479px) { .es-rings { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.es-ring { display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: .7rem .3rem .6rem; border-radius: .9rem; cursor: help; outline: none; transition: background .15s; }
.es-ring:first-child { background: var(--viz-zero); }
.es-ring:hover, .es-ring:focus-visible { background: var(--brand-50); }
.es-ring .fig { position: relative; width: 100%; max-width: 112px; }
.es-ring .fig svg { display: block; width: 100%; height: auto; }
.es-ring .c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.25; text-align: center; }
.es-ring .c b { font-size: .84rem; font-weight: 700; color: var(--ink); }
.es-ring .c small { font-size: .7rem; color: var(--ink-3); }
.es-ring .l { font-size: .78rem; font-weight: 600; color: var(--ink-2); text-align: center; }

/* แถบแนวนอน */
.viz-bars { display: grid; gap: .55rem; }
.viz-bar-row { display: grid; grid-template-columns: minmax(0, 1fr) 4.4rem; column-gap: .75rem; row-gap: 3px; align-items: end; }
.viz-bar-row .txt { font-size: .8rem; color: var(--viz-ink); line-height: 1.4; }
.viz-bar-row .txt .no { color: var(--viz-muted); margin-right: .3rem; }
.viz-bar-row .val { font-size: .82rem; font-weight: 600; color: var(--viz-ink); text-align: right; font-variant-numeric: tabular-nums; line-height: 1.2; }
.viz-bar-row .val small { display: block; font-weight: 400; font-size: 11px; color: var(--viz-muted); }
.viz-bar-track { grid-column: 1 / -1; height: 8px; background: var(--viz-zero); border-radius: 0 4px 4px 0; }
.viz-bar-fill { height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; min-width: 0; }

/* มาตรวัดเส้นตรง */
.viz-meter { height: 8px; background: var(--viz-track); border-radius: 4px; overflow: hidden; }
.viz-meter > div { height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; }
.viz-meter.light { background: #e8edf5; }

/* โดนัท */
.viz-donut { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.viz-donut .fig { position: relative; flex-shrink: 0; }
.viz-donut .fig path, .viz-donut .fig circle { transition: filter .15s; }
.viz-donut .fig path:hover, .viz-donut .fig path:focus-visible { filter: brightness(1.12); outline: none; }
.viz-donut .c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.viz-donut .c b { font-size: 1.6rem; font-weight: 700; color: var(--viz-ink); line-height: 1.1; }
.viz-donut .c span { font-size: .72rem; color: var(--viz-muted); max-width: 7rem; line-height: 1.3; }
.viz-donut-legend { flex: 1; min-width: 11rem; display: grid; gap: .45rem; font-size: .8rem; }
.viz-donut-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 3.2rem; align-items: center; gap: .5rem; color: var(--viz-ink-2); }
.viz-donut-legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.viz-donut-legend b { color: var(--viz-ink); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.viz-donut-legend .p { color: var(--viz-muted); text-align: right; font-variant-numeric: tabular-nums; font-size: .75rem; }

/* วงแหวน */
/* เรดาร์ — ป้ายแกนเป็น HTML (ขนาดตัวอักษรคงที่เมื่อกราฟย่อ/ขยาย) */
.viz-radar .viz-legend { margin-bottom: .9rem; }
.rd-fig { position: relative; width: 100%; max-width: 34rem; margin: 0 auto; aspect-ratio: 125 / 100; }
.rd-fig svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.rd-fig .g { fill: none; stroke: var(--viz-grid); stroke-width: 1; }
.rd-fig .g.edge { stroke: var(--viz-axis); }
.rd-fig .hit { fill: transparent; stroke: none; cursor: crosshair; outline: none; }
.rd-fig .hit:hover, .rd-fig .hit:focus-visible { fill: rgba(42, 120, 214, .07); }
.rd-l { position: absolute; max-width: var(--rd-lw, 7.5rem); font-size: .72rem; line-height: 1.25; color: var(--viz-ink-2, var(--ink-2)); pointer-events: none; }
.rd-l b { color: var(--viz-muted); font-weight: 600; margin-right: .1rem; }
.rd-l small { display: block; font-size: .66rem; color: var(--viz-muted); white-space: normal; }
.rd-l.a-n small, .rd-l.a-s small { white-space: nowrap; }
.viz-card.vc { display: flex; flex-direction: column; }
.viz-card.vc > .card-b { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.rd-l.a-e { transform: translate(0, -50%); text-align: left; }
.rd-l.a-w { transform: translate(-100%, -50%); text-align: right; }
.rd-l.a-n { transform: translate(-50%, -100%); text-align: center; white-space: nowrap; max-width: none; }
.rd-l.a-s { transform: translate(-50%, 0); text-align: center; white-space: nowrap; max-width: none; }
/* เรดาร์รายมาตรฐาน: ตัวเลขต่อท้ายชื่อแกน · แถบสรุปรายมาตรฐาน · ข้อสังเกต */
.rd-v { display: inline-block; margin-left: .35rem; padding: 0 .42rem; border-radius: 999px; background: #fff; border: 1.5px solid var(--c); font-style: normal; font-size: .74rem; font-weight: 700;
  line-height: 1.45; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; vertical-align: middle; box-shadow: 0 1px 2px rgba(15, 23, 42, .1); }
.viz-radar.rd-big .rd-l { font-size: .8rem; font-weight: 600; color: var(--ink); }
.viz-radar.rd-big .rd-l small { font-size: .7rem; font-weight: 400; margin-top: .1rem; }
.viz-radar.rd-big .viz-legend { justify-content: center; }
/* การ์ดกว้าง: เรดาร์ซ้าย · สรุปรายมาตรฐานและข้อสังเกตขวา (การ์ดแคบ: เรียงลงล่าง) */
.rd-wrap { container-type: inline-size; }
.rd-grid { display: grid; gap: 1rem; align-items: center; }
@container (min-width: 620px) {
  .rd-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.5rem; }
  .rd-side .rd-strip { grid-template-columns: 1fr; margin-top: 0; }
  .rd-side .rd-std { grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: .75rem; }
  .rd-side .rd-std .v { grid-column: 2; grid-row: 1; text-align: right; }
  .rd-side .rd-std .rd-bar, .rd-side .rd-std .s { grid-column: 1 / -1; }
}
.rd-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-top: 1.1rem; }
.rd-std { display: grid; gap: .3rem; align-content: start; min-width: 0; padding: .6rem .7rem; border-radius: .75rem; background: #f6f8fb; border: 1px solid #edf0f5; }
.rd-std .h { font-size: .68rem; color: var(--ink-3); line-height: 1.3; }
.rd-std .h b { display: block; font-size: .76rem; font-weight: 700; color: var(--ink); }
.rd-std .v { font-size: 1.15rem; font-weight: 800; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.rd-std .v small { margin-left: .15rem; font-size: .66rem; font-weight: 600; color: var(--ink-3); }
.rd-bar { position: relative; height: 7px; border-radius: 999px; background: #e3e8f0; overflow: hidden; }
.rd-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.rd-bar i + i { box-shadow: 2px 0 0 #fff; }
.rd-std .s { font-size: .66rem; line-height: 1.35; color: var(--ink-3); }
.rd-note { display: flex; align-items: flex-start; gap: .5rem; margin-top: .8rem; padding: .55rem .75rem; border-radius: .7rem; background: var(--brand-50); color: var(--brand-900); font-size: .76rem; line-height: 1.5; }
.rd-note > i { margin-top: .2rem; color: #d97706; }
@media (max-width: 420px) { .rd-strip { grid-template-columns: 1fr; } }
.rd-t { position: absolute; transform: translate(4px, -50%); font-size: .62rem; color: var(--viz-muted); pointer-events: none; font-variant-numeric: tabular-nums;
  text-shadow: 0 0 2px var(--viz-surface), 0 0 2px var(--viz-surface), 0 0 3px var(--viz-surface); }
@media (max-width: 480px) { .rd-l { font-size: .64rem; } }
.viz-rings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.viz-ring { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .55rem; outline-offset: 4px; border-radius: 12px; }
.viz-ring .fig { position: relative; }
.viz-ring .c { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.15rem; font-weight: 700; color: var(--viz-ink); }
.viz-ring .l { font-size: .8rem; font-weight: 600; color: var(--viz-ink); line-height: 1.35; }
.viz-ring .l small { display: block; font-size: .72rem; font-weight: 400; color: var(--viz-muted); }

/* sparkline */
.viz-spark { position: relative; width: 100%; margin-top: .35rem; }
.viz-spark svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.viz-spark .dot { position: absolute; right: -4px; width: 8px; height: 8px; margin-top: -4px; border-radius: 999px; background: var(--s1); box-shadow: 0 0 0 2px var(--viz-surface); }

/* กราฟเส้น */
.viz-line { --h: 220px; outline-offset: 4px; border-radius: 8px; }
.viz-line .frame { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); grid-template-rows: var(--h) 1.6rem; }
.viz-line .yl { position: relative; }
.viz-line .yl span { position: absolute; right: .5rem; transform: translateY(-50%); font-size: 11px; color: var(--viz-muted); font-variant-numeric: tabular-nums; }
.viz-line .plot { position: relative; cursor: crosshair; }
.viz-line .plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.viz-line .plot line.g { stroke: var(--viz-grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.viz-line .end { position: absolute; right: -5px; width: 10px; height: 10px; margin-top: -5px; border-radius: 999px; box-shadow: 0 0 0 2px var(--viz-surface); pointer-events: none; }
.viz-line .xh { position: absolute; top: 0; bottom: 0; width: 0; opacity: 0; pointer-events: none; }
.viz-line .xh.on { opacity: 1; }
.viz-line .xh .xl { position: absolute; top: 0; bottom: 0; left: 0; width: 1px; background: var(--viz-ink-2); opacity: .45; }
.viz-line .xh .xd { position: absolute; left: -5px; width: 10px; height: 10px; margin-top: -5px; border-radius: 999px; box-shadow: 0 0 0 2px var(--viz-surface); }
.viz-line .xr { grid-column: 2; position: relative; }
.viz-line .xr span { position: absolute; top: .4rem; transform: translateX(-50%); font-size: 11px; color: var(--viz-muted); white-space: nowrap; }
.viz-line .xr span:first-child { transform: none; }
.viz-line .xr span:last-child { transform: translateX(-100%); }

/* แผนที่ความร้อน */
.viz-heat-wrap { overflow-x: auto; }
.viz-heat { display: grid; gap: 2px; min-width: 32rem; }
.viz-heat .hh { font-size: 11px; color: var(--viz-ink-2); font-weight: 600; text-align: center; padding: .2rem 0; }
.viz-heat .hh.grp { border-bottom: 1px solid var(--viz-axis); margin: 0 2px .1rem; }
.viz-heat .hh.sub { color: var(--viz-muted); font-weight: 500; }
.viz-heat .rl { font-size: .78rem; color: var(--viz-ink); display: flex; align-items: center; padding-right: .6rem; min-width: 0; }
.viz-heat .rl > * { min-width: 0; }
.viz-heat .hc { height: 30px; border-radius: 4px; display: grid; place-items: center; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: default; transition: transform .1s; }
.viz-heat .hc:hover, .viz-heat .hc:focus-visible { transform: scale(1.08); position: relative; z-index: 1; outline: 2px solid var(--viz-ink); outline-offset: 0; }
.viz-heat .hc.na { background: transparent; }
.viz-heat-scale { display: flex; align-items: center; gap: .5rem; margin-top: .8rem; font-size: 11px; color: var(--viz-muted); }
.viz-heat-scale i { display: block; width: 10rem; height: 8px; border-radius: 4px; }

/* กราฟผีเสื้อ */
.viz-bfly { display: grid; gap: .35rem; }
.bf-row { display: grid; grid-template-columns: minmax(8rem, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); align-items: center; min-height: 1.9rem; }
.bf-head { font-size: 11px; color: var(--viz-muted); min-height: 1.3rem; }
.bf-head .l { text-align: right; padding-right: .6rem; }
.bf-head .r { padding-left: .6rem; }
.bf-lbl { font-size: .78rem; color: var(--viz-ink-2); padding-right: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bf-lbl b { color: var(--viz-ink); }
.bf-side { display: flex; align-items: center; gap: .4rem; height: 1.6rem; }
.bf-side.l { justify-content: flex-end; padding-right: 2px; border-right: 1px solid var(--viz-axis); }
.bf-side.r { justify-content: flex-start; padding-left: 2px; }
.bf-side i { display: block; height: 14px; min-width: 0; transition: filter .15s; }
.bf-side.l i { border-radius: 4px 0 0 4px; }
.bf-side.r i { border-radius: 0 4px 4px 0; }
.bf-side:hover i, .bf-side:focus-visible i { filter: brightness(1.1); }
.bf-side .v { font-size: 11px; font-weight: 600; color: var(--viz-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* กราฟกระจาย */
.viz-scatter { --h: 270px; }
.sc-frame { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); grid-template-rows: var(--h) 1.5rem auto; }
.sc-ylab { grid-row: 1; writing-mode: vertical-rl; transform: rotate(180deg); font-size: 11px; color: var(--viz-muted); text-align: center; }
.viz-scatter .plot { position: relative; border-left: 1px solid var(--viz-axis); border-bottom: 1px solid var(--viz-axis); margin-left: 1.2rem; cursor: crosshair; }
.viz-scatter .gy { position: absolute; left: 0; right: 0; height: 1px; background: var(--viz-grid); }
.viz-scatter .ty { position: absolute; left: -1.6rem; transform: translateY(-50%); font-size: 11px; color: var(--viz-muted); width: 1.3rem; text-align: right; }
.viz-scatter .thr { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--viz-ink-2); opacity: .55; }
.viz-scatter .thr-l { position: absolute; right: 4px; transform: translateY(-115%); font-size: 11px; color: var(--viz-ink-2); background: rgba(255, 255, 255, .85); padding: 0 .3rem; border-radius: 4px; }
.viz-scatter .pt { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 999px; box-shadow: 0 0 0 2px var(--viz-surface); opacity: .88; transition: transform .1s; pointer-events: none; }
.viz-scatter .pt.hot { transform: scale(1.7); opacity: 1; z-index: 2; }
.sc-x { grid-column: 2; position: relative; margin-left: 1.2rem; }
.sc-x span { position: absolute; top: .35rem; transform: translateX(-50%); font-size: 11px; color: var(--viz-muted); }
.sc-xlab { grid-column: 2; text-align: center; font-size: 11px; color: var(--viz-muted); padding-top: .2rem; }

/* เมทริกซ์ 8 กลุ่ม */
.viz-matrix { display: grid; grid-template-columns: 6.2rem repeat(4, minmax(0, 1fr)); gap: 6px; }
.viz-matrix .mx-h { font-size: 11px; color: var(--viz-muted); text-align: center; line-height: 1.35; padding-bottom: .2rem; }
.viz-matrix .mx-r { font-size: 11px; color: var(--viz-muted); display: flex; align-items: center; justify-content: flex-end; text-align: right; padding-right: .3rem; }
.viz-matrix .mx-h b, .viz-matrix .mx-r b { color: var(--viz-ink); }
.mx-t { border-radius: 10px; min-height: 5.2rem; padding: .5rem .3rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; background: var(--viz-zero); color: var(--viz-ink); transition: transform .12s, box-shadow .12s; }
.mx-t:hover, .mx-t:focus-visible { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15, 23, 42, .18); }
.mx-t .code { font-size: 11px; font-weight: 700; letter-spacing: .14em; opacity: .9; }
.mx-t b { font-size: 1.45rem; line-height: 1.1; color: inherit; }
.mx-t small { font-size: 11px; opacity: .9; }
.mx-t.zero { color: var(--viz-muted); }

/* ดัมเบล */
.viz-db-row { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid #f0f2f6; }
.viz-db-row:last-of-type { border-bottom: 0; }
.viz-db-row .lbl { font-size: .8rem; color: var(--viz-ink); line-height: 1.35; }
.viz-db-axis { position: relative; height: 40px; margin: 0 10px; }
.viz-db-axis .rule { position: absolute; left: 0; right: 0; top: 19px; height: 1px; background: var(--viz-grid); }
.viz-db-axis .tick { position: absolute; top: 15px; width: 1px; height: 9px; background: var(--viz-axis); }
.viz-db-axis .link { position: absolute; top: 18px; height: 3px; background: var(--viz-axis); border-radius: 2px; }
.viz-db-axis .dot { position: absolute; top: 13px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; box-shadow: 0 0 0 2px var(--viz-surface); cursor: default; }
.viz-db-axis .dl { position: absolute; top: -4px; font-size: 11px; font-weight: 700; color: var(--viz-ink); transform: translateX(-50%); white-space: nowrap; }
.viz-db-axis .dl.below { top: 29px; color: var(--viz-ink-2); font-weight: 500; }
.viz-db-scale { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 12px; }
.viz-db-scale .marks { position: relative; height: 18px; margin: 0 10px; font-size: 10.5px; color: var(--viz-muted); }
.viz-db-scale .marks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.viz-db-scale .lg { font-style: normal; }
@media (max-width: 640px) {
  .viz-db-row, .viz-db-scale { grid-template-columns: min(9.5rem, 36%) minmax(0, 1fr); }
  .viz-db-scale .lg { display: none; }
}

/* ---------- อื่น ๆ ---------- */
.prose-th p { margin: .45rem 0; line-height: 1.85; text-indent: 2.25rem; }
.prose-th h3, .prose-th h4 { text-indent: 0; }
.fade-in { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.skel { background: linear-gradient(90deg, #eef1f6, #f7f8fb, #eef1f6); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: .6rem; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.swal2-popup { font-family: 'IBM Plex Sans Thai', Thonburi, system-ui, sans-serif !important; border-radius: 1.25rem !important; }

@media print {
  .no-print, #topbar, footer, .adm-side { display: none !important; }
  body { background: #fff; }
  .adm-shell { display: block; }
  .sh-wrap { padding: 0; }
  .sh-wrap::before { display: none; }
  .sh-wrap > .sh-card { box-shadow: none; border-color: var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* เปรียบเทียบการส่งรายงานรายระดับ (แดชบอร์ด) */
.cmp { display: grid; gap: 1.25rem; }
.cmp-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.cmp-tile { border: 1px solid var(--line); border-radius: .9rem; padding: .9rem 1rem 1rem; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 7%, #fff), #fff 70%); }
.cmp-tile .hd { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.cmp-tile .hd span { display: inline-flex; align-items: center; gap: .45rem; }
.cmp-tile .hd small { font-size: .72rem; font-weight: 500; color: var(--ink-4); }
.cmp-tile .sw { width: .6rem; height: .6rem; border-radius: 3px; background: var(--c); }
.cmp-tile .big { margin-top: .35rem; font-size: 2rem; line-height: 1.1; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.cmp-tile .big span { font-size: 1.1rem; font-weight: 600; color: var(--ink-3); margin-left: .1rem; }
.cmp-tile .sub { font-size: .78rem; color: var(--ink-3); margin-bottom: .6rem; }
.cmp-tile .trk { height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--c) 14%, #fff); overflow: hidden; }
.cmp-tile .trk i { display: block; height: 100%; border-radius: 999px; background: var(--c); }
.cmp-rows { display: grid; border-top: 1px solid var(--line); }
.cmp-row { display: grid; grid-template-columns: 12.5rem minmax(0, 1fr); align-items: center; gap: 1.25rem; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.cmp-row:last-child { border-bottom: 0; padding-bottom: 0; }
.cmp-row .lbl { display: grid; grid-template-columns: 1.1rem minmax(0, 1fr); align-items: center; column-gap: .55rem; row-gap: .25rem; font-size: .88rem; font-weight: 600; color: var(--ink); min-width: 0; }
.cmp-row .lbl span { white-space: nowrap; }
.cmp-row .lbl > i { width: 1rem; text-align: center; color: var(--ink-4); font-size: .8rem; }
.cmp-row .lbl em { grid-column: 2; justify-self: start; font-style: normal; font-size: .68rem; font-weight: 600; color: var(--ink-3); background: #f1f4f9; border-radius: 999px; padding: .1rem .45rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cmp-row .bars { display: grid; gap: .4rem; }
.cmp-bar { display: grid; grid-template-columns: minmax(0, 1fr) 7rem; align-items: center; gap: .6rem; border-radius: 4px; outline-offset: 3px; }
.cmp-bar .trk { height: 12px; border-radius: 999px; background: #eef1f6; overflow: hidden; }
.cmp-bar .trk i { display: block; height: 100%; border-radius: 999px; transition: filter .15s; }
.cmp-bar:hover .trk i, .cmp-bar:focus-visible .trk i { filter: brightness(1.1); }
.cmp-bar .v { font-size: .85rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmp-bar .v small { margin-left: .35rem; font-size: .7rem; font-weight: 500; color: var(--ink-4); }
@media (max-width: 640px) {
  .cmp-row { grid-template-columns: 1fr; gap: .5rem; }
  .cmp-tile .big { font-size: 1.6rem; }
}

/* ค้นหาโรงเรียน (แถบเมนูด้านซ้าย) */
.sch-search { position: relative; margin: 0 .1rem; }
.sch-search .ic { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); font-size: .8rem; color: var(--ink-4); pointer-events: none; }
.sch-search input { width: 100%; height: 2.35rem; padding: 0 2rem 0 2.1rem; border: 1px solid var(--line); border-radius: .7rem; background: #f6f8fb; font-size: .86rem; color: var(--ink); transition: border-color .12s, background .12s, box-shadow .12s; }
.sch-search input::placeholder { color: var(--ink-4); }
.sch-search input:focus { outline: none; background: #fff; border-color: var(--brand-600); box-shadow: 0 0 0 3px var(--brand-50); }
.sch-search input::-webkit-search-cancel-button { display: none; }
.sch-search kbd { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); min-width: 1.25rem; height: 1.25rem; display: grid; place-items: center; border: 1px solid var(--line); border-radius: .3rem; background: #fff; font: 600 .68rem/1 inherit; color: var(--ink-4); pointer-events: none; }
.sch-search input:focus ~ kbd, .sch-search input:not(:placeholder-shown) ~ kbd { display: none; }
.sch-res { position: absolute; z-index: 70; left: 0; width: max(100%, min(24rem, calc(100vw - 2rem))); top: calc(100% + .35rem); background: #fff; border: 1px solid var(--line); border-radius: .8rem; box-shadow: var(--shadow-lg); padding: .3rem; max-height: min(60vh, 26rem); overflow-y: auto; }
.sch-hit { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .45rem .5rem; border-radius: .55rem; text-align: left; }
.sch-hit .kpi-ic { width: 1.9rem; height: 1.9rem; font-size: .75rem; border-radius: .5rem; flex-shrink: 0; }
.sch-hit .nm { display: block; font-size: .84rem; font-weight: 600; color: var(--ink); line-height: 1.35; }
.sch-hit .nm mark { background: #fff1b8; color: inherit; border-radius: 2px; padding: 0 1px; }
.sch-hit .mt { display: block; font-size: .7rem; color: var(--ink-4); }
.sch-hit:hover, .sch-hit[aria-selected="true"] { background: var(--brand-50); }
.sch-empty { padding: .9rem .6rem; font-size: .8rem; color: var(--ink-4); text-align: center; }
.sch-link { font: inherit; color: inherit; text-align: left; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; transition: color .12s, text-decoration-color .12s; }
.sch-link:hover, .sch-link:focus-visible { color: var(--brand-700); text-decoration-color: currentColor; }

/* หน้าข้อมูลรายโรงเรียน */
/* การ์ดหัว school.php: ผู้ประสานงาน (+ บัญชีผู้ใช้สำหรับผู้ดูแล) ด้านขวา */
.sp-side { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .75rem; }
.sp-side > * { flex: 1 1 auto; }
@media (min-width: 768px) { .sp-hctl { flex: 0 1 auto; max-width: 50%; } }   /* จอแคบ: กล่องเรียงลงล่าง ไม่บีบชื่อโรงเรียน */
@media (max-width: 767px) { .sp-hctl, .sp-side { width: 100%; } .sp-side { justify-content: flex-start; } }
.sp-acct { display: grid; gap: .35rem; font-size: .8rem; padding: .7rem .9rem; border-radius: .7rem; background: #f6f8fb; min-width: 13rem; }
.sp-acct div { display: flex; justify-content: space-between; gap: 1rem; }
.sp-acct span { color: var(--ink-4); }
.sp-acct b { font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sp-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem .9rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.sp-fact { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--ink-3); min-width: 0; }
.sp-fact i { width: 1rem; text-align: center; color: var(--ink-4); font-size: .75rem; }
.sp-fact b { margin-left: auto; font-weight: 600; color: var(--ink); text-align: right; }
.sp-ipo { display: flex; align-items: center; gap: .75rem; padding: .6rem .7rem; border-radius: .7rem; border: 1px solid var(--line); }
.sp-ipo b { display: block; font-size: .85rem; }
.sp-ipo small { display: block; font-size: .72rem; color: var(--ink-3); }
.sp-ipo.Y { background: color-mix(in srgb, var(--s1) 6%, #fff); }
.sp-guide { margin-top: .9rem; font-size: .8rem; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: .7rem; }
.sp-guide summary { cursor: pointer; font-weight: 600; color: var(--brand-700); }
.sp-guide p { margin-top: .5rem; line-height: 1.6; }
.lvl-chip { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.lvl-chip.l3 { background: var(--lvl-3); color: #fff; }
.lvl-chip.l2 { background: var(--lvl-2); color: #fff; }
.lvl-chip.l1 { background: #e8f1fc; color: #24548f; }
.iqa-chip { display: inline-grid; place-items: center; width: 1.45rem; height: 1.45rem; border-radius: .4rem; font-size: .72rem; font-weight: 700; background: var(--c); color: #0b2e5c; }
.iqa-chip.dk { color: #fff; }
.iqa-chip.none { background: #f1f4f9; color: var(--ink-4); }
.sp-sw { border-radius: .8rem; padding: .8rem .9rem; border: 1px solid var(--line); }
.sp-sw .h { display: flex; align-items: center; gap: .45rem; font-size: .82rem; font-weight: 700; margin-bottom: .4rem; }
.sp-sw ul { list-style: disc; padding-left: 1.1rem; font-size: .8rem; color: var(--ink-2); display: grid; gap: .3rem; }
.sp-sw.good .h { color: #047857; } .sp-sw.good { background: #f0fdf6; border-color: #d1fae5; }
.sp-sw.warn .h { color: #b45309; } .sp-sw.warn { background: #fffbeb; border-color: #fde68a; }
.sp-sw.plan .h { color: var(--brand-700); } .sp-sw.plan { background: var(--brand-50); border-color: #dbe7f7; }
.tbl tr.sp-cur td { background: #f7faff; }
@media (max-width: 640px) { .sp-facts { grid-template-columns: 1fr; } .sp-acct { width: 100%; } }

/* school.php — ค้นหาในแถบบน */
.sch-top { width: min(22rem, 46vw); }
.sch-top input { background: rgba(255, 255, 255, .95); border-color: transparent; }
.sch-top .sch-res { left: auto; right: 0; }
@media (max-width: 640px) { .sch-top kbd { display: none; } }

/* school.php — สรุปรายระดับ + ตัวเลือก */
/* การ์ดรายระดับ (หน้าความก้าวหน้า/ข้อมูลรายโรงเรียน) — สีประจำระดับ: ปฐมวัยน้ำเงิน · ขั้นพื้นฐานส้ม (เหมือนแดชบอร์ด) */
.sp-sum { --lv: var(--s1); --lv-bg: #eaf3fd; position: relative; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 1.1rem; box-shadow: 0 12px 28px -20px rgba(15, 23, 42, .55); }
.sp-sum.basic { --lv: var(--s2); --lv-bg: #fdefe8; }
.sp-sum::before { content: ''; position: absolute; inset: 0 0 auto; height: 4px; background: var(--lv); }
.sp-sum-h { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.15rem .7rem; background: linear-gradient(180deg, var(--lv-bg), rgba(255, 255, 255, 0)); }
.sp-sum-h .ic { width: 2.5rem; height: 2.5rem; flex-shrink: 0; display: grid; place-items: center; border-radius: .85rem; font-size: 1.05rem; color: #fff; background: var(--lv); box-shadow: 0 8px 16px -10px var(--lv); }
.sp-sum-h b { display: block; font-size: 1.05rem; font-weight: 700; line-height: 1.2; color: var(--ink); }
.sp-sum-h small { display: block; margin-top: .1rem; font-size: .74rem; color: var(--ink-3); }
.sp-sum-h .badge { margin-left: auto; flex-shrink: 0; }
.sp-sum-b { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .9rem 1.25rem; padding: .3rem 1.15rem 1rem; }
.sp-sum-q { min-width: 0; }
.sp-sum-q > small, .sp-sum-e > small { display: block; font-size: .74rem; font-weight: 600; color: var(--ink-3); }
.sp-sum-q .v { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; margin-top: .1rem; font-size: 1.6rem; font-weight: 800; line-height: 1.25; color: var(--ink); }
.sp-lvl { display: flex; gap: 3px; margin-top: .4rem; }
.sp-lvl i { width: 1.35rem; height: .4rem; border-radius: 999px; background: #e5e9f0; }
.sp-lvl i.on { background: var(--lv); }
.sp-sum-q .sds { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .55rem; }
.sp-sum-q .sd { padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; color: var(--ink-2); background: #f1f5f9; cursor: help; }
.sp-sum-q .sd em { margin-right: .3rem; font-style: normal; color: var(--ink-4); }
.sp-tr { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700; cursor: help; }
.sp-tr.up { color: #15803d; background: #dcfce7; }
.sp-tr.down { color: #be123c; background: #ffe4e6; }
.sp-tr.same { color: var(--ink-3); background: #f1f5f9; }
.sp-sum-e { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; }
@media (max-width: 639px) { .sp-sum-e { align-items: flex-start; } }   /* มือถือ: กลุ่มประสิทธิภาพขึ้นบรรทัดใหม่ — ชิดซ้าย */
/* ผลประสิทธิภาพ 3 ด้าน (การ์ดรายระดับ) — กล่องใหญ่ ตัวอักษรเด่น ชื่อด้านอยู่ในกล่อง */
.sp-tiles { display: flex; gap: .4rem; }
.sp-tiles .t { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 3.9rem; height: 3.4rem; border-radius: .85rem; line-height: 1.1; cursor: help; }
.sp-tiles .t b { font-size: 1.45rem; font-weight: 800; }
.sp-tiles .t small { margin-top: .15rem; font-size: .62rem; font-weight: 600; }
.sp-tiles .t.y { color: #fff; background: linear-gradient(160deg, #3b8bea, var(--brand-700)); box-shadow: 0 8px 16px -8px rgba(31, 104, 194, .85), inset 0 1px 0 rgba(255, 255, 255, .2); }
.sp-tiles .t.y small { color: rgba(255, 255, 255, .88); }
.sp-tiles .t.n { color: #475569; background: #eef2f7; border: 1px solid #d5dbe5; }
.sp-tiles .t.n small { color: #64748b; }
.sp-tiles .t.q { color: #94a3b8; background: #fff; border: 1px dashed #cbd5e1; }
.sp-ctl { padding: .8rem 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; }
.sp-years { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.sp-years .lbl { font-size: .78rem; font-weight: 600; color: var(--ink-3); margin-right: .2rem; }
.sp-years .fchip i { font-size: .85rem; }
.sp-years .fchip[aria-pressed="true"] i { color: #fff; }
.sp-years .fchip[aria-pressed="false"] i { color: var(--ink-4); }
.sp-all { font-size: .76rem; color: var(--brand-700); font-weight: 600; padding: .2rem .4rem; border-radius: .4rem; }
.sp-all:hover { background: var(--brand-50); }
.sp-chk { display: inline-flex; align-items: center; gap: .45rem; font-size: .8rem; color: var(--ink-2); margin-left: auto; cursor: pointer; }
.sp-chk input { width: 1rem; height: 1rem; accent-color: var(--brand-600); }
.sp-pick select { font-weight: 600; }

/* school.php — ตารางเปรียบเทียบรายปี */
.cmp-wrap { max-height: none; }
.cmp-tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .84rem; }
.cmp-tbl thead th { position: sticky; top: 0; z-index: 2; background: #f8fafc; border-bottom: 1px solid var(--line); padding: .7rem .9rem; font-size: .8rem; font-weight: 700; color: var(--ink-2); text-align: left; white-space: nowrap; }
.cmp-tbl th.cmp-y { min-width: 9.5rem; }
.cmp-tbl th.cmp-y > div { display: inline-block; font-size: .9rem; color: var(--ink); }
.cmp-print { margin-left: .4rem; color: var(--ink-4); font-size: .75rem; }
.cmp-print:hover { color: var(--brand-700); }
.cmp-tbl th.cmp-d, .cmp-tbl td.cmp-d { min-width: 7rem; text-align: center; background: #fbfcfe; }
.cmp-tbl thead th.cmp-d { background: #f3f6fa; font-size: .76rem; }
.cmp-tbl thead th.cmp-d div { font-size: .68rem; color: var(--ink-4); }
.cmp-tbl .cmp-lbl { position: sticky; left: 0; z-index: 1; background: #fff; min-width: 15rem; max-width: 22rem; font-weight: 500; color: var(--ink-2); text-align: left; white-space: normal; }
.cmp-tbl thead .cmp-lbl { z-index: 3; background: #f8fafc; }
.cmp-tbl tbody th, .cmp-tbl tbody td { padding: .6rem .9rem; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
.cmp-tbl tbody tr:hover > * { background: #f6f9fd; }
.cmp-tbl tr.is-chg > .cmp-lbl { box-shadow: inset 3px 0 0 var(--s2); }
.cmp-tbl tr.cmp-g > th { position: static; text-align: left; background: #f1f5fa; color: var(--ink); font-size: .8rem; font-weight: 700; padding: .55rem .9rem; border-bottom: 1px solid var(--line); }
.cmp-tbl tr.cmp-g > th i:first-child { width: 1.1rem; color: var(--brand-600); margin-right: .45rem; }
.cmp-tbl tr.cmp-g small { margin-left: .6rem; font-weight: 500; color: var(--ink-4); font-size: .72rem; }
.cmp-tbl tr.cmp-item > .cmp-lbl { padding-left: 1.6rem; font-weight: 400; font-size: .8rem; }
.cmp-tg { float: right; font-size: .74rem; font-weight: 600; color: var(--brand-700); padding: .1rem .45rem; border-radius: .4rem; }
.cmp-tg:hover { background: #fff; }
.cmp-sub { font-size: .7rem; color: var(--ink-4); font-weight: 400; margin-top: .1rem; }
.cmpt-pct { display: inline-block; min-width: 5.5rem; white-space: nowrap; }
.cmpt-pct i { display: block; height: 5px; margin-top: .3rem; border-radius: 999px; background: linear-gradient(90deg, var(--s1) var(--w), #e9eef5 var(--w)); }
.dlt { display: inline-flex; align-items: center; gap: .25rem; padding: .12rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dlt.up { background: #e7f8ee; color: #047857; }
.dlt.down { background: #ffe9ea; color: #be123c; }
.dlt.neu { background: #eef2f7; color: var(--ink-2); }
.dlt.chg { background: #fff3e6; color: #b45309; }
.dlt.same { color: var(--ink-4); font-weight: 500; }
@media print {
  .sp-ctl, .cmp-tg, .cmp-print { display: none !important; }
  .cmp-tbl .cmp-lbl, .cmp-tbl thead th { position: static; }
}

/* school.php — กราฟเปรียบเทียบรายปี */
.sp-view { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-left: auto; }
.sp-view .sp-chk { margin-left: 0; }
.gb { display: grid; gap: .9rem; }
.gb-g { display: grid; grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr); gap: .3rem 1rem; align-items: center; padding-bottom: .9rem; border-bottom: 1px solid #eef1f5; }
.gb-g:last-of-type { border-bottom: 0; padding-bottom: 0; }
.gb-l { font-size: .84rem; font-weight: 600; color: var(--ink); line-height: 1.4; display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; }
.gb-bars { display: grid; gap: .3rem; }
.gb-r { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) 6.5rem; align-items: center; gap: .55rem; border-radius: 4px; outline-offset: 2px; }
.gb-r .y { font-size: .72rem; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.gb-r .trk { position: relative; height: 14px; background: #f1f4f8; border-radius: 0 4px 4px 0; }
.gb-r .trk i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; transition: filter .15s; }
.gb-r:hover .trk i, .gb-r:focus-visible .trk i { filter: brightness(1.08); }
.gb-r .trk .gl { position: absolute; top: 0; bottom: 0; width: 1px; background: #e3e8ef; }
.gb-r .trk .ref { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; z-index: 1; }
.gb-r .v { font-size: .78rem; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gb .refk { display: inline-block; width: 2px; height: .8rem; background: var(--ink); vertical-align: middle; margin-right: .35rem; border-radius: 1px; }
.gb-ax { display: grid; grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr); gap: 1rem; }
.gb-ax .mk { position: relative; height: 1.1rem; margin: 0 7.05rem 0 3.15rem; }
.gb-ax .mk span { position: absolute; transform: translateX(-50%); font-size: .66rem; color: var(--ink-4); white-space: nowrap; }
.gb-ax > span:last-child { display: none; }
.mc { background: #fff; border: 1px solid var(--line); border-radius: 1rem; padding: .8rem .9rem .7rem; display: flex; flex-direction: column; gap: .5rem; }
.mc .h { display: flex; align-items: center; gap: .45rem; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.mc .h > i { color: var(--ink-4); font-size: .78rem; width: 1rem; text-align: center; }
.mc .h .dlt { margin-left: auto; }
.mc .cols { display: flex; align-items: flex-end; justify-content: space-around; gap: .5rem; height: 6.2rem; }
.mc .c { flex: 1; max-width: 3.2rem; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: .2rem; border-radius: 4px; outline-offset: 2px; }
.mc .c i { display: block; width: 100%; max-width: 24px; border-radius: 4px 4px 0 0; min-height: 0; max-height: calc(100% - 2.4rem); }
.mc .c .v { font-size: .78rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mc .c .y { font-size: .68rem; color: var(--ink-4); border-top: 1px solid var(--line); width: 100%; text-align: center; padding-top: .15rem; }
.ipo-tl { display: grid; gap: .35rem; }
.ipo-row { display: grid; grid-template-columns: 4.2rem repeat(3, minmax(0, 1fr)) 6.5rem; align-items: center; gap: .5rem; padding: .45rem .5rem; border-radius: .6rem; font-size: .82rem; }
.ipo-row > span { display: flex; justify-content: center; }
.ipo-row > span:first-child { justify-content: flex-start; }
.ipo-row.hd { font-size: .7rem; font-weight: 600; color: var(--ink-4); padding-top: 0; padding-bottom: .2rem; }
.ipo-row:not(.hd) { background: #f8fafc; }
.ipo-row .yr { font-weight: 700; align-items: center; gap: .4rem; }
.ipo-row .yr i { width: .6rem; height: .6rem; border-radius: 3px; display: inline-block; }
.ipo-row .col-span-4 { grid-column: span 4; justify-content: center; }
.in-grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .82rem; }
.in-grid th { position: sticky; top: 0; background: #f8fafc; text-align: center; font-size: .74rem; font-weight: 600; color: var(--ink-3); padding: .6rem .7rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.in-grid th:first-child { text-align: left; }
.in-grid td { padding: .45rem .7rem; border-bottom: 1px solid #eef1f5; text-align: center; vertical-align: middle; }
.in-grid td:first-child { text-align: left; }
.in-grid tbody tr:last-child td { border-bottom: 0; }
.in-cell { display: inline-grid; place-items: center; min-width: 4.8rem; height: 1.75rem; padding: 0 .5rem; border-radius: .45rem; font-size: .74rem; font-weight: 600; outline-offset: 2px; }
.in-cell.l3 { background: var(--lvl-3); color: #fff; }
.in-cell.l2 { background: var(--lvl-2); color: #fff; }
.in-cell.l1 { background: var(--lvl-1); color: #0b2e5c; }
.in-cell.l0 { background: #f1f4f8; color: var(--ink-4); }
@media (max-width: 640px) {
  .gb-g, .gb-ax { grid-template-columns: 1fr; }
  .gb-ax > span:first-child { display: none; }
  .gb-r { grid-template-columns: 2.4rem minmax(0, 1fr) 5.5rem; }
  .gb-ax .mk { margin: 0 6.05rem 0 2.95rem; }
  .ipo-row { grid-template-columns: 3.4rem repeat(3, minmax(0, 1fr)) 4.8rem; }
}

/* ผู้ประสานงาน (school.php) */
.sp-coord { display: grid; gap: .3rem; padding: .7rem .9rem; border-radius: .7rem; background: var(--brand-50); min-width: 14rem; }
.sp-coord .t { font-size: .74rem; font-weight: 600; color: var(--brand-700); display: flex; align-items: center; gap: .4rem; }
.sp-coord .t small { font-weight: 500; color: var(--ink-4); }
.coord { display: inline-flex; flex-direction: column; gap: .1rem; line-height: 1.35; }
.coord b { font-weight: 600; color: var(--ink); font-size: .9rem; }
.coord a { display: inline-flex; align-items: center; gap: .35rem; color: var(--brand-700); font-weight: 600; font-size: .84rem; font-variant-numeric: tabular-nums; }
.coord a i { font-size: .7rem; }
.coord a:hover { text-decoration: underline; }
.coord.sm b { font-size: .8rem; }
.coord.sm a { font-size: .76rem; }
@media (max-width: 640px) { .sp-coord { width: 100%; } }

/* หน้าต่างเปิดดูเล่ม SAR (popup) — assets/viewer.js */
html.fv-lock, html.fv-lock body { overflow: hidden; }
.fv-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1.25rem; background: rgba(15, 23, 42, .62); backdrop-filter: blur(3px); animation: fv-in .15s ease-out; }
@keyframes fv-in { from { opacity: 0; } to { opacity: 1; } }
.fv-box { display: flex; flex-direction: column; width: min(1100px, 100%); height: min(92vh, 100%); background: #fff; border-radius: 1rem; overflow: hidden; box-shadow: 0 24px 60px rgba(15, 23, 42, .35); }
.fv-head { display: flex; align-items: center; gap: .75rem; padding: .65rem .75rem .65rem 1rem; border-bottom: 1px solid var(--line); }
.fv-ic { width: 2.3rem; height: 2.3rem; flex-shrink: 0; display: grid; place-items: center; border-radius: .65rem; background: #fee2e2; color: #b91c1c; font-size: 1.05rem; }
.fv-title { font-size: .95rem; font-weight: 700; color: var(--ink); line-height: 1.3; }
.fv-name { font-size: .74rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fv-tools { display: flex; align-items: center; gap: .25rem; flex-shrink: 0; }
.fv-close { width: 2.25rem; height: 2.25rem; display: grid; place-items: center; border-radius: .6rem; color: var(--ink-2); font-size: 1.15rem; }
.fv-close:hover { background: #f1f5f9; color: var(--ink); }
.fv-demo { display: flex; align-items: flex-start; gap: .55rem; padding: .6rem 1rem; font-size: .8rem; line-height: 1.55; color: #78350f; background: #fffbeb; border-bottom: 1px solid #fde68a; }
.fv-demo > i { margin-top: .2rem; color: #b45309; }
.fv-body { position: relative; flex: 1; min-height: 0; background: #525659; display: flex; align-items: center; justify-content: center; }
.fv-body iframe { width: 100%; height: 100%; border: 0; background: #525659; }
.fv-body img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; }
.fv-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: .5rem; padding: 1rem; text-align: center; color: #e2e8f0; font-size: .9rem; pointer-events: none; }
.fv-foot { display: none; padding: .45rem .9rem; font-size: .72rem; color: var(--ink-3); border-top: 1px solid var(--line); background: #f8fafc; }
@media (max-width: 640px) {
  .fv-overlay { padding: 0; }
  .fv-box { width: 100%; height: 100%; border-radius: 0; }
  .fv-foot { display: block; }
}

/* ตั้งค่าโรงเรียน */
.ss-ro { display: flex; align-items: center; background: #f8fafc; color: var(--ink-2); cursor: default; }
.ss-bar { position: sticky; bottom: 1rem; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 1rem; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); box-shadow: 0 10px 28px rgba(15, 23, 42, .12); }
.ss-dl { display: grid; gap: .1rem; }
/* หน้าตั้งค่าโรงเรียนแบบกะทัดรัด: หัว/เนื้อการ์ดและระยะห่างแคบลง */
.ss-page .page-head { margin-bottom: .7rem; }
.ss-page .card-h { padding: .7rem 1.1rem .1rem; }
.ss-page .card-h h3 { font-size: .95rem; }
.ss-page .card-h p { margin-top: .05rem; font-size: .75rem; }
.ss-page .card-b { padding: .55rem 1.1rem .85rem; }
.ss-page .lbl { margin-bottom: .2rem; }
.ss-page .ss-bar { position: static; padding: .6rem .9rem; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }   /* อยู่ใต้การ์ดบัญชีผู้ใช้ในแถบขวา (แถบขวาตรึงเอง) */
.ss-page .ss-ro { overflow: hidden; white-space: nowrap; }
/* วันที่ได้รับอนุญาตจัดตั้ง: วัน · เดือน · ปี พ.ศ. */
.ss-date { display: grid; grid-template-columns: 5.2rem minmax(0, 1fr) 6.2rem; gap: .5rem; }
.ss-page .sd-eqa-lock { padding: .55rem .9rem; }
.ss-row { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .75rem; padding: .3rem 0; border-bottom: 1px dashed var(--line); font-size: .84rem; }
.ss-row:last-child { border-bottom: 0; }
.ss-row dt { color: var(--ink-3); }
.ss-row dd { min-width: 0; color: var(--ink); overflow-wrap: anywhere; }
/* ---------- ลายเซ็น (หน้าตั้งค่าโรงเรียน): กรอบแสดงรูปในการ์ดของแต่ละคน ---------- */
.sg { margin-top: .7rem; padding-top: .6rem; border-top: 1px dashed var(--line-2); border-radius: .5rem; }
.sg.is-drop { outline: 2px dashed var(--brand-500); outline-offset: 4px; }
.sg-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; }
.sg-l { flex-shrink: 0; }
.sg-hint { flex: 1 1 12rem; min-width: 0; }
.sg-prev { flex: 0 1 13rem; height: 3.6rem; min-width: 9rem; display: grid; place-items: center; padding: .4rem .6rem; border-radius: .8rem; border: 1.5px dashed var(--line-2); background: #fbfcfe; color: var(--ink-4); font-size: .8rem; }
.sg-prev > span > i { margin-right: .3rem; }
.sg-prev.has { border-style: solid; border-color: var(--line); background: #fff linear-gradient(to bottom, transparent calc(78% - 1px), #cbd5e1 calc(78% - 1px), #cbd5e1 78%, transparent 78%); }
.sg-prev img { max-width: 100%; max-height: 3rem; width: auto; height: auto; object-fit: contain; }
.sg-acts { display: flex; flex-wrap: wrap; gap: .5rem; }
.sg-del { color: #be123c; }
/* ---------- เครื่องมือจัดการรูปลายเซ็น (assets/signpad.js): ครอป + ลบพื้นหลัง ---------- */
html.sp-open { overflow: hidden; }
.sp-ov { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(15, 23, 42, .62); backdrop-filter: blur(3px); animation: fv-in .15s ease-out; }
.sp-ov [hidden] { display: none !important; }
.sp-box { width: min(100%, 62rem); max-height: 100%; display: flex; flex-direction: column; overflow: hidden; border-radius: 1.1rem; background: #fff; box-shadow: 0 30px 80px -20px rgba(11, 37, 71, .55); }
.sp-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--line); }
.sp-head h3 { font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.sp-head h3 > i { margin-right: .35rem; color: var(--brand-600); }
.sp-head h3 small { margin-left: .4rem; font-size: .82rem; font-weight: 500; color: var(--ink-3); }
.sp-x { width: 2.2rem; height: 2.2rem; flex-shrink: 0; display: grid; place-items: center; border-radius: .7rem; color: var(--ink-3); }
.sp-x:hover { background: #f1f5f9; color: var(--ink); }
.sp-body { display: grid; gap: 1.25rem; padding: 1.1rem 1.25rem; overflow: auto; }
@media (min-width: 900px) { .sp-body { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }
.sp-left, .sp-right { min-width: 0; display: flex; flex-direction: column; gap: .65rem; }
.sp-step { display: flex; align-items: center; gap: .5rem; font-size: .9rem; font-weight: 700; color: var(--ink); }
.sp-step b { width: 1.45rem; height: 1.45rem; display: grid; place-items: center; border-radius: 999px; font-size: .78rem; color: #fff; background: var(--brand-600); }
.sp-stage { position: relative; display: grid; place-items: center; min-height: 12rem; padding: .5rem; border-radius: .9rem; background: #e8ecf2; }
.sp-stage canvas { display: block; max-width: 100%; border-radius: .25rem; touch-action: none; user-select: none; -webkit-user-select: none; }
.sp-load { position: absolute; inset: 0; display: grid; place-items: center; font-size: .85rem; color: var(--ink-3); background: #e8ecf2; border-radius: .9rem; }
.sp-tools { display: flex; flex-wrap: wrap; gap: .45rem; }
/* ตัวอย่างผลลัพธ์: พื้นลายตารางหมากรุก = ส่วนที่โปร่งใส · .white = บนกระดาษขาวพร้อมเส้นลงนาม */
.sp-prev { --ph: 9.5rem; display: grid; place-items: center; height: var(--ph); padding: .6rem; overflow: hidden; border-radius: .9rem; border: 1px solid var(--line);
  background: #fff repeating-conic-gradient(#e9edf3 0% 25%, #fff 0% 50%) 50% / 18px 18px; }
.sp-prev.white { background: #fff linear-gradient(to bottom, transparent calc(80% - 1px), #94a3b8 calc(80% - 1px), #94a3b8 80%, transparent 80%); }
.sp-prev canvas { max-width: 100%; max-height: calc(var(--ph) - 1.2rem); }
.sp-prev-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem .75rem; font-size: .76rem; color: var(--ink-3); }
.sp-prev-bar b { margin-left: .3rem; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sp-prev-bar .seg button { height: 1.7rem; padding: 0 .65rem; font-size: .74rem; }
.sp-ctl { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .6rem .75rem; border-radius: .8rem; border: 1px solid var(--line); background: #fbfcfe; }
.sp-ctl.col { flex-direction: column; align-items: stretch; gap: .35rem; }
.sp-ctl.is-off { opacity: .45; }
.sp-l { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .1rem .6rem; font-size: .84rem; font-weight: 600; color: var(--ink); }
.sp-l small { font-size: .74rem; font-weight: 400; color: var(--ink-3); }
.sp-link { font-size: .74rem; font-weight: 600; color: var(--brand-700); text-decoration: underline; text-underline-offset: 2px; }
.sp-ctl input[type="range"] { width: 100%; accent-color: var(--brand-600); }
.sp-scale { display: flex; justify-content: space-between; gap: .5rem; }
.sp-scale small { font-size: .68rem; color: var(--ink-3); }
.sp-inks { display: flex; flex-wrap: wrap; gap: .4rem; }
.sp-inks button { display: inline-flex; align-items: center; gap: .4rem; height: 2rem; padding: 0 .75rem; border-radius: 999px; border: 1.5px solid var(--line-2); background: #fff; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.sp-inks button i { width: .85rem; height: .85rem; border-radius: 999px; }
.sp-inks button i.orig { background: conic-gradient(#162a96, #111114, #64748b, #162a96); }
.sp-inks button[aria-pressed="true"] { border-color: var(--brand-600); background: var(--brand-50); color: var(--brand-800); }
.sp-warn { padding: .5rem .7rem; border-radius: .7rem; font-size: .78rem; line-height: 1.5; background: #fffbeb; border: 1px solid #fde68a; color: #78350f; }
.sp-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; padding: .8rem 1.25rem; border-top: 1px solid var(--line); background: #fbfcfe; }
.sp-btns { display: flex; gap: .5rem; margin-left: auto; }
@media (max-width: 640px) {
  .sp-ov { padding: 0; align-items: stretch; }
  .sp-box { border-radius: 0; }
  .sp-body { padding: .9rem 1rem; }
  .sp-prev { --ph: 7.5rem; }
}
.sp-contact { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-top: .6rem; font-size: .8rem; color: var(--ink-2); }
.sp-contact > * { display: inline-flex; align-items: center; gap: .35rem; }
.sp-contact i { color: var(--ink-4); font-size: .75rem; }
.sp-contact a:hover { color: var(--brand-700); text-decoration: underline; }
.sp-contact small { color: var(--ink-3); }

/* หน้าต่างอัปโหลดเล่มรายงาน SAR (popup) */
.up-box { display: flex; flex-direction: column; width: min(580px, 100%); max-height: min(92vh, 100%); background: #fff; border-radius: 1rem; overflow: hidden; box-shadow: 0 24px 60px rgba(15, 23, 42, .35); }
.up-ic { background: var(--brand-50); color: var(--brand-600); }
.up-body { display: grid; gap: .9rem; padding: 1.1rem 1.25rem 1.25rem; overflow: auto; }
.up-cur { display: flex; align-items: center; gap: .7rem; padding: .65rem .8rem; border-radius: .8rem; background: #f8fafc; border: 1px solid var(--line); font-size: .82rem; }
.up-cur > i { color: var(--ink-3); }
.up-cur b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-cur small { display: block; font-size: .72rem; color: var(--ink-3); }
.up-drop { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 2rem 1rem; border: 2px dashed #b7d3f6; border-radius: 1rem; background: #f8fbff; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.up-drop:hover, .up-drop.drag, .up-drop:focus-within { border-color: var(--brand-500); background: var(--brand-50); }
.up-drop > i { font-size: 2.4rem; color: var(--brand-500); }
.up-drop b { font-size: .98rem; color: var(--ink); }
.up-drop span { font-size: .85rem; color: var(--ink-2); }
.up-drop u { color: var(--brand-700); font-weight: 600; }
.up-drop small { font-size: .74rem; color: var(--ink-3); }
.up-sel { display: flex; align-items: center; gap: .8rem; padding: .85rem; border-radius: .9rem; border: 1px solid #b7d3f6; background: var(--brand-50); }
.up-sel .fi { width: 2.6rem; height: 2.6rem; flex-shrink: 0; display: grid; place-items: center; border-radius: .7rem; background: #fee2e2; color: #b91c1c; font-size: 1.2rem; }
.up-sel .fi.img { background: #e0f2fe; color: #0369a1; }
.up-sel b { display: block; font-size: .88rem; overflow-wrap: anywhere; }
.up-sel small { font-size: .74rem; color: var(--ink-3); }
.up-prog { height: 10px; border-radius: 999px; background: var(--viz-track); overflow: hidden; }
.up-prog > div { height: 100%; border-radius: 999px; background: var(--s1); transition: width .2s; }
.up-pct { display: flex; justify-content: space-between; margin-top: .4rem; font-size: .8rem; color: var(--ink-2); }
.up-links { font-size: .8rem; color: var(--ink-2); }
.up-lv { display: inline-flex; align-items: center; gap: .35rem; margin: .35rem .35rem 0 0; padding: .2rem .6rem; border-radius: 999px; background: #ecfdf3; color: #166534; border: 1px solid #bbf7d0; font-size: .74rem; font-weight: 600; }
.up-lv small { font-weight: 500; opacity: .8; }
.up-err { padding: .55rem .75rem; border-radius: .6rem; background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; font-size: .82rem; }
.up-done { padding: .4rem 0; text-align: center; }
.up-done > i { font-size: 2.8rem; color: #15803d; }
.up-done b { display: block; margin-top: .4rem; font-size: 1.05rem; color: var(--ink); }
.up-done p { margin-top: .2rem; font-size: .84rem; color: var(--ink-2); overflow-wrap: anywhere; }
.up-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; padding: .8rem 1.25rem; border-top: 1px solid var(--line); background: #f8fafc; }
.up-cta { display: flex; flex-direction: column; align-items: center; gap: .3rem; width: 100%; padding: 1.5rem 1rem; border: 2px dashed var(--line-2); border-radius: .9rem; background: rgba(248, 250, 252, .6); text-align: center; transition: border-color .15s, background .15s; }
.up-cta:hover, .up-cta.drag, .up-cta:focus-visible { border-color: var(--brand-400); background: var(--brand-50); outline: none; }
.up-cta > i { font-size: 1.9rem; color: var(--brand-500); }
.up-cta b { font-size: .9rem; color: var(--brand-700); }
.up-cta span { font-size: .75rem; color: var(--ink-3); }
@media (max-width: 640px) { .up-box { width: 100%; height: 100%; max-height: none; border-radius: 0; } .up-body { flex: 1 1 auto; align-content: start; } }

/* ---------- หัวข้อที่ต้องกรอก: คำชี้แจง + เน้นสีแดงหลังกดส่งรายงานแล้วยังไม่ครบ ---------- */
.req-note { display: flex; align-items: center; gap: .55rem; padding: .65rem .9rem; border-radius: .85rem; font-size: .82rem; color: var(--ink-2); background: #fff; border: 1px dashed #fda4af; }
.req-note > i { flex-shrink: 0; font-size: .7rem; color: #e11d48; }
.fld.is-miss { border-color: #f43f5e !important; background-color: #fff7f8; box-shadow: 0 0 0 3px rgba(244, 63, 94, .12); }
.issue.is-miss { border-left-color: #f43f5e; }
[data-grp].is-miss .grp-h { color: #e11d48; }
[data-grp].is-miss .grp-b { border-radius: .7rem; background: #fff7f8; box-shadow: inset 0 0 0 1.5px #fecdd3; }
[data-grp].is-miss .grp-b::after { content: attr(data-hint); display: block; padding: .15rem .65rem .4rem; font-size: .72rem; font-weight: 600; color: #e11d48; }
[data-swot].is-miss .swot-h { color: #e11d48 !important; }
[data-swot].is-miss .swot-h::after { content: ' — เลือกประเด็นหรือเขียนรายละเอียด'; font-size: .76rem; font-weight: 500; }
[data-swot].is-miss textarea { border-color: #fda4af; }
.inp-row.is-miss legend { color: #e11d48; }
/* แบบสังเคราะห์ IQA: ช่องที่ค่าตรงกับรายงาน SAR ฉบับสมบูรณ์ (แถบสีน้ำเงินด้านซ้าย เหมือน .fld.from-sys) + หน้าต่างปรับค่าที่ไม่ตรงกัน */
.inp-row { position: relative; }
.inp-row.from-sys::before { content: ''; position: absolute; left: -.6rem; top: .8rem; bottom: .8rem; width: 3px; border-radius: 2px; background: var(--brand-500); }
.doc-legend { display: inline-flex; align-items: center; gap: .35rem; margin-left: .35rem; font-size: .76rem; opacity: .85; white-space: nowrap; }
.doc-legend > i { display: inline-block; width: 3px; height: .95rem; border-radius: 2px; background: var(--brand-500); }
@media (max-width: 640px) { .doc-legend { display: flex; margin: .2rem 0 0; white-space: normal; } }
.docdiff-opt { display: flex; align-items: flex-start; gap: .55rem; padding: .6rem .75rem; margin-bottom: .6rem; border-radius: .7rem; border: 1px solid #fde68a; background: #fffbeb; color: #78350f; font-size: .84rem; line-height: 1.5; text-align: left; cursor: pointer; }
.docdiff-opt input { margin-top: .25rem; width: 1rem; height: 1rem; flex-shrink: 0; accent-color: var(--brand-600); }
.docdiff-opt small { display: block; font-size: .74rem; opacity: .8; }
.docdiff-list { display: grid; gap: .3rem; max-height: 18rem; overflow: auto; text-align: left; }
.docdiff-list > div { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .2rem .9rem; padding: .45rem .65rem; border-radius: .6rem; border: 1px solid var(--line); background: #fff; font-size: .8rem; line-height: 1.45; color: var(--ink-2); }
.docdiff-list > div > span:last-child { display: inline-flex; align-items: baseline; gap: .45rem; margin-left: auto; white-space: nowrap; }
.docdiff-list s { color: var(--ink-3); }
.docdiff-list b { color: var(--brand-700); }
.docdiff-list i { font-size: .65rem; color: var(--ink-3); }
.inp-row.is-miss legend::after { content: ' — ยังไม่ได้เลือกระดับ'; font-size: .76rem; font-weight: 500; }
#sec-file.is-miss .up-cta { border-color: #fb7185; background: #fff7f8; }
#sec-file.is-miss .up-cta b { color: #e11d48; }
.flash { animation: flash-miss 1.4s ease-out; }
@keyframes flash-miss { 0%, 30% { box-shadow: 0 0 0 4px rgba(244, 63, 94, .35); } 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); } }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; } }
/* หน้าต่างรายการที่ยังขาด */
.miss-list { display: grid; gap: .3rem; max-height: 22rem; overflow: auto; text-align: left; }
.miss-sec { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .55rem; padding: 0 .15rem; font-size: .8rem; color: var(--ink); }
.miss-sec:first-child { margin-top: 0; }
.miss-sec span { min-width: 1.5rem; padding: 0 .45rem; border-radius: 999px; font-size: .7rem; font-weight: 700; text-align: center; color: #be123c; background: #ffe4e6; }
.miss-item { display: flex; align-items: flex-start; gap: .5rem; width: 100%; padding: .45rem .65rem; border-radius: .6rem; border: 1px solid var(--line); background: #fff; font-size: .8rem; line-height: 1.45; text-align: left; color: var(--ink-2); }
button.miss-item[data-miss] { cursor: pointer; }
button.miss-item[data-miss]:hover { border-color: #fda4af; background: #fff7f8; }
.miss-item > i:first-child { flex-shrink: 0; margin-top: .22rem; font-size: .75rem; color: #e11d48; }
.miss-item .go { flex-shrink: 0; margin-left: auto; margin-top: .22rem; font-size: .7rem; color: var(--ink-4); }
.miss-more { padding: .15rem .65rem; font-size: .74rem; color: var(--ink-3); }

/* จัดทำรายงานการประเมินตนเอง (SAR) ฉบับสมบูรณ์ (sar_doc.php · assets/sardoc.js) */
.sd-hint { padding: .55rem .8rem; border-radius: .8rem; background: #fff; border: 1px dashed var(--brand-200); font-size: .78rem; }
.sd-h3 { font-size: .95rem; font-weight: 700; color: var(--brand-800); margin-top: .35rem; padding-bottom: .3rem; border-bottom: 2px solid var(--brand-100); }
.sd-h3 > span.block { color: var(--ink-3); }
.sd-h4 { font-size: .84rem; font-weight: 700; color: var(--ink-2); }
.sd-box { border: 1px solid var(--line); border-radius: .9rem; padding: .9rem 1rem; background: #fff; }
.sd-sub { font-weight: 600; font-size: .85rem; color: var(--brand-700); margin-top: .7rem; }
.sd-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 16rem); gap: .4rem .9rem; align-items: center; padding: .22rem 0; }
.sd-row:has(> .sd-row-n) { grid-template-columns: auto minmax(0, 1fr); }
.sd-row-l, .sd-row-n { font-size: .85rem; }
.sd-row-n { white-space: nowrap; color: var(--ink-3); }
.sd-row-sub { padding-left: 1.5rem; }
.sd-tw { overflow: auto; }
.sd-tbl { width: 100%; border-collapse: collapse; font-size: .82rem; }
.sd-tbl th, .sd-tbl td { border: 1px solid var(--line-2); padding: .3rem .4rem; vertical-align: middle; }
.sd-tbl th { background: #f1f5fb; font-weight: 600; font-size: .74rem; color: var(--ink-2); text-align: center; white-space: normal; }
.sd-tbl td.c, .sd-tbl th.c { text-align: center; }
.sd-tbl tr.g td { background: #f8fafc; font-weight: 600; }
.sd-tbl tr.g2 td { background: #eef2f7; font-weight: 700; }
.sd-tbl tr.sub td { font-weight: 600; color: var(--brand-700); }
.sd-tbl td.sd-il { padding-left: 1rem; }
.sd-tbl .sd-small { font-size: .72rem; }
.sd-tbl th.sd-rot { font-size: .68rem; min-width: 4.4rem; }
.sd-tbl textarea.fld { font-size: .8rem; min-height: 2.2rem; padding: .35rem .5rem; }
.sd-n { height: 2rem; padding: 0 .4rem; text-align: right; min-width: 4.4rem; width: 100%; font-variant-numeric: tabular-nums; }
.sd-n.sd-xs { min-width: 3.6rem; }
.sd-calc { color: var(--ink-3); font-variant-numeric: tabular-nums; background: #fafbfd; white-space: nowrap; }
.sd-tbl td.sd-dark { background: #334155; }
.sd-yr { height: 1.8rem; width: 4.6rem; text-align: center; margin: 0 auto; font-weight: 700; font-size: .8rem; }
.sd-sum, .sd-lv { height: 2rem; font-size: .78rem; min-width: 8.5rem; padding: 0 .4rem; }
.sd-nat td { padding: .18rem .22rem; }
.sd-nat .sd-n.sd-xs { min-width: 3rem; padding: 0 .25rem; }
.sd-nat .sd-sum { min-width: 6.5rem; }
.sd-tbl textarea.fld { min-width: 11rem; }
.sd-issue { border: 1px solid var(--line); border-left: 4px solid var(--brand-200); border-radius: .9rem; padding: .75rem .9rem; background: #fff; }
.sd-issue-h { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .88rem; margin-bottom: .5rem; line-height: 1.4; }
.sd-issue-h b { color: var(--brand-700); }
.sd-it { width: 100%; border-collapse: collapse; font-size: .82rem; }
.sd-it td { border: 1px solid var(--line); padding: .35rem .5rem; vertical-align: top; }
.sd-it td.sd-il { width: 38%; background: #fbfcfe; }
.sd-it tr.g td { background: #eef3fa; font-weight: 600; color: var(--brand-800); }
.sd-pr { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); align-items: center; gap: .3rem; margin: .15rem 0; }
.sd-pr span { font-size: .76rem; color: var(--ink-3); }
.sd-pr .fld { height: 2rem; font-size: .82rem; }
.sd-rr { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: flex-end; }
.sd-rr label { display: flex; flex-direction: column; gap: .15rem; font-size: .72rem; color: var(--ink-3); }
.sd-rr label .fld { width: 6.5rem; }
.sd-rr label select.fld { width: 9.5rem; }
.sd-rr label small { font-size: .68rem; }
/* ผลการบรรลุ: คำนวณอัตโนมัติ (ไม่มีช่องให้เลือก) */
.sd-rr-ok { display: flex; flex-direction: column; gap: .15rem; font-size: .72rem; color: var(--ink-3); }
.sd-okv { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; min-height: 1.9rem; padding: .15rem .65rem; border-radius: .6rem; background: #f1f5f9; color: var(--ink-3); font-size: .78rem; font-weight: 500; white-space: nowrap; }
.sd-okv.ok-y { background: #ecfdf3; color: #15803d; font-weight: 700; }
.sd-okv.ok-n { background: #fff1f2; color: #be123c; font-weight: 700; }
.sd-okbox { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
/* ปุ่ม "บันทึก" (ฉบับสมบูรณ์) ขณะช่องบังคับยังไม่ครบ: สีเทา + กุญแจ (กดแล้วแสดงรายการที่ขาด ไม่บันทึก) */
.btn.is-locked, .btn.is-locked:hover { background: #e2e8f0; border-color: #e2e8f0; color: #64748b; box-shadow: none; cursor: not-allowed; }
.btn.is-locked:active { transform: none; }
.sd-savecap { margin: 0; font-size: .72rem; line-height: 1.5; text-align: center; color: var(--ink-3); }
.sd-savecap.ok { color: #15803d; }
.sd-savecap .fa-lock { color: #94a3b8; }
/* ความพร้อมด้านปัจจัยนำเข้า (ภาคผนวก): รายการ + ระดับ · สรุปผลการวิเคราะห์ */
.sd-inputs { display: grid; }
.sd-incat { margin-top: .55rem; font-size: .82rem; font-weight: 700; color: var(--brand-700); }
.sd-inrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 26rem); gap: .3rem .8rem; align-items: center; padding: .32rem 0; border-bottom: 1px solid #f1f5f9; }
.sd-inl { font-size: .85rem; }
@media (max-width: 760px) { .sd-inrow { grid-template-columns: 1fr; } }
/* ระดับความพร้อมด้านปัจจัยนำเข้า: กด/แตะช่องแล้วเปิดหน้าต่างเลือก (inPick ใน sardoc.js) — ช่องเลือกเดิมไม่รับเมาส์/นิ้วเอง ให้ตัวครอบรับแทน (แป้นพิมพ์ยังโฟกัสช่องได้) */
.sd-inpick { display: block; min-width: 0; }
.sd-inpick[data-act] { cursor: pointer; }
.sd-inpick[data-act] > select { pointer-events: none; }
.sd-inpick[data-act]:hover > select { border-color: var(--brand-500); }
.sd-inpop { text-align: left; }
.sd-inpop-cat { font-size: .8rem; font-weight: 700; color: var(--brand-700); }
.sd-inpop-h { font-size: 1rem; font-weight: 700; color: var(--ink); line-height: 1.45; margin-bottom: .75rem; }
.sd-inpop-opts { display: grid; gap: .55rem; }
.sd-inopt { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); gap: .8rem; align-items: center; width: 100%; padding: .7rem .85rem; border: 1.5px solid var(--line-2); border-radius: .9rem; background: #fff; text-align: left; font: inherit; cursor: pointer; transition: border-color .12s, background .12s, box-shadow .12s; }
.sd-inopt > b { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: .7rem; font-size: 1.1rem; }
.sd-inopt.lv3 > b { background: #dcfce7; color: #166534; }
.sd-inopt.lv2 > b { background: #fef3c7; color: #92400e; }
.sd-inopt.lv1 > b { background: #ffe4e6; color: #9f1239; }
.sd-inopt strong { display: block; font-size: .9rem; color: var(--ink); }
.sd-inopt strong i { margin-left: .3rem; color: var(--brand-600); }
.sd-inopt em { display: block; font-style: normal; font-size: .88rem; line-height: 1.5; color: var(--ink-2); }
.sd-inopt:hover, .sd-inopt:focus-visible { border-color: var(--brand-500); background: var(--brand-50); outline: none; }
.sd-inopt:focus-visible { box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .18); }
.sd-inopt.on { border-color: var(--brand-600); background: var(--brand-50); }
.sd-inpop-clear { display: block; margin: .8rem auto 0; padding: .2rem .4rem; border: 0; background: none; font-size: .8rem; color: var(--ink-3); text-decoration: underline; cursor: pointer; }
.sd-effsum { padding: .6rem .8rem; border-radius: .7rem; background: #f8fafc; border: 1px solid var(--line); font-size: .82rem; line-height: 1.7; color: var(--ink-2); }
.sd-effsum > i { color: var(--brand-600); margin-right: .2rem; }
.sd-effsum .y { color: #15803d; }
.sd-effsum .n { color: #be123c; }/* ช่องตัวเลข: ค่าไม่ถูกต้อง = กรอบแดง · พิมพ์อักษรที่ไม่ใช่ตัวเลข = สั่นเตือน */
.fld.is-bad { border-color: #f43f5e; background-color: #fff7f8; }
@keyframes numBad { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.fld.num-bad { animation: numBad .22s ease-in-out 2; border-color: #f43f5e; }
@media (prefers-reduced-motion: reduce) { .fld.num-bad { animation: none; } }.sd-det summary { cursor: pointer; font-size: .8rem; color: var(--brand-700); font-weight: 600; }
.sd-auto { font-size: .82rem; color: var(--ink-2); background: #f8fafc; border-radius: .6rem; padding: .5rem .7rem; margin: .4rem 0; line-height: 1.6; }
.sd-tgs { --tg-cols: minmax(0, 1fr) 6rem 10.5rem; border: 1px solid var(--line); border-radius: .75rem; overflow: hidden; font-size: .84rem; }
.sd-tgs.no-pct { --tg-cols: minmax(0, 1fr) 10.5rem; }
.sd-tg-h, .sd-tg { display: grid; grid-template-columns: var(--tg-cols); gap: .25rem .75rem; align-items: center; padding: .35rem .75rem; }
.sd-tg-h { background: #f1f5f9; font-size: .74rem; font-weight: 700; color: var(--ink-3); padding-top: .45rem; padding-bottom: .45rem; }
.sd-tg-h span + span { text-align: center; }
.sd-tg-sub { padding: .4rem .75rem; background: #f8fafc; border-top: 1px solid var(--line); font-size: .8rem; font-weight: 700; color: var(--brand-700, #1d4ed8); }
.sd-tg { border-top: 1px solid var(--line); }
.sd-tg:hover, .sd-tg:focus-within { background: #f8fafc; }
.sd-tg-l { line-height: 1.5; padding-left: 3.6rem; text-indent: -3.6rem; }   /* บรรทัดที่ตัดลงมาเยื้องตรงกับข้อความ ไม่ไปอยู่ใต้ป้ายเลขประเด็น */
.sd-tg-no { display: inline-block; width: 3.1rem; text-indent: 0; margin-right: .5rem; padding: 0 .4rem; border-radius: .4rem; background: #e2e8f0; color: var(--ink-2, #334155); font-size: .74rem; font-weight: 700; text-align: center; white-space: nowrap; }
.sd-tg-c { display: block; min-width: 0; }
.sd-tg-c .fld { height: 2.1rem; width: 100%; min-width: 0; font-size: .82rem; }
.sd-tg-c .sd-n { text-align: center; }
.sd-tg-h small { font-weight: 400; }
/* ระดับคุณภาพที่คำนวณจากร้อยละ: ล็อกไว้ (แก้ที่ช่องร้อยละ) */
select.fld.sd-lv-auto { background-color: #f1f5f9; color: var(--ink-2, #334155); opacity: 1; cursor: not-allowed; }
.sd-tg-na { display: block; text-align: center; color: var(--ink-4, #94a3b8); }
@media (max-width: 640px) {
  .sd-tg-h { display: none; }
  .sd-tg { grid-template-columns: 1fr 1fr; }
  .sd-tgs.no-pct .sd-tg { grid-template-columns: 1fr; }
  .sd-tg-l { grid-column: 1 / -1; }
  .sd-tg-c::before { content: attr(data-l); display: block; font-size: .7rem; color: var(--ink-3); margin-bottom: .1rem; }
}
.sd-pl { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; font-size: .74rem; color: var(--ink-3); }
.sd-pl .sd-n { width: 4.6rem; min-width: 0; }
.sd-pl .sd-lv { min-width: 7.5rem; }
.sd-slot { border: 1px dashed var(--line-2); border-radius: .8rem; padding: .6rem; background: #fff; }
.sd-slot-l { font-size: .78rem; font-weight: 600; color: var(--ink-2); margin-bottom: .4rem; }
.sd-slot-b { display: flex; gap: .7rem; align-items: flex-start; }
.sd-slot-c { flex: 1; min-width: 0; display: grid; gap: .4rem; }
.sd-img, .sd-img-wide { width: 6rem; height: 6rem; object-fit: contain; border: 1px solid var(--line); border-radius: .5rem; background: #fff; flex-shrink: 0; }
.sd-img-wide { height: 8rem; }
.sd-img-empty { display: grid; place-items: center; color: var(--ink-4); font-size: 1.4rem; background: #f8fafc; }
.sd-nav { display: grid; gap: .1rem; }
.sd-nav a { display: flex; gap: .5rem; align-items: center; padding: .35rem .5rem; border-radius: .5rem; font-size: .78rem; color: var(--ink-2); line-height: 1.3; }
.sd-nav a i { width: 1rem; text-align: center; color: var(--ink-4); flex-shrink: 0; }
.sd-nav a:hover { background: #f4f6fa; }
.sd-nav a.cur { background: var(--brand-50); color: var(--brand-800); font-weight: 600; }
.sd-nav a.cur i { color: var(--brand-600); }
.sd-nav a .sd-nt { flex: 1; min-width: 0; }
/* สถานะความครบถ้วนรายส่วน: ครบถ้วน (เขียว) · บันทึกร่างไว้ (ส้ม) · ยังไม่เสร็จ (แดง) — สีเดียวกับแถบสถานะหน้าหลักสถานศึกษา */
.sd-ns { display: inline-grid; place-items: center; width: 1.15rem; flex-shrink: 0; font-size: .95rem; line-height: 1; }
.sd-nav a .sd-ns { margin-left: auto; }
.sd-nav a .sd-ns i { color: inherit; width: auto; }
.sd-ns.ok { color: #15803d; }
.sd-ns.draft { color: #ea7a0c; }
.sd-ns.no { color: #d03b3b; }
.sd-navsum { font-size: .72rem; color: var(--ink-3); white-space: nowrap; }
.sd-navsum b { color: var(--ink); font-weight: 700; }
.sd-legend { display: flex; flex-wrap: wrap; gap: .25rem .7rem; margin: .45rem 0 .55rem; padding: .4rem .55rem; border-radius: .6rem; background: #f8fafc; font-size: .7rem; color: var(--ink-3); }
.sd-legend > span { display: inline-flex; align-items: center; gap: .25rem; }
.sd-legend .sd-ns { width: auto; font-size: .8rem; }
.sh-guide .sd-ns { width: auto; font-size: .85rem; vertical-align: -1px; }
.sd-sec .sec-head { flex-wrap: wrap; row-gap: .5rem; }
.sd-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .7rem; border-radius: 999px; border: 1px solid; font-size: .74rem; font-weight: 600; line-height: 1.3; white-space: nowrap; }
.sd-chip.ok { color: #166534; background: #ecfdf3; border-color: #bbf7d0; }
.sd-chip.draft { color: #9a3412; background: #fff4e6; border-color: #fed7aa; }
.sd-chip.no { color: #9f1239; background: #fff1f2; border-color: #fecdd3; }
button.sd-chip { cursor: pointer; transition: filter .15s; }
button.sd-chip:hover { filter: brightness(.96); }
.sd-chip .go { margin-left: .2rem; padding-left: .45rem; border-left: 1px solid currentColor; font-weight: 500; opacity: .85; }
@media (max-width: 640px) { .sd-chip .go { display: none; } }
@keyframes sdFlash { 0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); } 25%, 60% { box-shadow: 0 0 0 4px rgba(244, 63, 94, .45); } }
.sd-flash { animation: sdFlash 1.1s ease-in-out 2; border-color: #f43f5e !important; }
.sd-dashbar { display: flex; align-items: center; gap: .5rem; margin-bottom: .3rem; }
.sd-dashbar .btn { height: 1.7rem; font-size: .72rem; margin-left: auto; }
/* ช่องบังคับกรอก: ดาว * ที่ชื่อช่อง · ป้ายเหนือตาราง · หลังกด "เสร็จสมบูรณ์" แล้วยังไม่ครบ = เน้นช่องที่ขาดด้วยสีแดง (หายเมื่อกรอก) */
.req-t { color: #e11d48; font-weight: 500; }
.sd-star { margin-left: .2rem; font-weight: 700; }
.sd-reqbar { display: flex; margin-bottom: .3rem; }
.sd-reqtag { display: inline-flex; align-items: center; gap: .25rem; font-size: .72rem; color: var(--ink-3); }
.sd-reqtag .req { font-weight: 700; font-size: .85rem; }
.ck.is-miss { border-color: #fda4af; background: #fff7f8; }
.sd-slot.is-miss { border-color: #f43f5e; border-style: solid; background: #fff7f8; }
/* แกลเลอรีรูปของเอกสารแนบ (ภาคผนวก): การ์ดรูปแนวตั้งสัดส่วน A4 + ช่องเพิ่มรูป */
.sd-gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .8rem; padding: .25rem; margin: -.25rem; border-radius: .9rem; transition: background .15s, box-shadow .15s; }
.sd-gal.is-drop { background: var(--brand-50, #eef4fd); box-shadow: 0 0 0 2px var(--brand-600) inset; }
.sd-gal .sd-gal-i { position: relative; display: flex; flex-direction: column; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: .85rem; background: #fff; overflow: hidden; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); transition: box-shadow .15s, transform .15s; }
.sd-gal .sd-gal-i:hover { box-shadow: 0 6px 16px rgba(15, 23, 42, .12); transform: translateY(-1px); }
.sd-gal-v { display: block; width: 100%; aspect-ratio: 210 / 297; background: #f4f6fa; cursor: zoom-in; }
.sd-gal-v img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sd-gal-n { position: absolute; top: .45rem; left: .45rem; padding: .05rem .5rem; border-radius: 999px; background: rgba(15, 23, 42, .78); color: #fff; font-size: .7rem; font-weight: 600; pointer-events: none; }
.sd-gal-i figcaption { padding: .3rem .55rem .1rem; font-size: .7rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-gal-t { display: flex; align-items: center; gap: .1rem; padding: .15rem .3rem .3rem; }
.sd-gal-b { width: 1.9rem; height: 1.9rem; display: grid; place-items: center; border-radius: .5rem; color: var(--ink-2); font-size: .8rem; }
.sd-gal-b:hover:not(:disabled) { background: #eef1f6; color: var(--ink); }
.sd-gal-b:disabled { opacity: .28; cursor: default; }
.sd-gal-b.del { color: #e11d48; }
.sd-gal-b.del:hover:not(:disabled) { background: #fff1f2; color: #be123c; }
.sd-gal .sd-gal-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; min-height: 9rem; padding: .8rem; border: 2px dashed var(--line-2); border-radius: .85rem; background: #fafbfd; color: var(--brand-700); text-align: center; transition: background .15s, border-color .15s; }
.sd-gal .sd-gal-add:hover:not(:disabled) { background: var(--brand-50, #eef4fd); border-color: var(--brand-600); }
.sd-gal .sd-gal-add:disabled { cursor: progress; color: var(--ink-3); }
.sd-gal .sd-gal-add > i { font-size: 1.5rem; }
.sd-gal .sd-gal-add b { font-size: .85rem; }
.sd-gal .sd-gal-add small { font-size: .7rem; color: var(--ink-3); line-height: 1.35; }
.sd-gal.is-empty .sd-gal-add { grid-column: 1 / -1; min-height: 6.5rem; }
.sd-gal .sd-gal-add.is-miss { border-color: #f43f5e; background: #fff7f8; }
.sd-gal-none, .sd-gal-full { grid-column: 1 / -1; margin: 0; font-size: .8rem; color: var(--ink-3); }
.sd-gal-full { margin-top: .5rem; }
@media (max-width: 640px) { .sd-gal { grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); gap: .55rem; } .sd-gal-b { width: 1.7rem; height: 1.7rem; } }
.sd-box.is-miss { border-color: #f43f5e; box-shadow: 0 0 0 3px rgba(244, 63, 94, .12); }
/* วันที่: เลือก วัน / เดือน / ปี พ.ศ. */
.sd-date { display: grid; grid-template-columns: 4.4rem minmax(0, 1fr) 5.4rem; gap: .35rem; max-width: 24rem; }
.sd-date select.fld { padding-left: .6rem; padding-right: 1.2rem; }
.sd-date-raw { grid-column: 1 / -1; margin: 0; font-size: .72rem; color: #b45309; }
.sd-btns { display: grid; gap: .45rem; }
.fld.from-sys { border-left: 3px solid var(--brand-500); }
.fld.from-tpl { border-left: 3px solid #f59e0b; }
@media (max-width: 640px) { .sd-row { grid-template-columns: 1fr; } .sd-it td.sd-il { width: 42%; } .sd-pr { grid-template-columns: 1fr; } }

/* ---------- จัดทำรายงาน SAR (sar_doc.php): ทำทีละส่วน — เมนูส่วนของรายงานอยู่ซ้าย เนื้อหาอยู่ขวา แถบนำทาง/บันทึกคงที่ด้านล่าง ---------- */
.sd-page { padding-bottom: 6.5rem; }
.sd-layout { display: grid; gap: 1.25rem; align-items: start; }
.sd-side { order: 2; }
.sd-main { order: 1; }
@media (min-width: 1024px) {
  .sd-layout { grid-template-columns: 304px minmax(0, 1fr); gap: 1.5rem; }
  .sd-side { order: 0; position: sticky; top: calc(var(--topbar-h) + 16px); max-height: calc(100vh - var(--topbar-h) - 6.5rem); overflow-y: auto; scrollbar-width: thin; }
  .sd-main { order: 0; }
}
/* ทีละส่วน: ซ่อนส่วนที่ไม่ได้เลือก (ยังอยู่ในหน้า — ตรวจช่องบังคับและบันทึกทั้งเล่มได้) */
#sd-root.sd-step > .sd-sec:not(.is-cur) { display: none; }
#sd-root.sd-step > .sd-sec.is-cur { margin-top: 0; }
#sd-root:not(.sd-step) .sd-secnav { display: none; }
.sd-secnav { display: flex; justify-content: space-between; align-items: stretch; gap: .75rem; padding: .9rem 1.25rem; border-top: 1px solid var(--line); background: #f8fafc; }
.sd-secnav-b { height: auto; min-height: 2.9rem; padding: .4rem .9rem; gap: .65rem; text-align: left; max-width: 48%; }
.sd-secnav-b.next { margin-left: auto; text-align: right; }
.sd-secnav-b > span { display: grid; min-width: 0; font-size: .84rem; line-height: 1.3; }
.sd-secnav-b small { font-size: .68rem; font-weight: 400; opacity: .8; }
.sd-secnav-end { margin-left: auto; align-self: center; font-size: .82rem; color: var(--ink-3); }
/* สัญลักษณ์ของช่องกรอก (บรรทัดเดียวเหนือเนื้อหา) */
.sd-keys { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; margin-bottom: .9rem; padding: .5rem .85rem; border-radius: .8rem; background: #fff; border: 1px solid var(--line); font-size: .76rem; color: var(--ink-3); }
.sd-keys > span { display: inline-flex; align-items: center; gap: .35rem; }
.sd-keys .k { width: 4px; height: 1rem; border-radius: 2px; }
.sd-keys .k.sys { background: var(--brand-600); }
.sd-keys .k.tpl { background: #e5a50a; }
/* เมนูส่วนของรายงาน */
.sd-prog { height: 6px; margin: .5rem 0 .1rem; border-radius: 999px; background: #e8edf4; overflow: hidden; }
.sd-prog > i { display: block; height: 100%; width: 0; border-radius: inherit; background: #16a34a; transition: width .3s; }
.sd-nav a { padding: .42rem .5rem; }
.sd-nn { flex-shrink: 0; width: 1.35rem; height: 1.35rem; border-radius: .4rem; display: grid; place-items: center; font-size: .7rem; font-weight: 700; color: var(--ink-3); background: #eef1f6; }
.sd-nav a.cur { box-shadow: inset 3px 0 0 var(--brand-600); }
.sd-nav a.cur .sd-nn { color: #fff; background: var(--brand-600); }
.sb-prog .sd-savecap { margin-top: .65rem; padding-top: .65rem; border-top: 1px solid var(--line); text-align: left; }
.sb-actions .sd-savecap { margin-top: 0; padding-top: 0; border-top: 0; text-align: center; }   /* ใต้ปุ่มส่งรายงานของแบบสังเคราะห์ IQA */
.sd-mode { display: flex; align-items: center; justify-content: center; gap: .4rem; width: 100%; margin-top: .6rem; padding: .35rem; border-radius: .5rem; font-size: .74rem; color: var(--ink-3); }
.sd-mode:hover { background: #f4f6fa; color: var(--ink); }
/* หัวข้อย่อยของส่วนที่เปิดอยู่ (ใต้รายการในเมนู) */
.sd-subnav { display: grid; gap: .15rem; margin: .2rem 0 .5rem .65rem; padding: .3rem 0 .3rem .5rem; border-left: 2px solid var(--brand-200, #b9d4f5); }
.sd-nav a:not(.cur) + .sd-subnav, .sd-subnav:empty { display: none; }
/* หัวข้อย่อย: ป้ายเลข (11.1) + ชื่อเต็ม ตัวหนังสือเข้ม แยกเป็นรายการชัดเจน */
.sd-nav .sd-subnav a { display: flex; align-items: flex-start; gap: .45rem; padding: .34rem .45rem; border-radius: .5rem; font-size: .78rem; font-weight: 500; line-height: 1.45; color: var(--ink-2); }
.sd-nav .sd-subnav a:hover { background: var(--brand-50); color: var(--brand-800); }
.sd-sn { flex-shrink: 0; min-width: 2.1rem; margin-top: .08rem; padding: 0 .3rem; border-radius: .35rem; background: var(--brand-50); border: 1px solid var(--brand-200, #b9d4f5); font-size: .68rem; font-weight: 700; line-height: 1.5; text-align: center; color: var(--brand-700); white-space: nowrap; }
.sd-nav .sd-subnav a:hover .sd-sn { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.sd-st { flex: 1; min-width: 0; }
/* หัวข้อย่อยระดับ 3 (เช่น เอกสารแนบแต่ละประเภท 11.3.1): เยื้องเข้าไปอีกขั้น ตัวเล็กลงเล็กน้อย */
.sd-nav .sd-subnav a.l3 { margin-left: 1.05rem; padding-top: .24rem; padding-bottom: .24rem; font-size: .75rem; font-weight: 400; border-left: 2px solid var(--line); border-radius: 0 .5rem .5rem 0; }
.sd-nav .sd-subnav a.l3 .sd-sn { min-width: 2.7rem; background: #fff; border-color: var(--line); color: var(--ink-2); }
/* 6.2 ผลการประเมินคุณภาพภายใน (ปีที่ผ่านมา): การ์ดละระดับ วางคู่กันบนจอกว้าง */
.sd-iqa2 { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 900px) { .sd-iqa2 { grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); } }
.sd-iqa { min-width: 0; }
.sd-iqa-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .5rem; margin-bottom: .5rem; }
.sd-iqa-h > i { color: var(--brand-600); font-size: .9rem; }
.sd-iqa-h > h4 { font-size: .92rem; font-weight: 700; color: var(--ink); }
.sd-iqa-h > small { font-size: .74rem; color: var(--ink-3); }
.sd-iqa .sd-tg-no { width: 1.7rem; }
.sd-iqa .sd-tg-l { padding-left: 2.2rem; text-indent: -2.2rem; }
.sd-tg.sum { background: #f4f7fb; font-weight: 700; }
.sd-tg.sum .sd-tg-l { padding-left: 0; text-indent: 0; }
.sd-tg.sum select { font-weight: 700; }
.sd-auto-note { display: block; font-size: .7rem; font-weight: 400; color: var(--ink-3); }
/* สรุปผลการทดสอบระดับชาติที่คำนวณอัตโนมัติ: ป้ายผล (แทนช่องเลือก) */
.sd-natsum { display: block; padding: .3rem .2rem; font-size: .82rem; font-weight: 700; line-height: 1.35; text-align: center; }
.sd-natsum.y { color: #166534; }
.sd-natsum.n { color: #9f1239; }
/* เอกสารแนบท้ายประกาศ (ระดับที่ใช้แม่แบบของเขต — ตาราง .sd-ann): ช่อง “เป้าหมายความสำเร็จ” แก้ไขไม่ได้ ระบบเขียนให้ (goalSync)
   — ส่วนที่เปลี่ยนตามค่าเป้าหมายของแถวเป็นตัวหนา · ยังไม่ได้กรอก = สีส้ม · แถว gs = ประเด็นหลัก 1.1 / 1.2 */
.sd-tbl td.sd-goalc { background: #f8fafc; vertical-align: top; }
.sd-goal { padding: .3rem .35rem; font-size: .82rem; line-height: 1.55; color: var(--ink-2); min-width: 14rem; }
.sd-goal-v { font-weight: 700; color: var(--brand-700); }
/* ร้อยละในข้อความเป้าหมายของมาตรฐานที่ 2–3: ปุ่มกดแก้ไข (เปิด partsPopup) — ตัวหนาขีดเส้นใต้ */
.sd-goal-edit { font: inherit; font-weight: 700; color: var(--brand-700); background: var(--brand-50); border: 0; border-bottom: 1.5px dashed var(--brand-500); border-radius: .25rem .25rem 0 0; padding: 0 .25rem; cursor: pointer; }
.sd-goal-edit:hover, .sd-goal-edit:focus-visible { background: var(--brand-100, #dbeafe); outline: none; box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .2); }
.sd-goal-v.wait { color: #b45309; background: #fef3c7; border-radius: .25rem; padding: 0 .2rem; }
.sd-tbl tr.gs td:first-child { font-weight: 600; color: var(--brand-700); }
/* ช่องร้อยละของแถวที่กรอกรายข้อ (กดแล้วเปิด popup — partsPopup) และหน้าต่างกรอกรายข้อ */
.fld.sd-parts { cursor: pointer; background: #fff; color: var(--ink); }   /* หน้าตาเหมือนช่องร้อยละช่องอื่นทุกประการ (ไม่ใช้สีของช่อง readonly) */
.sd-parts-pop { text-align: left; font-size: .9rem; }
.sd-parts-pop .sd-parts-h { font-weight: 700; color: var(--ink); margin-bottom: .2rem; }
.sd-parts-pop .hint { margin-bottom: .7rem; }
.sd-parts-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .75rem; padding: .45rem 0; border-top: 1px solid var(--line); }
.sd-parts-row > span:first-child { line-height: 1.45; color: var(--ink-2); }
.sd-parts-in { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; font-size: .82rem; color: var(--ink-3); }
.sd-parts-in .fld { width: 5.5rem; min-width: 0; height: 2.3rem; }
.sd-parts-avg { margin-top: .6rem; padding: .55rem .75rem; border-radius: .7rem; background: var(--brand-50); color: var(--ink); text-align: center; }
.sd-parts-avg.wait { background: #fffbeb; color: #b45309; }
.sd-ann td:first-child { min-width: 10rem; }   /* จอแคบ (ตารางเลื่อนแนวนอน): ชื่อประเด็นไม่ถูกบีบจนอ่านยาก */
/* ชื่อระดับชั้นแบบเต็มในตารางข้อมูลนักเรียน: ไม่ตัดบรรทัดกลางชื่อ */
.sd-tbl td.sd-cls { white-space: nowrap; }
/* ตาราง 2) ข้อมูลนักเรียน: คอลัมน์ “ระดับชั้นเรียน” กว้างที่สุด ช่องตัวเลข 3 คอลัมน์กว้างเท่ากัน (ระดับชั้น 30 · ห้อง 17 · ชาย 17 · หญิง 17 · รวม 8 · เฉลี่ย 11)
   — จอแคบที่ตารางเลื่อนแนวนอน ใช้ความกว้างตามเนื้อหาเหมือนเดิม */
.sd-stu thead tr:first-child th:nth-child(1) { width: 30%; }
.sd-stu thead tr:first-child th:nth-child(2) { width: 17%; }
.sd-stu thead tr:first-child th:nth-child(3) { width: 34%; }
.sd-stu thead tr:first-child th:nth-child(4) { width: 8%; }
.sd-stu thead tr:first-child th:nth-child(5) { width: 11%; }
/* ช่องข้อความหลายบรรทัดของหน้าจัดทำรายงาน: สูงตามเนื้อหา (taFit ใน sardoc.js) — จึงไม่มีแถบเลื่อนในช่อง และไม่ต้องลากมุมปรับขนาดเอง */
#sd-root textarea.fld { resize: none; overflow: hidden; }
#f-root textarea.fld { resize: none; overflow: hidden; }   /* แบบสังเคราะห์ IQA: เช่นเดียวกัน (taFit ใน form.js) */
/* ช่องข้อความยาวลงไปถึงขอบล่างของจอได้: เมื่อเบราว์เซอร์เลื่อนหน้าตามเคอร์เซอร์/ช่องที่โฟกัส ให้หยุดเหนือแถบล่าง (.sd-bar สูง 59px) ไม่ใช่ใต้แถบ */
html:has(#sd-bar) { scroll-padding-bottom: 5rem; }
/* ปีการศึกษาของตารางผลการทดสอบระดับชาติ (กำหนดตามปีของรายงาน ไม่ต้องพิมพ์) */
.sd-yrt { display: inline-block; padding: .1rem .2rem; font-size: .9rem; font-weight: 700; color: var(--ink); }
/* ผลต่างของคะแนนเฉลี่ย: +x.xx สีเขียว · −x.xx สีแดง */
.sd-tbl td.sd-calc.sd-up { color: #15803d; font-weight: 600; }
.sd-tbl td.sd-calc.sd-down { color: #be123c; font-weight: 600; }
/* สีพื้นเต็มทั้งช่องตารางของสรุปผล */
.sd-tbl td.sd-natcell-y { background: #dcfce7; vertical-align: middle; }
.sd-tbl td.sd-natcell-n { background: #ffe4e6; vertical-align: middle; }
/* หัวข้อของเอกสารแนบแต่ละประเภทในเนื้อหา */
.sd-att { scroll-margin-top: .25rem; }
.sd-att-h { display: flex; align-items: flex-start; gap: .55rem; margin-bottom: .7rem; padding: .5rem .75rem; border-radius: .7rem; background: #f4f7fb; border: 1px solid var(--line); font-size: .9rem; font-weight: 700; line-height: 1.45; color: var(--ink); }
.sd-att-h .sd-sn { min-width: 2.9rem; font-size: .72rem; }
.sd-att-h .sd-sn:empty { display: none; }
/* คำสั่งแต่งตั้งคณะกรรมการ (ภาคผนวก): ตัวเลือก 2 รูปแบบ · ตารางรายชื่อ · รูปลายเซ็นผู้ลงนาม */
.sd-order > .seg { margin-bottom: .6rem; max-width: 100%; flex-wrap: wrap; }
.sd-order .seg button:disabled { cursor: default; }
.sd-order .seg button:disabled:not([aria-selected="true"]) { opacity: .55; }
table.sd-ord td { vertical-align: middle; }
table.sd-ord th:nth-child(1) { width: 3.2rem; }
table.sd-ord th:nth-child(2) { width: 32%; }
table.sd-ord .sd-ord-t { white-space: nowrap; width: 1%; }
table.sd-ord .sd-ord-t .btn:disabled { opacity: .3; }
/* รูปแบบที่ 1: แถบสรุปในหน้าเล่ม + หน้าต่างเต็มจอของแบบกรอก (อยู่ในการ์ดของส่วน — position: fixed) */
html:has(#sd-ordpop:not([hidden])) { overflow: hidden; }
.sd-ordsum { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: .8rem; background: #fff; }
.sd-ordsum-ic { width: 2.4rem; height: 2.4rem; display: grid; place-items: center; border-radius: .7rem; background: var(--brand-50, #eef4fd); color: var(--brand-700); flex-shrink: 0; }
.sd-ordsum-t { flex: 1; min-width: 12rem; font-size: .9rem; }
.sd-ordsum-t small { display: block; margin-top: .1rem; font-size: .78rem; color: var(--ink-3); }
.sd-ordsum-a { display: flex; flex-wrap: wrap; gap: .4rem; }
.sd-ordpop { position: fixed; inset: 0; z-index: 900; display: flex; flex-direction: column; background: #f1f4f9; animation: fv-in .15s ease-out; }
.sd-ordpop[hidden] { display: none; }
.sd-ordpop-h { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem .6rem 1rem; background: #fff; border-bottom: 1px solid var(--line); }
.sd-ordpop-b { flex: 1; min-height: 0; overflow: auto; padding: 1rem; overscroll-behavior: contain; }
.sd-ordpop-in { max-width: 70rem; margin: 0 auto; padding: 1.1rem 1.25rem 1.25rem; background: #fff; border: 1px solid var(--line); border-radius: 1rem; }
.sd-ordpop-f { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; padding: .6rem 1rem; background: #fff; border-top: 1px solid var(--line); }
@media (max-width: 640px) { .sd-ordpop-b { padding: .5rem; } .sd-ordpop-in { padding: .8rem .75rem 1rem; border-radius: .8rem; } .sd-ordpop-f .hint { flex-basis: 100%; } }
@media print { .sd-ordpop { display: none !important; } }
.sd-ord-sign { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem; margin-top: .6rem; }
.sd-ord-sign img { height: 3.4rem; max-width: 12rem; object-fit: contain; padding: .3rem .6rem; border: 1px dashed var(--line); border-radius: .7rem; background: #fff; }
.sd-subchips > button > b { color: var(--brand-700); font-weight: 700; }
.sd-h3, details.std-block { scroll-margin-top: .25rem; }
/* มือถือ/แท็บเล็ต: แถบเลือกส่วนติดขอบบน */
.sd-jumpbar { position: sticky; top: var(--topbar-h); z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: -.5rem -1rem .8rem; padding: .5rem 1rem; background: rgba(244, 246, 250, .96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.sd-jumpbar select { flex: 1; min-width: 0; height: 2.4rem; font-weight: 600; }
.sd-jb { flex-shrink: 0; width: 2.4rem; height: 2.4rem; padding: 0; }
.sd-subchips { flex: 0 0 100%; display: flex; gap: .35rem; overflow-x: auto; scrollbar-width: none; padding-bottom: .05rem; }
.sd-subchips::-webkit-scrollbar { display: none; }
.sd-subchips > button { flex-shrink: 0; max-width: 15rem; padding: .2rem .65rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: .74rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1023px) { .sd-h3, details.std-block, .sd-issue, .sd-att { scroll-margin-top: 6.2rem; } }
@media (min-width: 1024px) { .sd-jumpbar { display: none; } }
/* แถบล่างคงที่: ก่อนหน้า / ถัดไป + บันทึก */
.sd-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(255, 255, 255, .97); backdrop-filter: blur(8px); border-top: 1px solid var(--line); box-shadow: 0 -8px 20px -14px rgba(15, 23, 42, .3); }
.sd-bar-in { max-width: 1320px; margin: 0 auto; padding: .55rem 1rem; display: flex; align-items: center; gap: .75rem; }
.sd-bar-nav { display: none; align-items: center; gap: .6rem; min-width: 0; }
.sd-bar-pos { display: grid; width: 17rem; min-width: 0; line-height: 1.25; text-align: center; }
.sd-bar-pos b { font-size: .7rem; font-weight: 600; color: var(--ink-3); }
.sd-bar-pos span { font-size: .84rem; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-bar-acts { display: flex; gap: .5rem; margin-left: auto; flex: 1; }
/* สถานะการบันทึกอัตโนมัติ (autoUi ใน assets/sardoc.js): บันทึกแล้ว · กำลังจะบันทึก · กำลังบันทึก · ค้างเพราะช่องบังคับไม่ครบ/บันทึกไม่สำเร็จ (กดได้) */
.sd-auto { margin: 0 0 0 auto; display: inline-flex; align-items: center; gap: .4rem; flex-shrink: 0; padding: .32rem .75rem; border: 1px solid transparent; border-radius: 999px; background: transparent; font-size: .76rem; line-height: 1.3; color: var(--ink-3); white-space: nowrap; cursor: default; }
.sd-bar button.sd-auto:disabled { opacity: 1; }
.sd-auto + .sd-bar-acts { margin-left: 0; }
.sd-auto.is-saved > i { color: #16a34a; }
.sd-auto.is-pending { color: #b45309; }
.sd-auto.is-saving { color: var(--brand-700); }
.sd-auto.is-hold, .sd-auto.is-error, .sd-auto.is-stopped { border-color: #fecdd3; background: #fff1f2; color: #be123c; font-weight: 600; cursor: pointer; }
.sd-auto.is-hold:hover, .sd-auto.is-error:hover, .sd-auto.is-stopped:hover { background: #ffe4e6; }
.sd-bar-acts > .btn { flex: 1; min-width: 0; padding-left: .6rem; padding-right: .6rem; }
.sd-bar button:disabled { opacity: .45; cursor: default; }
@media (max-width: 1023px) { .sd-bar.ro { display: none; } .sd-auto { padding: .32rem .5rem; } .sd-auto span { display: none; } }
@media (min-width: 1024px) {
  .sd-bar-nav { display: flex; }
  .sd-bar-acts { flex: 0 0 auto; }
  .sd-bar-acts > .btn { flex: 0 0 auto; min-width: 9.5rem; }
}
/* สารบัญประเด็นในแต่ละมาตรฐาน */
.sd-isx { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; padding: .5rem .65rem; border-radius: .7rem; background: #f8fafc; border: 1px solid var(--line); }
.sd-isx > span { margin-right: .25rem; font-size: .74rem; color: var(--ink-3); }
.sd-isx > button { padding: .15rem .6rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: .76rem; font-weight: 600; color: var(--ink-2); }
.sd-isx > button:hover { border-color: var(--brand-400, #6aa3e8); color: var(--brand-700); }
.sd-isx > button.ok-y { border-color: #bbf7d0; background: #ecfdf3; color: #166534; }
.sd-isx > button.ok-n { border-color: #fecdd3; background: #fff1f2; color: #9f1239; }
.sd-issue { scroll-margin-top: .5rem; }
@media (max-width: 640px) { .sd-keys > span:last-child { display: none; } .sd-keys { gap: .2rem .8rem; padding: .4rem .7rem; } }
@media (max-width: 520px) { .sd-secnav { padding: .75rem .9rem; } .sd-secnav-b small { display: none; } .sd-secnav-b > span { font-size: .78rem; } }
@media print { .sd-bar, .sd-jumpbar, .sd-side { display: none !important; } #sd-root.sd-step > .sd-sec:not(.is-cur) { display: block; } }

/* แถว ค่าเป้าหมาย / ผลประเมิน / ผลการบรรลุ ของรายประเด็น: หน่วย (% ห้อง คน) อยู่ท้ายช่องในบรรทัดเดียวกัน · ป้ายผลการบรรลุสูงเท่าช่องกรอกและอยู่แนวเดียวกัน */
.sd-rr { gap: .6rem 1.4rem; align-items: flex-end; }
.sd-rr label { display: grid; grid-template-columns: auto auto; justify-content: start; align-items: center; gap: .2rem .4rem; }
.sd-rr label > span { grid-column: 1 / -1; font-weight: 600; color: var(--ink-2); }
.sd-rr label .fld { width: 7rem; height: 2.4rem; font-weight: 600; }
.sd-rr label select.fld { width: 10rem; font-weight: 400; }
.sd-rr label small { font-size: .85rem; font-weight: 600; color: var(--ink-3); }
.sd-rr label .fld.sd-tgro { background: #f1f4f9; color: var(--ink-2); cursor: default; box-shadow: none; }
.sd-rr label .fld.sd-tgro.lv { width: 10rem; font-weight: 400; }
.sd-rr label .fld.sd-tgro:not(.lv) { text-align: right; }
.sd-rr label .fld.sd-tgro::placeholder { font-weight: 400; font-size: .8rem; }
.sd-rr-ok { gap: .2rem; }
.sd-rr-ok > span { font-weight: 600; color: var(--ink-2); }
.sd-rr-ok .sd-okv { min-height: 2.4rem; min-width: 7.5rem; padding: .15rem .9rem; border-radius: .7rem; font-size: .88rem; }

/* ---------- ผู้ดูแล → เล่ม SAR สถานศึกษา: ตั้งค่าข้อมูลเล่ม (ข้อมูลกลางของเขต เช่น คะแนนเฉลี่ยผลการทดสอบระดับชาติ) ---------- */
/* แถบเดียวในหน้ารายการ (ประหยัดพื้นที่): ชื่อ + ปุ่มของแต่ละชุดข้อมูล พร้อมสถานะการกรอก */
.sdn-row { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .9rem; padding: .5rem .9rem; }
.sdn-lead { display: inline-flex; align-items: center; gap: .5rem; font-size: .86rem; font-weight: 700; color: var(--ink); white-space: nowrap; cursor: help; }
.sdn-lead > i { color: var(--brand-600); }
.sdn-btn { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; min-width: 0; padding: .3rem .4rem .3rem .7rem; border-radius: .7rem; border: 1px solid var(--line); background: #fff; font-size: .84rem; line-height: 1.4; color: var(--ink); text-align: left; transition: background .15s, border-color .15s; }
.sdn-btn:hover, .sdn-btn:focus-visible { background: var(--brand-50); border-color: var(--brand-200, #b9d4f5); }
.sdn-btn > i { color: var(--brand-600); }
.sdn-btn > b { font-weight: 600; }
.sdn-go { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .65rem; border-radius: .5rem; background: var(--brand-600); color: #fff; font-size: .76rem; font-weight: 600; white-space: nowrap; }
/* หน้าต่างกรอกข้อมูลเต็มจอ — จัดให้เห็นครบทั้ง 4 ชุดในจอเดียวโดยไม่ต้องเลื่อน (แถว = รายการ · คอลัมน์ = ปี × ระดับ) */
.sdn-pop { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: #f4f6fa; animation: fv-in .15s ease-out; }
.sdn-pop-head { display: flex; align-items: center; gap: .75rem; padding: .45rem .6rem .45rem .9rem; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 1px 3px rgba(15, 23, 42, .06); }
.sdn-ic { width: 2.1rem; height: 2.1rem; border-radius: .6rem; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-700); font-size: 1rem; flex-shrink: 0; }
.sdn-pop-title { font-size: .98rem; font-weight: 700; color: var(--ink); line-height: 1.3; }
.sdn-pop-sub { font-size: .76rem; color: var(--ink-3); line-height: 1.4; }
.sdn-pop-body { flex: 1; min-height: 0; overflow: auto; padding: .55rem .9rem .6rem; }
.sdn-pop-body > * { max-width: 1560px; margin-left: auto; margin-right: auto; }
.sdn-pop-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .45rem .7rem; padding: .45rem .9rem; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -1px 3px rgba(15, 23, 42, .05); }
.sdn-pop-foot .btn:not(.btn-sm) { min-width: 6.5rem; }
.sdn-miss { margin-right: auto; font-size: .8rem; color: #be123c; }      /* ตัวนับอยู่ซ้าย ปุ่มอยู่ขวา */
.sdn-miss.ok { color: #15803d; }
@media (max-width: 1199px) { .sdn-miss-x { display: none; } }      /* จอแคบ: ตัดคำอธิบายต่อท้าย ให้ท้ายหน้าต่างอยู่บรรทัดเดียว (ปุ่มบันทึกที่ล็อคอยู่บอกแทน) */
.sdn-dirty { font-size: .78rem; color: #b45309; }
.sdn-hint { margin: 0 auto .5rem; font-size: .78rem; line-height: 1.5; color: var(--ink-3); }
.sdn-hint b { color: var(--ink); }
.sdn-info { margin-left: .2rem; color: var(--brand-600); cursor: help; }
.sdn-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: .55rem; }
@media (min-width: 1000px) { .sdn-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.sdn-test { min-width: 0; padding: .45rem .6rem .4rem; background: #fff; border: 1px solid var(--line); border-radius: .8rem; }
.sdn-h { display: flex; align-items: baseline; gap: .45rem; margin-bottom: .3rem; font-size: .8rem; line-height: 1.4; white-space: nowrap; overflow: hidden; }
.sdn-h b { overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: var(--ink); }
.sdn-chip { flex-shrink: 0; padding: 0 .55rem; border-radius: 999px; background: var(--brand-600); color: #fff; font-size: .7rem; font-weight: 700; white-space: nowrap; }
.sdn-tw { overflow-x: auto; }
.sdn-tbl { width: 100%; min-width: 33rem; border-collapse: collapse; table-layout: fixed; }
.sdn-tbl th { padding: .12rem .3rem; font-size: .72rem; font-weight: 600; line-height: 1.5; color: var(--ink-2); background: #eef2f7; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sdn-tbl th.sdn-c0 { width: 22%; padding-left: .5rem; text-align: left; border-radius: .45rem 0 0 .45rem; }
.sdn-tbl th.sdn-lv { font-weight: 400; color: var(--ink-3); }
.sdn-tbl td { padding: .13rem .2rem; vertical-align: middle; }
.sdn-tbl td.sdn-r { padding-left: .5rem; font-size: .8rem; font-weight: 600; line-height: 1.25; color: var(--ink); }
.sdn-tbl tbody tr + tr > td { border-top: 1px solid #eef1f6; }
.sdn-tbl .f { border-left: 2px solid #d5deea; }      /* เส้นแบ่งกลุ่มปีการศึกษา */
.sdn-tbl td.y1 { background: #f8fafc; }
.sdn-tbl th.y1 { background: #e4eaf2; }
/* ช่องกรอก: สูงตามความสูงจอ (จอเตี้ย 1.8rem — ยังเห็นครบโดยไม่ต้องเลื่อน · จอสูงได้ช่องใหญ่ขึ้น กดง่ายขึ้น) */
.sdn-in { height: clamp(1.8rem, 4.4vh, 2.4rem); width: 100%; min-width: 0; padding: 0 .15rem; border-radius: .45rem; text-align: center; font-size: .84rem; font-weight: 600; }
.sdn-in.is-bad, .sdn-in.is-miss { border-color: #e11d48; background: #fff1f2; }
@media (max-width: 640px) {
  .sdn-pop-sub { display: none; }
  .sdn-pop-title { font-size: .9rem; }
  .sdn-pop-body { padding: .5rem .45rem .7rem; }
  .sdn-go { display: none; }
  .sdn-yl { display: none; }
  .sdn-h { white-space: normal; }
  .sdn-dash { order: -1; margin-right: auto; }
  .sdn-dirty { display: none !important; }
  /* จอแคบ: ให้ 6 ช่อง (3 ปี × 2 ระดับ) พอดีความกว้างจอ ไม่ต้องเลื่อนซ้ายขวา */
  .sdn-test { padding: .4rem .3rem .35rem; }
  .sdn-tbl { min-width: 0; }
  .sdn-tbl th { padding: .1rem .05rem; font-size: .64rem; }
  .sdn-tbl th.sdn-c0 { width: 24%; padding-left: .25rem; white-space: normal; }
  .sdn-tbl td { padding: .12rem .06rem; }
  .sdn-tbl td.sdn-r { padding-left: .25rem; font-size: .72rem; }
  .sdn-in { padding: 0; font-size: .74rem; border-radius: .35rem; }
}
/* หน้าจัดทำรายงาน: คะแนนเฉลี่ยระดับศูนย์สอบ/เขต/ประเทศ = ข้อมูลจากเขต (อ่านอย่างเดียว) */
.sd-refnote { display: flex; align-items: flex-start; gap: .6rem; padding: .65rem .9rem; border-radius: .8rem; background: #eff6ff; border: 1px solid #bfdbfe; font-size: .82rem; line-height: 1.6; color: var(--ink-2); }
.sd-refnote > i { margin-top: .3rem; color: var(--brand-600); }
.sd-tbl td.sd-ref { background: #eff6ff; color: var(--ink); font-weight: 600; font-size: .88rem; white-space: nowrap; }
.sd-tbl td.sd-ref.wait { background: #f8fafc; color: var(--ink-4); font-weight: 400; font-size: .7rem; }
/* ปุ่มลบแถวที่เพิ่มเองในตาราง (เช่น สาขาวิชา): อยู่ท้ายช่องชื่อของแถวนั้น */
.sd-rowx { display: flex; align-items: center; gap: .3rem; }
.sd-rowx > .fld { flex: 1; min-width: 0; }
.btn.sd-rowdel { flex-shrink: 0; color: #e11d48; }
.btn.sd-rowdel:hover { background: #fff1f2; color: #be123c; }
@media (max-width: 640px) { .sd-rowx { flex-wrap: wrap; justify-content: flex-end; gap: .15rem; } .sd-rowx > .fld { flex-basis: 100%; } .btn.sd-rowdel { height: 1.7rem; } }   /* จอแคบ: ปุ่มลบลงไปอยู่ใต้ช่องชื่อ ช่องชื่อจึงกว้างเท่าแถวอื่น */
/* ช่องจำนวนนักเรียนอัตโนมัติ [data-stulink]: ค่าจากตาราง 2) ข้อมูลนักเรียน (อ่านอย่างเดียว ไม่มีช่องกรอก) — จำนวนเด็กทั้งหมด (ปฐมวัย) ·
   จำนวนนักเรียนรายชั้น (หัวข้อ 4) · นร. ทั้งหมด ของปีปัจจุบัน (หัวข้อ 5) · จำนวนนักเรียนรวมทั้งสิ้น (บทสรุปผู้บริหาร) */
.sd-autohint { line-height: 1.6; }
#sd-ach > .sd-autohint { margin-top: .5rem; }
.sd-sec .space-y-5 > .hint + .sd-autohint { margin-top: .3rem; }
.sd-nat td.sd-etot { font-size: .8rem; }
.sd-nat td.sd-etot.wait { font-size: .6rem; line-height: 1.25; padding: .1rem; }
.sd-autoval { display: flex; align-items: center; justify-content: flex-end; height: 2.6rem; padding: 0 .8rem; border: 1px solid var(--line-2); border-radius: .7rem; background: #f6f7fa; font-size: .9rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; cursor: help; }
.sd-autoval.wait { justify-content: flex-start; background: #fffbeb; border-color: #fde68a; color: #b45309; font-weight: 500; font-size: .82rem; }
.sd-autoval.is-miss { border-color: #f43f5e; background: #fff7f8; color: #be123c; box-shadow: 0 0 0 3px rgba(244, 63, 94, .12); }
.sd-autoval-n { display: block; margin-top: .25rem; font-size: .72rem; line-height: 1.5; color: var(--ink-3); }
/* ค่าอัตโนมัติแบบบรรทัดเดียว: ที่มา + ลิงก์แก้ไข (ซ้าย) · ค่า (ขวา) อยู่ในกล่องเดียวสูงเท่าช่องกรอก */
.sd-autobox { display: flex; align-items: center; gap: .5rem; height: 2.6rem; padding: 0 .75rem; border: 1px solid var(--line-2); border-radius: .7rem; background: #f6f7fa; }
.sd-autobox .sd-autoval-n { flex: 1 1 auto; min-width: 0; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sd-autobox .sd-autoval { flex-shrink: 0; height: auto; padding: 0; border: 0; background: none; box-shadow: none; }
.sd-autobox:has(.sd-autoval.wait) { background: #fffbeb; border-color: #fde68a; }
.sd-autobox:has(.sd-autoval.is-miss) { border-color: #f43f5e; background: #fff7f8; box-shadow: 0 0 0 3px rgba(244, 63, 94, .12); }
/* ข้อ x.7 สรุปผลการวิเคราะห์ประสิทธิภาพ: จอกว้าง 4 ช่องแถวเดียว (กลุ่มประสิทธิภาพช่องแคบ) */
.sd-eff4 { display: grid; gap: .6rem .85rem; align-items: end; }
@media (min-width: 640px) { .sd-eff4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .sd-eff4 { grid-template-columns: 7.2rem minmax(0, 1.15fr) minmax(0, 1.25fr) minmax(0, .9fr); } }
#sd-root .sd-eff4 .fld { padding: 0 .55rem; font-size: .8rem; }
#sd-root .sd-eff4 select.fld { padding-right: 1.1rem; }
/* ข้อ 6.1: วันที่ตรวจเยี่ยม · ปีงบประมาณ · คำอธิบายระดับ อยู่แถวเดียว */
.sd-eqatop { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem 1rem; }
.sd-eqatop > .block:first-child { flex: 0 1 22rem; }
.sd-eqatop > label.block { flex: 0 1 13rem; }
.sd-eqatop > .hint { flex: 1 1 16rem; line-height: 1.5; }
/* ---------- หน้าจัดทำรายงาน SAR ฉบับสมบูรณ์แบบกะทัดรัด (v2.28.0): ช่องเตี้ยลง ระยะห่างแคบลงทั้งหน้า ---------- */
#sd-root input.fld, #sd-root select.fld, #sd-root .sd-autobox { height: 2.3rem; }
#sd-root .sd-tbl input.fld, #sd-root .sd-tbl select.fld, #sd-root .sd-sum, #sd-root .sd-lv { height: 2rem; }
#sd-root .space-y-5 > .hint + .sd-autohint { margin-top: .3rem; }
#sd-root .lbl { margin-bottom: .2rem; }
#sd-root .grid.gap-4 { gap: .6rem .85rem; }
#sd-root .space-y-5 > :not([hidden]) ~ :not([hidden]) { margin-top: .8rem; }
#sd-root .sd-sec > .sec-head { padding: .65rem 1.1rem; }
#sd-root .sd-sec > .sec-head .n { width: 1.9rem; height: 1.9rem; border-radius: .6rem; font-size: .9rem; }
#sd-root .sd-eqa-lock { padding: .4rem .8rem; gap: .4rem .8rem; font-size: .8rem; line-height: 1.45; }
#sd-root .ck { padding: .3rem .55rem; }
#sd-root .sd-box { padding: .7rem .85rem; }
#sd-ach > .sd-autohint + .sd-dashwrap { margin-top: .45rem; }
.sd-autohint > i { margin-right: .15rem; color: var(--brand-600); }
.sd-autohint b { color: var(--ink-2); }
.sd-autolink { color: var(--brand-700); font-weight: 600; white-space: nowrap; text-decoration: underline; text-underline-offset: 2px; }
.sd-autolink:hover { color: var(--brand-800); }
.sd-autolink > i { font-size: .65rem; }
.sd-tbl td.sd-etot { color: var(--ink); font-weight: 600; font-size: .88rem; cursor: help; }
.sd-tbl td.sd-etot.wait { background: #fffbeb; color: #b45309; font-weight: 500; font-size: .72rem; line-height: 1.35; white-space: normal; }
.sd-tbl td.sd-etot.is-miss { background: #fff7f8; color: #be123c; box-shadow: inset 0 0 0 2px #f43f5e; }
.sd-natsum.w { color: var(--ink-3); font-weight: 400; font-size: .74rem; }
