/* ระบบรับสมัคร วิทยาลัยเทคนิคกำแพงเพชร — หน้าจอ (มือถือมาก่อน) */
@font-face { font-family: 'Sarabun'; src: url('../fonts/Sarabun-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Sarabun'; src: url('../fonts/Sarabun-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Sarabun'; src: url('../fonts/Sarabun-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

/* ---- สีของระบบ (design tokens) ----
   ทุกสีอ้างผ่านตัวแปรเหล่านี้ · บทบาท: <html data-role="registrar|finance|admin"> (ค่าจาก server)
   โหมดสี: <html data-theme="light|dark"> (ไม่มี = ตามเครื่อง) · โหมดมืดใช้เฉพาะบนจอ ตอนพิมพ์เป็นสีสว่างเสมอ */
:root {
  color-scheme: light;
  /* สีประจำบทบาท (ค่าเริ่มต้น = ผู้สมัคร) ตัว -d คือสีในโหมดมืด */
  --r-acc: #0f4c81; --r-acc2: #1d6fb8; --r-soft: #e3eef8;
  --r-acc-d: #6fb1ee; --r-acc2-d: #8cc4f5; --r-soft-d: #16283a;
  --acc: var(--r-acc); --acc-2: var(--r-acc2); --acc-soft: var(--r-soft); --on-acc: #fff;
  --bg: #f2f5f8; --surface: #fff; --surface-2: #eef2f6; --surface-3: #f6f8fa;
  --text: #17212b; --muted: #55626f; --line: #d0d7de; --line-2: #e3e8ee; --field-bd: #7d8995;
  --gold: #f0b400; --on-gold: #1a1a1a; --gold-soft: #fff3cd; --gold-text: #7a5300;
  --ok: #1b6b2f; --okbg: #e5f4e8; --warn: #7a4f00; --warnbg: #fff4d6; --bad: #b42318; --badbg: #fde8e6;
  /* สีกราฟ: ปวช. / ปวส. / ทล.บ. + สถานะ (กราฟมีชื่อกำกับเสมอ ไม่ใช้สีอย่างเดียว) */
  --c1: #1d6fb8; --c2: #c77c02; --c3: #b8336a; --c-ok: #2e8540; --c-warn: #d99a00; --c-muted: #c3ccd5; --c-track: #e6ebf0; --c-rq: #0f766e; --c-rr: #6d28d9; --c-rx: #c2410c; --c-rt: #334155;
  --form-red: #b3151b; --form-red-2: #d9534f;
  --shadow: rgba(15, 76, 129, .08); --shadow-2: rgba(15, 76, 129, .14);
  /* ชื่อเดิมที่ยังใช้อยู่ทั่วไฟล์ */
  --blue: var(--acc); --blue2: var(--acc-2); --soft: var(--surface-2);
}
:root[data-role="registrar"] { --r-acc: #0a6382; --r-acc2: #0b7ea3; --r-soft: #ddf0f6; --r-acc-d: #5ec6e6; --r-acc2-d: #86d6ee; --r-soft-d: #0f2a33; }
:root[data-role="finance"]   { --r-acc: #33409e; --r-acc2: #4654c2; --r-soft: #e6e9f8; --r-acc-d: #a3b1ff; --r-acc2-d: #c0c8ff; --r-soft-d: #1d2340; }
:root[data-role="admin"]     { --r-acc: #162f4d; --r-acc2: #2c5486; --r-soft: #e4e9f0; --r-acc-d: #9cc0ea; --r-acc2-d: #b8d3f2; --r-soft-d: #18232f; }
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --acc: var(--r-acc-d); --acc-2: var(--r-acc2-d); --acc-soft: var(--r-soft-d); --on-acc: #0b1220;
    --bg: #0f141a; --surface: #171e26; --surface-2: #1f2832; --surface-3: #1b232c;
    --text: #e6edf3; --muted: #9aa8b5; --line: #2f3a46; --line-2: #26313c; --field-bd: #687786;
    --gold-soft: #33280f; --gold-text: #f2c14e;
    --ok: #6fd18a; --okbg: #15301d; --warn: #f2c14e; --warnbg: #33280f; --bad: #ff8f84; --badbg: #3a1715;
    --c1: #6fb1ee; --c2: #f2b24a; --c3: #ef7aa8; --c-ok: #6fd18a; --c-warn: #f2c14e; --c-muted: #4a5664; --c-track: #26313c; --c-rq: #4fd1c5; --c-rr: #b39dfa; --c-rx: #fb923c; --c-rt: #cbd5e1;
    --form-red: #ff8a80; --form-red-2: #c9564f;
    --shadow: rgba(0, 0, 0, .35); --shadow-2: rgba(0, 0, 0, .5);
  }
}
@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --acc: var(--r-acc-d); --acc-2: var(--r-acc2-d); --acc-soft: var(--r-soft-d); --on-acc: #0b1220;
    --bg: #0f141a; --surface: #171e26; --surface-2: #1f2832; --surface-3: #1b232c;
    --text: #e6edf3; --muted: #9aa8b5; --line: #2f3a46; --line-2: #26313c; --field-bd: #687786;
    --gold-soft: #33280f; --gold-text: #f2c14e;
    --ok: #6fd18a; --okbg: #15301d; --warn: #f2c14e; --warnbg: #33280f; --bad: #ff8f84; --badbg: #3a1715;
    --c1: #6fb1ee; --c2: #f2b24a; --c3: #ef7aa8; --c-ok: #6fd18a; --c-warn: #f2c14e; --c-muted: #4a5664; --c-track: #26313c; --c-rq: #4fd1c5; --c-rr: #b39dfa; --c-rx: #fb923c; --c-rt: #cbd5e1;
    --form-red: #ff8a80; --form-red-2: #c9564f;
    --shadow: rgba(0, 0, 0, .35); --shadow-2: rgba(0, 0, 0, .5);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Sarabun', 'Segoe UI', Tahoma, sans-serif; font-size: 16px; line-height: 1.6; color: var(--text); background: var(--bg); }
a { color: var(--blue); }
img { max-width: 100%; }
h1, h2, h3 { color: var(--blue); line-height: 1.3; }
h1 { font-size: 1.5rem; margin: .2em 0 .6em; }
h2 { font-size: 1.25rem; margin: 1.2em 0 .5em; }
h3 { font-size: 1.1rem; }

/* แถบบน */
.topbar { background: var(--acc); border-bottom: 3px solid var(--gold); color: var(--on-acc); }
.topbar-in { max-width: 1100px; margin: 0 auto; padding: 8px 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--on-acc); text-decoration: none; font-weight: 700; flex: 1 1 auto; min-width: 0; }
.brand img { width: 40px; height: 40px; }
.brand small { display: block; font-weight: 400; opacity: .85; font-size: .8rem; }
.topnav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
/* ปุ่มบนแถบสี (ออกจากระบบ โหมดสี ฯลฯ) = แบบ .lh-btn-light ของหน้าแรก */
.topnav a, .topnav button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; color: var(--on-acc); text-decoration: none;
  background: color-mix(in srgb, var(--on-acc) 12%, transparent); border: 2px solid color-mix(in srgb, var(--on-acc) 50%, transparent); border-radius: 10px;
  padding: 4px 14px; font: 500 .92rem/1.2 'Kanit', 'Sarabun', 'Segoe UI', Tahoma, sans-serif; cursor: pointer; }
.topnav a:hover, .topnav button:hover { background: color-mix(in srgb, var(--on-acc) 22%, transparent); }
.topnav a:focus-visible, .topnav button:focus-visible { outline: 3px solid var(--lh-orange-text, #b84a06); outline-offset: 2px; }
.topnav form { margin: 0; }
/* ป้ายบทบาท + ปุ่มโหมดสี บนแถบบน */
.role-chip { display: inline-block; font-size: .8rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--on-acc); color: var(--acc); white-space: nowrap; }
.theme-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.theme-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .ti { display: none; }
.theme-btn[data-mode="auto"] .ti-auto, .theme-btn[data-mode="light"] .ti-light, .theme-btn[data-mode="dark"] .ti-dark { display: inline; }
@media (max-width: 560px) { .theme-btn .tl, .topnav .muted-white { display: none; } }

.wrap { max-width: 1100px; margin: 0 auto; padding: 16px 14px 32px; }
.wrap.narrow { max-width: 520px; }
.wrap.mid { max-width: 820px; }
.card { background: var(--surface); border-radius: 12px; box-shadow: 0 2px 10px var(--shadow); padding: 18px 18px; margin-bottom: 16px; }
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 10px 10px 26px; }

/* ฟอร์ม */
label { display: block; font-weight: 600; margin: 10px 0 3px; }
.req { color: var(--bad); }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=search], input[type=tel], input[type=number], input[type=date], input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; font: inherit; padding: 9px 10px; border: 1px solid var(--field-bd); border-radius: 8px; background: var(--surface); color: var(--text);
}
input[type=file] { padding: 7px; }
textarea { min-height: 90px; }
textarea.code { font-family: monospace; font-size: .85rem; min-height: 160px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue2); outline-offset: 0; border-color: var(--blue2); }
input[readonly], .locked { background: var(--surface-2); }
.help { font-size: .85rem; color: var(--muted); margin-top: 2px; }
.help-list { margin: 4px 0 10px; padding-left: 1.2em; }
.help-list li { margin: 2px 0; }
.err { color: var(--bad); font-size: .88rem; margin-top: 2px; }
.has-err input, .has-err select, .has-err textarea { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); background-color: var(--badbg); }
.has-err > label, .has-err > .lbl { color: var(--bad); }
[data-err-summary] .btn { margin-left: 6px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: .2em; width: 1.35em; height: 1.35em; flex: none; }
.check.small { font-size: .92rem; margin-top: 4px; }
.cid-wrap { display: flex; align-items: stretch; }
.cid-wrap input { flex: 1; min-width: 0; }
.cid-g { display: flex; align-items: center; padding: 0 12px; font-weight: 700; border: 1px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px; background: var(--surface-2); }
.cid-g:not([hidden]) + input { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cid-g[hidden] { display: none; }
.badge-g { display: inline-block; font-size: .78rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-text); border: 1px solid var(--gold); vertical-align: middle; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px 14px; margin: 0 0 16px; min-width: 0; }
legend { font-weight: 700; color: var(--blue); padding: 0 6px; font-size: 1.05rem; }
.grid2, .grid3, .grid4 { display: grid; gap: 0 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid3 { grid-template-columns: 1fr 1fr 1fr; } .grid4 { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 640px) { .grid2.grid-px { grid-template-columns: minmax(14rem, 1fr) 3fr; } }
.dob { display: grid; grid-template-columns: 1fr 1.6fr 1.2fr; gap: 8px; }
.otp-input { font-size: 1.6rem !important; letter-spacing: .5em; text-align: center; }

/* ปุ่ม — แบบเดียวทั้งระบบ ใช้ปุ่มหน้าแรก (.lh-btn ใน site.css) เป็นต้นแบบ (ผู้ใช้กำหนด 29 พ.ย. 2569)
   มุมมน 12px · ฟอนต์ Kanit · ขอบ 2px · ยกขึ้นเล็กน้อยเมื่อชี้ · กรอบส้มเมื่อเลือกด้วยคีย์บอร์ด
   .btn = ปุ่มหลัก (น้ำเงิน) · .light = ปุ่มรอง (พื้นขาว ขอบเทา) · .gold = ปุ่มเน้น (ส้ม) · .danger = แดง · .ok = เขียว · .small = ขนาดเล็ก */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 22px; border-radius: 12px;
  font: 500 1rem/1.2 'Kanit', 'Sarabun', 'Segoe UI', Tahoma, sans-serif; text-align: center; text-decoration: none; cursor: pointer;
  border: 2px solid var(--blue); background: var(--blue); color: var(--on-acc);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--blue) 24%, transparent); }
.btn:hover { background: var(--blue2); border-color: var(--blue2); color: var(--on-acc); text-decoration: none; transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--lh-orange-text, #b84a06); outline-offset: 3px; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--on-gold); box-shadow: 0 6px 16px color-mix(in srgb, var(--gold) 30%, transparent); }
.btn.gold:hover { background: var(--lh-orange-2, var(--gold)); border-color: var(--lh-orange-2, var(--gold)); color: var(--on-gold); }
.btn.light { background: var(--surface); color: var(--blue); border-color: var(--field-bd); box-shadow: none; }
.btn.light:hover { background: var(--surface); color: var(--blue); border-color: var(--blue); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: var(--on-acc); box-shadow: 0 6px 16px color-mix(in srgb, var(--bad) 22%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 85%, #000); border-color: color-mix(in srgb, var(--bad) 85%, #000); color: var(--on-acc); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: var(--on-acc); box-shadow: 0 6px 16px color-mix(in srgb, var(--ok) 22%, transparent); }
.btn.ok:hover { background: color-mix(in srgb, var(--ok) 85%, #000); border-color: color-mix(in srgb, var(--ok) 85%, #000); color: var(--on-acc); }
.btn.small { min-height: 36px; padding: 5px 14px; gap: 6px; border-radius: 10px; font-size: .92rem; box-shadow: none; }
.btn.block { display: flex; width: 100%; }
.btn .icn { margin-right: 0; }
summary.btn { list-style: none; width: max-content; max-width: 100%; }
summary.btn::-webkit-details-marker { display: none; }
/* ปุ่มที่กดแล้วกางแบบฟอร์ม (details/summary) เช่น ยกเลิกสถานะ ในงานการเงิน: มีลูกศรบอกว่ากางได้ */
details.act-pop { margin-top: 4px; }
/* ปุ่ม "เลือกไฟล์" ของช่องแนบไฟล์: หน้าตาแบบปุ่มรอง (.btn.light .small) */
input[type=file]::file-selector-button { font: 500 .92rem/1.2 'Kanit', 'Sarabun', 'Segoe UI', Tahoma, sans-serif; min-height: 36px; padding: 5px 14px; margin-right: 10px;
  border: 2px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--blue); cursor: pointer; transition: border-color var(--dur-fast, .15s) ease; }
input[type=file]::file-selector-button:hover { border-color: var(--blue); }
details.act-pop > summary.btn::after { content: ""; width: .45em; height: .45em; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); }
details.act-pop[open] > summary.btn::after { transform: rotate(-135deg) translateY(-1px); }
details[open] > summary.btn { margin-bottom: 8px; }
.btn.light.danger-line { color: var(--bad); border-color: var(--bad); }
.btn.light.danger-line:hover { background: var(--bad); color: var(--on-acc); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
button.link { background: none; border: 0; color: var(--blue); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
form.inline { display: inline; margin: 0; }

/* ข้อความแจ้ง */
.alert { color: var(--text); padding: 10px 14px; border-radius: 8px; margin: 0 0 14px; border-left: 4px solid; }
.alert.ok { background: var(--okbg); border-color: var(--ok); }
.alert.info { background: var(--acc-soft); border-color: var(--blue); }
.alert.warn { background: var(--warnbg); border-color: var(--gold); }
.alert.bad { background: var(--badbg); border-color: var(--bad); }
.badge { display: inline-block; padding: 1px 9px; border-radius: 20px; font-size: .85rem; font-weight: 600; background: var(--surface-2); color: var(--text); white-space: nowrap; }
.badge.ok { background: var(--okbg); color: var(--ok); }
.badge.warn { background: var(--warnbg); color: var(--warn); }
.badge.bad { background: var(--badbg); color: var(--bad); }
.badge.info { background: var(--acc-soft); color: var(--blue); }

/* ตาราง */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.list { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.list th, table.list td { border-bottom: 1px solid var(--line-2); padding: 7px 8px; text-align: left; vertical-align: top; }
table.list th { background: var(--surface-2); color: var(--text); font-weight: 600; white-space: nowrap; }
table.list tr:hover td { background: var(--surface-3); }
table.kv { border-collapse: collapse; width: 100%; }
table.kv th { text-align: left; width: 34%; color: var(--muted); font-weight: 600; padding: 4px 8px 4px 0; vertical-align: top; }
table.kv td { padding: 4px 0; }
.r, .list th.r, .list td.r { text-align: right; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.mono { font-family: monospace; }
table.kv tr.res-row th { white-space: nowrap; }
table.kv tr.res-row th, table.kv tr.res-row td { font-size: 1.25rem; font-weight: 700; color: var(--text); vertical-align: middle; }   /* ผู้ใช้ขอ 2 ธ.ค. 2569: ผลการคัดเลือกให้เห็นชัด */
.res-row .badge { font-size: 1.15rem; padding: 4px 14px; }
.res-row .muted { font-weight: 700; }
.pt-token { display: inline-block; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 0 6px; margin: 2px 0; color: var(--text); }

/* แดชบอร์ดผู้สมัคร */
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line-2); align-items: flex-start; }
.steps li:last-child { border-bottom: 0; }
.steps .dot { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-weight: 700; display: flex; align-items: center; justify-content: center; }
.steps li.done .dot { background: var(--ok); color: var(--on-acc); }
.steps li.now .dot { background: var(--gold); color: var(--on-gold); }
.level-cards { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .level-cards { grid-template-columns: repeat(3, 1fr); } }
.level-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
/* หัวการ์ดระดับ: ตัวใหญ่บนแถบสี (ผู้ใช้ขอ 28 พ.ย. 2569) แต่ละระดับคนละสี */
.lc-head { background: var(--acc); color: var(--on-acc); padding: 12px 14px; }
.lc-head h3 { margin: 0; font-size: 1.6rem; line-height: 1.25; color: inherit; }
.lc-long { font-size: 1.02rem; font-weight: 600; opacity: .95; }
.lc-pvs .lc-head { background: var(--ok); }
.lc-btech .lc-head { background: var(--gold-text); }
.lc-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.lc-who { font-size: .95rem; }
.lc-rounds { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
/* กรอบแยกของแต่ละรอบ */
.lc-round { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.lc-round-quota { background: var(--gold-soft); border-color: var(--gold); }
.lc-round-extra { border-color: var(--c-rx); }
.lc-round-regular { background: var(--acc-soft); border-color: color-mix(in srgb, var(--blue) 50%, transparent); }
.lc-round .btn { font-size: 1.08rem; padding: 10px 18px; min-width: min(100%, 220px); margin-bottom: 6px; }
.lc-meta { font-size: .92rem; color: var(--text); }
/* ปุ่มรอบปกติ: คนละสีกับรอบโควตา (ทอง) */
.btn.round-extra { background: #c2410c; border-color: #c2410c; color: #fff; }
.btn.round-regular { background: var(--blue); border-color: var(--blue); color: var(--on-acc); }
.appcode { font-size: 1.3rem; font-weight: 700; letter-spacing: .05em; color: var(--blue); }
.result-box { border-radius: 12px; padding: 16px; text-align: center; font-size: 1.15rem; }
.result-box.passed { background: var(--okbg); color: var(--ok); }
.result-box.reserve { background: var(--warnbg); color: var(--warn); }
.result-box.failed { background: var(--surface-2); color: var(--text); }
.filelist { list-style: none; padding: 0; margin: 0; }
.filelist li { padding: 4px 0; }
.doc-thumb { max-width: 160px; max-height: 200px; border: 1px solid var(--line); border-radius: 6px; display: block; }

/* หน้าแรก (เนื้อหาที่แก้ได้จากหน้าตั้งค่า) */
.kp-front { max-width: 1000px; margin: 0 auto; font-size: 16px; line-height: 1.7; }
.kp-hero { background: linear-gradient(135deg, var(--r-acc), var(--r-acc2)); color: #fff; border-radius: 12px; padding: 26px 20px; text-align: center; }
.kp-hero-sub { opacity: .9; }
.kp-hero-title { font-size: 1.6rem; font-weight: 700; margin: 4px 0; line-height: 1.35; }
.kp-hero-text { font-size: 1.1rem; }
.kp-hero-dates { margin: 16px 0 6px; font-size: 1.05rem; background: rgba(255,255,255,.15); display: inline-block; padding: 6px 16px; border-radius: 8px; }
.kp-hero-cta { margin-top: 14px; }
a.kp-btn-cta { display: inline-block; background: var(--gold); color: var(--on-gold); font-weight: 700; font-size: 1.2rem; padding: 12px 28px; border-radius: 30px; text-decoration: none; margin: 8px 0; }
.kp-front h3 { color: var(--blue); border-left: 5px solid var(--gold); padding-left: 10px; margin: 22px 0 8px; font-size: 1.2rem; }
.kp-front table { width: 100%; border-collapse: collapse; font-size: .95rem; margin: 6px 0 14px; display: block; overflow-x: auto; }
.kp-front th { background: var(--blue); color: var(--on-acc); padding: 6px 8px; border: 1px solid var(--line); }
.kp-front td { padding: 6px 8px; border: 1px solid var(--line); background: var(--surface); }
.kp-front tr:nth-child(even) td { background: var(--surface-3); }
.kp-front ol, .kp-front ul { margin: 0 0 0 1.2em; padding-left: .6em; }
@media (min-width: 720px) { .kp-front table { display: table; } .kp-hero-title { font-size: 1.9rem; } }
.policy-box { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 14px; background: var(--surface-3); font-size: .92rem; }
.policy-box h3 { font-size: 1rem; } .policy-box h4 { font-size: .95rem; margin: .8em 0 .2em; }

/* แท็บเมนูเจ้าหน้าที่ */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs a { padding: 6px 12px; border-radius: 8px; background: var(--surface); text-decoration: none; border: 1px solid var(--line); }
.tabs a.on { background: var(--blue); color: var(--on-acc); border-color: var(--blue); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.filters > div { flex: 1 1 150px; }
.filters label { margin-top: 0; font-size: .85rem; }
.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.stat { background: var(--surface); border-radius: 10px; padding: 12px; border: 1px solid var(--line-2); }
.stat b { display: block; font-size: 1.5rem; color: var(--blue); }
.pager { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.qr-setup { text-align: center; }
.qr-setup img { width: 220px; height: 220px; image-rendering: pixelated; }
.secret { font-family: monospace; font-size: 1.05rem; letter-spacing: .1em; background: var(--surface-2); padding: 4px 8px; border-radius: 6px; word-break: break-all; }
.doc-view { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .doc-view { grid-template-columns: 1fr 1fr; } }
.doc-frame { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.hidden, [hidden] { display: none !important; }
.m0 { margin: 0; } .mt { margin-top: 14px; }
.withdraw-box { margin-top: 14px; padding: 10px 12px; border: 1px dashed var(--bad); border-radius: 8px; background: var(--badbg); }
.withdraw-box .btn { margin-top: 6px; }

/* ---- เมนูด้านซ้าย (เจ้าหน้าที่) ---- */
.has-side .topbar-in { max-width: none; }
.shell { display: block; }
.sidenav { background: var(--surface); border-bottom: 1px solid var(--line); }
.side-toggle { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; background: none; border: 0; font: inherit; color: var(--blue); font-weight: 700; cursor: pointer; text-align: left; }
.side-toggle:hover { background: var(--acc-soft); }
.side-links a { display: flex; align-items: center; gap: 10px; padding: 9px 14px; color: var(--text); text-decoration: none; border-left: 4px solid transparent; white-space: nowrap; }
.side-links a:hover { background: var(--surface-2); }
.side-links a.on { background: var(--acc-soft); border-left-color: var(--gold); color: var(--blue); font-weight: 700; }
.sidenav .ic { width: 22px; height: 22px; flex: 0 0 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.side-lb-open { display: none; }
/* มือถือ/จอแคบ: เมนูพับอยู่ กด "เมนู" เพื่อเปิด */
@media (max-width: 899px) {
  .side-links { display: none; padding-bottom: 6px; }
  .sidenav.open .side-links { display: block; }
}
/* จอกว้าง: เมนูอยู่ด้านซ้าย ย่อเหลือไอคอนได้ */
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 60px); }
  .sidenav { border-bottom: 0; border-right: 1px solid var(--line); }
  .side-in { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; }
  .side-toggle { border-bottom: 1px solid var(--line); }
  .side-lb-open { display: inline; }
  .side-lb-mobile { display: none; }
  .side-mini .shell { grid-template-columns: 60px minmax(0, 1fr); }
  .side-mini .sidenav .lb { display: none; }
  .side-mini .side-links a { padding-left: 14px; padding-right: 0; }
  .wrap.side-main { max-width: 1280px; margin: 0; width: 100%; padding-left: 20px; padding-right: 20px; }
}
@media print { .sidenav { display: none !important; } .shell { display: block !important; } }
/* กลุ่มเมนู (เปิด/พับ) : กลุ่มที่มีหน้าปัจจุบันเปิดไว้ ; ย่อเมนูแล้วแสดงไอคอนทุกเมนูโดยไม่มีหัวกลุ่ม */
.side-grp-h { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 14px; background: var(--surface-3); border: 0; font: inherit; font-weight: 700;
  color: var(--text); cursor: pointer; text-align: left; border-left: 4px solid transparent; }
.side-grp-h:hover { background: var(--surface-2); color: var(--text); }
.side-grp.has-on > .side-grp-h { color: var(--blue); }
/* เมนูหลัก (หัวกลุ่ม) สีเข้มกว่าเมนูย่อยเล็กน้อย (ผู้ใช้กำหนด 29 พ.ย. 2569) — เมนูย่อยยังผ่าน contrast AA */
:root { --side-sub: #3b4652; }
@media screen and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --side-sub: #c2ccd6; } }
:root[data-theme="dark"] { --side-sub: #c2ccd6; }
.side-grp-items a:not(.on) { color: var(--side-sub); }
.sidenav .side-chev { width: 18px; height: 18px; flex: 0 0 18px; margin-left: auto; transition: transform var(--dur, .2s) ease; }
.side-grp-h[aria-expanded="true"] .side-chev { transform: rotate(180deg); }
.side-grp-items a { padding-left: 30px; }
@media (min-width: 900px) {
  .side-mini .side-grp-h { display: none; }
  .side-mini .side-grp-items[hidden] { display: block !important; }   /* ชนะกฎ [hidden] กลาง */
  .side-mini .side-grp { border-top: 1px solid var(--line); }
  .side-mini .side-grp-items a { padding-left: 14px; }
}
.btn.disabled { background: var(--surface-2); color: var(--muted); border-color: var(--line); cursor: not-allowed; pointer-events: none; }

/* แบบบันทึกประวัติ (ขึ้นทะเบียน) — จัดหน้าตามแบบฟอร์มของวิทยาลัย
   มือถือ: 2 คอลัมน์ (ช่องสั้น s1 = ครึ่งแถว, ช่องอื่นเต็มแถว) · จอคอม: 12 คอลัมน์ ช่อง cN กว้าง N คอลัมน์ */
.reg-form .reg-h { color: var(--form-red); font-size: 1.2rem; margin: 1.1em 0 .4em; padding-bottom: 3px; border-bottom: 1.5px solid var(--form-red); }
.reg-form .reg-h small { font-size: .82rem; font-weight: 400; }
.reg-box { border: 1px solid var(--line); border-radius: 6px; padding: 2px 12px 12px; margin-bottom: 6px; background: var(--surface); }
.reg-form label { font-size: .95rem; margin: 7px 0 2px; }
.reg-form input[type=text], .reg-form input[type=email], .reg-form select, .reg-form textarea { padding: 9px 10px; border-radius: 6px; }
.reg-form .check { font-size: .95rem; }
.rgrid { display: grid; gap: 0 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rgrid .rf { min-width: 0; grid-column: span 2; }
.rgrid .rf.nojob { display: none; }   /* อาชีพ "ไม่ได้ประกอบอาชีพ" = ไม่ต้องกรอกเงินเดือน */
.rgrid .rf.s1 { grid-column: span 1; }
.ro, input.ro { background: var(--surface-2); color: var(--text); }
.combo input[data-combo-input] { margin-top: 4px; }
.parent-block { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 2px; }
.parent-name { color: var(--form-red); font-size: 1.15rem; margin: .4em 0 0; font-weight: 600; }
.reg-form label .lh { font-weight: 400; font-size: .85rem; color: var(--muted); }
/* หัวแบบฟอร์ม: ตรา + ชื่อแบบฟอร์ม + แผนก/สาขา/รหัสนักศึกษา/กลุ่มเรียน */
.reg-head { display: flex; gap: 12px; align-items: flex-start; border: 2px solid var(--form-red-2); border-radius: 14px; padding: 10px 14px; margin-bottom: 10px; box-shadow: 0 2px 6px var(--shadow); }
.reg-emb { width: 48px; height: 48px; flex: none; }
.reg-head-body { flex: 1; min-width: 0; }
.reg-head h1 { color: var(--form-red); font-size: 1.15rem; margin: 0 0 6px; line-height: 1.35; }
.reg-head-grid { display: grid; grid-template-columns: 1fr; gap: 4px 18px; }
.reg-head .hf { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.reg-head .hf span { color: var(--form-red); font-size: .9rem; white-space: nowrap; }
.reg-head .hf b { flex: 1; min-width: 0; background: var(--surface-2); border-radius: 6px; padding: 3px 9px; font-weight: 600; color: var(--text); font-size: .92rem; }
.reg-head .hf b.pending { color: var(--warn); background: var(--warnbg); font-weight: 400; }
.reg-inner { border: 1px solid var(--line); border-radius: 6px; padding: 0 10px 10px; margin-top: 6px; }
.ig { display: flex; }
.ig input { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; min-width: 0; }
.ig-ico { display: flex; align-items: center; padding: 0 9px; border: 1px solid var(--field-bd); border-left: 0; border-radius: 0 6px 6px 0; background: var(--surface-2); }
.ig-ico svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sub-h { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; border-top: 1px solid var(--line); margin-top: 12px; padding-top: 4px; }
.sub-h h3 { color: var(--form-red); font-size: 1.1rem; margin: .2em 0; font-weight: 600; }
.guardian-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 22px; margin: 6px 0 4px; }
.guardian-pick .g-rel { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.guardian-pick .g-rel label { margin: 0; font-weight: 600; }
.guardian-pick .g-rel .combo { display: flex; gap: 6px; }
.guardian-pick .g-rel .combo input[data-combo-input] { margin-top: 0; max-width: 11em; }
.guardian-pick .g-rel .err { flex-basis: 100%; }
.guardian-pick .check { font-weight: 600; margin: 4px 0; }
@media (min-width: 900px) {
  .rgrid { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0 10px; }
  .rgrid .rf.c1, .rgrid .rf.c1.s1 { grid-column: span 1; } .rgrid .rf.c2, .rgrid .rf.c2.s1 { grid-column: span 2; }
  .rgrid .rf.c3, .rgrid .rf.c3.s1 { grid-column: span 3; } .rgrid .rf.c4 { grid-column: span 4; } .rgrid .rf.c5 { grid-column: span 5; }
  .rgrid .rf.c4.s1 { grid-column: span 4; } .rgrid .rf.c6, .rgrid .rf.c6.s1 { grid-column: span 6; } .rgrid .rf.c7 { grid-column: span 7; }
  .rgrid .rf.c12 { grid-column: span 12; }
  .reg-head-grid { grid-template-columns: 1.3fr 1fr; }
  .reg-head h1 { font-size: 1.45rem; }
  .reg-emb { width: 84px; height: 84px; }
  .reg-head { align-items: center; }
  .reg-head .hf { flex-direction: row; align-items: center; gap: 8px; }
  .reg-head .hf span { font-size: .95rem; }
}
.reg-form p.small { font-size: .88rem; margin: 4px 0 8px; }
/* กรอบเซ็นชื่อ */
.sigpad { position: relative; border: 2px dashed var(--field-bd); border-radius: 8px; background: #fff; height: 170px; touch-action: none; }
.sigpad canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.sigpad .sig-line { position: absolute; left: 8%; right: 8%; bottom: 34px; border-bottom: 1px solid #c3ccd5; pointer-events: none; }
.sig-tools { align-items: center; margin-top: 6px; }
.sig-up { font-size: .85rem; font-weight: 400; margin: 0; }
.sig-up input { display: block; margin-top: 2px; font-size: .85rem; }
.sig-current { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 6px; }
.sig-current img { max-height: 60px; max-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.sig-saved { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 8px; padding: 12px 14px; background: var(--okbg); border: 2px solid var(--ok); border-radius: 10px; color: var(--text); }
.sig-saved img { max-height: 70px; max-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.sig-saved b { display: flex; align-items: center; gap: 6px; font-size: 1.1rem; color: var(--ok); }
.sig-saved span { display: block; font-size: .95rem; }
.sig-change > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; color: var(--blue); text-decoration: underline; }
.sig-change[open] > summary { margin-bottom: 6px; }
.pw-rules { margin: 12px 0 4px; padding: 10px 14px; background: var(--acc-soft); border-left: 4px solid var(--blue); border-radius: 8px; color: var(--text); }
.pw-rules b { display: flex; align-items: center; gap: 6px; }
.pw-rules ul { margin: 4px 0 0; padding-left: 1.4em; }
.revise-box { margin: 10px 0 16px; border: 3px solid var(--bad); border-radius: 12px; background: var(--badbg); color: var(--text); padding: 0 16px 14px; overflow: hidden; }
.revise-h { display: flex; align-items: center; gap: 10px; margin: 0 -16px 12px; padding: 12px 16px; background: var(--bad); color: var(--on-acc); font-size: 1.2rem; font-weight: 700; line-height: 1.4; }
.revise-h .icn { flex: none; width: 1.6em; height: 1.6em; margin: 0; }
.revise-note { padding: 12px 14px; background: var(--surface); border: 1px solid var(--bad); border-radius: 8px; font-size: 1.15rem; font-weight: 600; line-height: 1.7; overflow-wrap: anywhere; }
.revise-do { margin: 10px 0; }
.row-search label .icn { margin-right: 6px; }
.row-search { max-width: 560px; margin: 12px 0; }
.xh-exist-list { max-height: 34vh; overflow-y: auto; margin: 8px 0; padding: 10px 12px 10px 30px; border: 1px solid var(--field-bd); border-radius: 8px; overflow-wrap: anywhere; }
/* รายการเลือกแบบพิมพ์ค้นหา */
.typeahead { position: relative; }
.typeahead-list, .typeahead-none { position: absolute; z-index: 30; top: 100%; left: 0; right: 0; margin: 4px 0 0; padding: 4px; border: 1px solid var(--field-bd); border-radius: 10px; background: var(--surface); color: var(--text); box-shadow: 0 8px 24px var(--shadow); }
.typeahead-list { max-height: 300px; overflow-y: auto; list-style: none; }
.typeahead-none { padding: 12px; }
.typeahead-opt { display: flex; flex-direction: column; justify-content: center; min-height: 44px; margin: 0; padding: 6px 10px; border-radius: 8px; cursor: pointer; overflow-wrap: anywhere; }
.typeahead-opt.on, .typeahead-opt:hover { background: var(--acc-soft); box-shadow: inset 3px 0 0 var(--acc); }
.typeahead-opt[aria-selected=true] { font-weight: 700; }
.typeahead-sub { color: var(--muted); font-size: .88rem; font-weight: 400; }
/* ป๊อปอัปหน้าหลักผู้สมัคร: ขั้นตอนถัดไป / แจ้งแก้ไข (พื้นแดงตัวขาวคงที่ทั้งโหมดสว่างและมืด) */
.pop { position: fixed; inset: 0; z-index: 1000; margin: auto; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); height: fit-content; overflow-y: auto; box-sizing: border-box; padding: 20px; border: 2px solid var(--acc, currentColor); border-radius: 14px; background: var(--surface); color: var(--text); font-size: 1.05rem; line-height: 1.7; box-shadow: 0 16px 48px rgba(0, 0, 0, .35); }
.pop::backdrop { background: rgba(0, 0, 0, .6); }
.pop-h { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 1.35rem; color: inherit; }
.pop .pop-h:focus, .pop .pop-h:focus-visible { outline: none; box-shadow: none; }
.pop-h .icn { flex: none; width: 1.5em; height: 1.5em; margin: 0; }
.pop p { margin: 8px 0; }
.pop-title { font-size: 1.15rem; font-weight: 700; }
.pop-steps { margin: 0; }
.pop-steps dt { margin-top: 10px; font-weight: 700; }
.pop-steps dt .icn { margin-right: 6px; }
.pop-steps dd { margin: 0; overflow-wrap: anywhere; }
.pop-when { font-weight: 700; }
.pop-act { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.pop-act form { margin: 0; }
.pop-act .btn { min-height: 44px; }
/* ขั้นที่ 6 ขึ้นทะเบียนเรียบร้อย (2 ธ.ค. 2569): ป๊อปอัปสีปกติ มีสีเขียวเฉพาะกรอบแสดงความยินดี (ผู้ใช้สั่งเอาพื้นเขียวออก) */
.pop-congrats { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; padding: 12px 14px; border: 2px solid #16a34a; border-radius: 10px; background: #dcfce7; color: #14532d; font-size: 1.15rem; font-weight: 700; overflow-wrap: anywhere; }
.pop-congrats .icn { flex: none; width: 1.6em; height: 1.6em; color: #16a34a; }
.pop-revise, .pop-revise .pop-h { color: #fff; }
.pop-revise { background: #b91c1c; border-color: #fff; }
.pop.pop-revise .pop-h .icn { width: 2em; height: 2em; color: #fff; }
.pop-note { margin: 10px 0; padding: 12px 14px; border: 1px solid #fff; border-radius: 8px; background: #7f1d1d; color: #fff; font-size: 1.15rem; font-weight: 600; overflow-wrap: anywhere; }
.pop-revise .pop-go, .pop-revise .pop-go:hover { background: #fff; border-color: #fff; color: #991b1b; }
.pop-revise .pop-close, .pop-revise .pop-close:hover { background: transparent; border: 1px solid #fff; color: #fff; }
.pop-revise .btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.pdpa-box ol { padding-left: 1.4em; margin: 6px 0 10px; } .pdpa-box li { margin-bottom: 4px; font-size: .93rem; }
.pdpa-opt { border-top: 1px solid var(--line); padding: 6px 0; }
.pdpa-opt .check { display: inline-flex; margin-right: 18px; font-weight: 600; }
.mt-s { margin-top: 6px; }
.card.danger-zone { border: 1px solid var(--badbg); border-left: 4px solid var(--bad); }
/* รายงานแยกตามแผนก */
.btn-row .sp { flex: 1; }
.dept-report td.indent { padding-left: 1.6em; }
.dept-report tr.dept-row td { background: var(--surface-2); }
.dept-report th { white-space: nowrap; }
/* ไอคอนในเนื้อหา: สีตามตัวอักษร ขนาดตามตัวอักษร */
.icn { width: 1.15em; height: 1.15em; vertical-align: -.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1 > .icn, h2 > .icn, h3 > .icn { color: var(--blue2); margin-right: .35em; width: 1.05em; height: 1.05em; }
.reg-h .icn { color: inherit; }
.result-box .fb-line { margin-top: 4px; font-weight: 400; }
.result-box .fb-line .icn { color: #1877f2; margin-right: .3em; }
.result-box b .icn { margin-right: .3em; }
/* เอกสารบิดามารดา: หัวข้อเอกสารเด่น (แดงหนา ในกรอบไฮไลต์) */
.doc-rule { display: flex; gap: 8px; background: var(--acc-soft); border: 1px solid color-mix(in srgb, var(--blue) 45%, transparent); border-left: 4px solid var(--blue); color: var(--text); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.doc-rule > .icn { color: var(--blue); margin-top: .2em; }
.doc-group { border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 6px; }
.doc-group:first-of-type { border-top: 0; }
label.doc-title { display: inline-flex; align-items: center; gap: .35em; color: var(--blue); font-weight: 700; background: var(--acc-soft); border: 2px solid var(--blue); border-radius: 6px; padding: 2px 10px; margin-bottom: 4px; }
.doc-have { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 2px 0; }
.doc-have .icn { margin-right: .2em; }
.doc-del { color: var(--bad); font-size: .92rem; }
.has-err > .err:first-of-type { margin-bottom: 8px; }
/* ปุ่มยกเลิกไฟล์ที่เลือก (ใส่โดย JS) */
.file-clear { margin: 4px 0 0; }
fieldset.plain { border: 0; padding: 0; margin: 0; }
fieldset.plain[disabled] { opacity: .6; }

/* แถบบันทึกติดขอบล่างจอ (แบบบันทึกประวัติยาวมาก ผู้ใช้มือถือไม่ต้องเลื่อนหาปุ่ม) */
.save-bar { position: sticky; bottom: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px;
  margin: 16px -4px 8px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--gold);
  border-radius: 10px 10px 0 0; box-shadow: 0 -4px 14px var(--shadow-2); }
.save-bar-msg { flex: 1 1 100%; margin: 0; }
.save-bar-msg.dirty { color: var(--warn); font-weight: 600; }
.save-bar .btn { flex: 1 1 0; min-width: 0; margin: 0; }
.save-bar .save-final { order: 2; }
@media (min-width: 640px) { .save-bar-msg { flex: 1 1 auto; } .save-bar .btn { flex: 0 0 auto; } }
@media print { .save-bar { display: none; } }

/* ช่องวันเวลาแบบ พ.ศ. ในหน้าตั้งค่า */
.dtbe { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dtbe select { width: auto; min-width: 0; }
.dtbe-time { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.grid-school { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 640px) { .grid-school { grid-template-columns: 2fr 1fr; } }
.badge-area { display: inline-block; font-size: .78em; padding: 0 6px; border-radius: 6px; background: var(--warnbg); color: var(--warn); border: 1px solid var(--gold); }
.nav-prevnext { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.warn-note { color: var(--warn); }

/* สถิติการสมัคร หน้าแรก (นับรวมเท่านั้น) */
.pubstats { padding: 0; overflow: hidden; }
.ps-head { background: linear-gradient(135deg, var(--r-acc) 0%, var(--r-acc2) 100%); color: #fff; padding: 20px 20px 56px; position: relative; }
.ps-head::after { content: ""; position: absolute; right: -40px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.07); }
.ps-head h2 { margin: 0; font-size: 1.3rem; color: #fff; display: flex; align-items: center; gap: 8px; }
.ps-head h2 svg { width: 1.3em; height: 1.3em; color: #fff; stroke: #fff; }
.ps-live { display: inline-flex; align-items: center; gap: 7px; margin-top: 8px; font-size: .85rem; background: rgba(255,255,255,.14); border-radius: 999px; padding: 3px 12px; }
.ps-dot { width: 8px; height: 8px; border-radius: 50%; background: #5ee08a; box-shadow: 0 0 0 0 rgba(94,224,138,.7); animation: ps-pulse 2s infinite; }
@keyframes ps-pulse { 70% { box-shadow: 0 0 0 8px rgba(94,224,138,0); } 100% { box-shadow: 0 0 0 0 rgba(94,224,138,0); } }
@media (prefers-reduced-motion: reduce) { .ps-dot { animation: none; } }
.ps-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: -40px 16px 0; position: relative; z-index: 1; }
.ps-tile { background: var(--surface); border-radius: 14px; padding: 14px 14px 12px; box-shadow: 0 6px 20px var(--shadow-2); display: flex; flex-direction: column; gap: 2px; border-top: 4px solid var(--blue2); }
.ps-tile.ps-main { border-top-color: var(--gold); }
.ps-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--acc-soft); color: var(--blue); margin-bottom: 4px; }
.ps-main .ps-ico { background: var(--gold-soft); color: var(--gold-text); }
.ps-ico svg { width: 20px; height: 20px; margin: 0; }
.ps-num { font-size: 1.9rem; font-weight: 700; line-height: 1.15; color: var(--text); font-variant-numeric: tabular-nums; }
.ps-lab { font-size: .9rem; color: var(--muted); }
.ps-levels { display: grid; grid-template-columns: 1fr; gap: 14px; padding: 18px 16px 16px; }
.ps-share + .ps-levels { padding-top: 12px; }
@media (min-width: 900px) { .ps-bars { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; } }
.ps-level { border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 10px; background: var(--surface); }
.ps-level h3 { margin: 0 0 10px; font-size: 1rem; color: var(--blue); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ps-level h3 small { font-weight: 600; color: var(--text); background: var(--bg); border-radius: 999px; padding: 1px 10px; white-space: nowrap; }
.ps-bars { list-style: none; margin: 0; padding: 0; }
.ps-bars li { display: grid; grid-template-columns: minmax(0, 13rem) 1fr minmax(2.6rem, auto); grid-template-areas: 'name track n'; gap: 10px; align-items: center; padding: 4px 6px; margin: 0 -6px; border-radius: 8px; font-size: .92rem; }
.ps-bars li:hover { background: var(--bg); }
.ps-bars li.zero .ps-name, .ps-bars li.zero .ps-n { color: var(--muted); font-weight: 400; }
.ps-name { grid-area: name; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.ps-track { grid-area: track; height: 14px; background: var(--c-track); border-radius: 0 4px 4px 0; }
.ps-bar { display: block; height: 100%; background: var(--c1); border-radius: 0 4px 4px 0; }
.ps-n { grid-area: n; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.ps-note { margin: 0; padding: 0 16px 14px; font-size: .82rem; color: var(--muted); }
@media (max-width: 560px) {
  .ps-head { padding: 16px 16px 52px; }
  .ps-tiles { grid-template-columns: 1fr 1fr; gap: 10px; margin: -38px 12px 0; }
  .ps-tile.ps-main { grid-column: 1 / -1; }
  .ps-num { font-size: 1.6rem; }
  .ps-levels { grid-template-columns: 1fr; padding: 14px 12px 12px; }
  .ps-bars li { grid-template-columns: 1fr auto; grid-template-areas: 'name n' 'track track'; row-gap: 4px; padding: 5px 6px; }
  .ps-name { white-space: normal; }
}

/* ---- ภาพเคลื่อนไหว (พอดี ๆ) ----
   สั้น 150–300ms ใช้ opacity/transform เป็นหลัก · ผู้ที่ตั้งเครื่องให้ "ลดการเคลื่อนไหว" จะไม่เห็นการเคลื่อนไหว · ไม่มีผลกับการพิมพ์ */
:root { --dur-fast: .15s; --dur: .25s; --ease: cubic-bezier(.2, .7, .2, 1); }
@media screen {
  body { transition: background-color var(--dur) ease, color var(--dur) ease; }
  .btn, .topnav a, .topnav button, .tabs a, .side-links a, .side-toggle, .side-grp-h, .copy-btn, a.kp-btn-cta {
    transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease, box-shadow var(--dur-fast) ease, transform var(--dur-fast) ease;
  }
  .btn:active, a.kp-btn-cta:active { transform: translateY(1px); }
  a.kp-btn-cta:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, .18); }
  input, select, textarea { transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease; }
  input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px var(--acc-soft); }
  :focus-visible { outline: 2px solid var(--acc-2); outline-offset: 2px; }
  /* เนื้อหาหน้าเลื่อนขึ้นเบา ๆ ตอนเปิด (การ์ด 6 ใบแรกต่อกันเป็นลำดับ) */
  .wrap > .card, .wrap > .ps-tiles, .wrap > .stats, .wrap > .alert, .kp-front, .pubstats { animation: kp-rise var(--dur) var(--ease) both; }
  .wrap > .card:nth-of-type(2) { animation-delay: .04s; }
  .wrap > .card:nth-of-type(3) { animation-delay: .08s; }
  .wrap > .card:nth-of-type(4) { animation-delay: .12s; }
  .wrap > .card:nth-of-type(n+5) { animation-delay: .16s; }
  .stat, .ps-tile { transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
  a.stat:hover, .ps-tile:hover { transform: translateY(-2px); box-shadow: 0 8px 22px var(--shadow-2); }
  /* แท่งกราฟค่อย ๆ ยืดจากซ้าย */
  .ps-bar { transform-origin: left center; animation: kp-grow .6s var(--ease) .15s both; }
  /* เมนูมือถือเปิดแบบเลื่อนลง */
  .sidenav.open .side-links { animation: kp-drop var(--dur) var(--ease) both; }
  .alert { animation: kp-drop var(--dur) var(--ease) both; }
}
@keyframes kp-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes kp-drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes kp-grow { from { transform: scaleX(0); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---- แท็บเล็ต/มือถือ (หน้าเจ้าหน้าที่) ---- */
.side-links a.side-m { display: none; border-top: 1px solid var(--line); }
@media (max-width: 899px) {
  .has-side .top-pw { display: none; }
  .side-links a.side-m { display: flex; }
  .has-side .brand small { display: none; }
}
/* จอสัมผัส: ปุ่ม ลิงก์เมนู และช่องกรอกสูงอย่างน้อย 44px */
@media (pointer: coarse) {
  .topnav a, .topnav button, .btn, .btn.small, .tabs a, .pager a { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .btn.block { display: flex; }
  .side-links a, .side-toggle, .side-grp-h { min-height: 48px; }
  input[type=text], input[type=password], input[type=email], input[type=url], input[type=search], input[type=tel], input[type=number], input[type=date], input[type=datetime-local], input[type=file], select { min-height: 44px; }
  details > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
}
/* ตัวกรองบนมือถือ: แสดงช่องค้นหา + ปุ่ม "ตัวกรองเพิ่มเติม" (JS ใส่ class) */
.f-more { display: none; }
@media (max-width: 640px) {
  .filters.f-collapsed > .f-opt { display: none; }
  .filters .f-more { display: inline-flex; align-items: center; gap: 6px; }
  .filters > div { flex-basis: 100%; }
}
/* ตารางกว้าง: คอลัมน์แรกติดซ้ายตอนเลื่อนข้าง */
@media (min-width: 641px) {
  .table-wrap table.list th:first-child, .table-wrap table.list td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--line-2); }
  .table-wrap table.list th:first-child { background: var(--surface-2); }
  .table-wrap table.list tr:hover td:first-child { background: var(--surface-3); }
  .dept-report tr.dept-row td:first-child { background: var(--surface-2); }
}
/* รายการบนมือถือ: แต่ละแถวเป็นการ์ด หัวคอลัมน์อยู่หน้าค่า (JS ใส่ data-label จากหัวตาราง) */
@media (max-width: 640px) {
  .table-wrap:has(> table.list.stack) { overflow: visible; background: transparent; box-shadow: none; padding: 0; }
  table.list.stack, table.list.stack tbody { display: block; }
  table.list.stack thead { display: none; }
  table.list.stack tr { display: block; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; box-shadow: 0 2px 8px var(--shadow); }
  table.list.stack td { display: block; position: relative; border: 0; padding: 4px 0 4px 8em; white-space: normal; min-height: 1.6em; }
  table.list.stack td::before { content: attr(data-label); position: absolute; left: 0; top: 5px; width: 7.5em; color: var(--muted); font-size: .85rem; font-weight: 600; line-height: 1.4; }
  table.list.stack td:not([data-label]), table.list.stack td[data-label=""] { padding-left: 0; }
  table.list.stack td:not([data-label])::before, table.list.stack td[data-label=""]::before { display: none; }
  table.list.stack tr:hover td { background: transparent; }
  table.list.stack td.mono { word-break: break-all; }
  table.list.stack td:empty { display: none; }
}

/* ---------------------------------------------------------------- กราฟ (ใช้ร่วมหน้าแรก + ภาพรวมเจ้าหน้าที่) */
.c1 { --k: var(--c1); } .c2 { --k: var(--c2); } .c3 { --k: var(--c3); } .rq { --k: var(--c-rq); } .rr { --k: var(--c-rr); } .rx { --k: var(--c-rx); } .rt { --k: var(--c-rt); }
.c-ok { --k: var(--c-ok); } .c-warn { --k: var(--c-warn); } .c-muted { --k: var(--c-muted); }
.ps-bar.c1, .ps-bar.c2, .ps-bar.c3, .fn-bar { background: var(--k, var(--c1)); }
.ps-bars li.masked .ps-track { background: repeating-linear-gradient(135deg, var(--c-track) 0 5px, var(--surface-2) 5px 10px); }
.ps-bars li.masked .ps-n { font-weight: 600; color: var(--muted); font-size: .85rem; white-space: nowrap; }
.ps-level h3 > span { display: inline-flex; align-items: center; gap: 6px; }
.ps-tile .dn-key { width: 16px; height: 16px; }
.ps-share { padding: 16px 16px 0; }
.dn-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--k, var(--c1)); flex: none; vertical-align: -1px; margin-right: 4px; }
.donut-box { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-fig { position: relative; width: 150px; height: 150px; flex: none; }
.donut { width: 100%; height: 100%; transform: rotate(0deg); }
.dn-track { stroke: var(--c-track); }
.dn-seg { stroke: var(--k); }
.dn-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1.15; }
.dn-center b { font-size: 1.6rem; color: var(--text); font-variant-numeric: tabular-nums; }
.dn-center span { font-size: .8rem; color: var(--muted); }
.dn-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 170px; flex: 1; }
.dn-legend li { display: flex; align-items: center; gap: 6px; }
.dn-legend .dn-name { flex: 1; color: var(--text); }
.dn-legend b { font-variant-numeric: tabular-nums; color: var(--text); }

.dash-todo { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.todo { display: grid; grid-template-columns: auto 1fr; grid-template-areas: 'n l' 'n go'; column-gap: 12px; align-items: center; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line-2); border-left: 5px solid var(--blue); border-radius: 12px; color: var(--text); text-decoration: none; }
.todo:hover { border-color: var(--blue); text-decoration: none; }
.todo.tone-warn { border-left-color: var(--gold); } .todo.tone-bad { border-left-color: var(--bad); }
.todo.done { border-left-color: var(--ok); }
.todo-n { grid-area: n; font-size: 2rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; min-width: 2ch; text-align: center; }
.todo.done .todo-n { color: var(--muted); }
.todo-l { grid-area: l; font-weight: 600; }
.todo-go { grid-area: go; font-size: .85rem; color: var(--blue); display: inline-flex; align-items: center; gap: 4px; }
.todo.done .todo-go { color: var(--ok); }
.todo-go svg { width: 1em; height: 1em; margin: 0; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.dash-card { margin: 0; }
.dash-card h2 { font-size: 1.05rem; margin: 0 0 12px; display: flex; align-items: center; gap: 6px; }
.dash-wide { grid-column: 1 / -1; }
.dash-money { margin: 12px 0 0; display: grid; gap: 6px; }
.dash-money div { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line-2); padding-top: 6px; }
.dash-money dt { color: var(--muted); } .dash-money dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.funnels { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.funnel { border: 1px solid var(--line-2); border-radius: 12px; padding: 12px; }
.funnel h3 { margin: 0 0 8px; font-size: 1rem; display: flex; align-items: center; }
.funnel ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.funnel li { display: grid; grid-template-columns: 7.5rem 1fr 3rem; gap: 8px; align-items: center; font-size: .92rem; }
.fn-track { height: 14px; background: var(--c-track); border-radius: 0 4px 4px 0; }
.fn-bar { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.fn-n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.dash-range { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.dash-range label { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.dash-range input { width: auto; }
.dash-data summary, .dc-table summary { cursor: pointer; font-weight: 600; }
.dc-table { margin-top: 6px; } .dc-table table { max-width: 360px; }

.dchart { margin: 14px 0 0; }
.dchart figcaption { margin-bottom: 8px; }
.dc-wrap { display: grid; grid-template-columns: auto 1fr; gap: 6px; }
.dc-y { display: flex; flex-direction: column; justify-content: space-between; height: 180px; font-size: .75rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; margin-top: -.5em; }
.dc-scroll { overflow-x: auto; padding-bottom: 26px; }
.dc-cols { display: flex; align-items: flex-end; gap: 2px; height: 180px; min-width: 100%; position: relative;
  border-bottom: 1px solid var(--line); background: linear-gradient(var(--line-2) 1px, transparent 1px) 0 0 / 100% 50%; }
.dc-col { flex: 1 1 0; min-width: 6px; height: 100%; display: flex; align-items: flex-end; position: relative; outline: none; }
.dc-cols.dense .dc-col { min-width: 4px; }
.dc-bar { display: block; width: 100%; background: var(--c1); border-radius: 3px 3px 0 0; min-height: 0; }
.tone-ok .dc-bar { background: var(--c-ok); }
.dc-col:hover .dc-bar, .dc-col:focus-visible .dc-bar { filter: brightness(1.15); outline: 2px solid var(--text); outline-offset: 1px; }
.dc-xl { position: absolute; top: 100%; left: 0; margin-top: 4px; font-size: .72rem; color: var(--muted); white-space: nowrap; }
.dc-col:hover::after, .dc-col:focus-visible::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--surface); font-size: .78rem; padding: 3px 8px; border-radius: 6px; white-space: nowrap; z-index: 3; pointer-events: none; }
.dc-col:first-child:hover::after, .dc-col:first-child:focus-visible::after { left: 0; transform: none; }
.dc-col:last-child:hover::after, .dc-col:last-child:focus-visible::after { left: auto; right: 0; transform: none; }
@media (max-width: 560px) {
  .donut-fig { width: 120px; height: 120px; }
  .funnel li { grid-template-columns: 6.5rem 1fr 2.6rem; }
  .todo-n { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .fn-bar, .ps-bar { transform-origin: left center; animation: kp-grow .6s var(--ease) .15s both; }
  .dc-bar { transform-origin: bottom center; animation: kp-growy .5s var(--ease) .1s both; }
}
@keyframes kp-growy { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@media print {
  .dash-range, .dc-table summary, .dash-todo .todo-go { display: none; }
  .dash-card, .dchart, .funnel { break-inside: avoid; }
}
@media (forced-colors: active) {
  .dc-bar, .fn-bar, .ps-bar, .dn-key { background: CanvasText; forced-color-adjust: none; }
}

.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 12px; }
.dept-box { border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; }
.dept-box h3 { margin: 0 0 6px; font-size: .98rem; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.dept-sum { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: .9rem; }
.dept-box ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.dept-box li { display: grid; grid-template-columns: minmax(0, 11rem) 1fr auto; gap: 8px; align-items: center; font-size: .88rem; }
.dp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-track { position: relative; height: 14px; background: transparent; border-left: 1px solid var(--line); }
.dp-cap, .dp-bar, .dp-rep { position: absolute; left: 0; top: 0; height: 100%; border-radius: 0 4px 4px 0; }
.dp-cap { background: var(--c-track); }
.dp-bar { background: var(--k, var(--c1)); }
.dp-rep { background: var(--c-ok); top: 4px; height: 6px; }
.dp-n { white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; font-size: .85rem; }
@media (max-width: 560px) { .dept-box li { grid-template-columns: 1fr auto; } .dp-track { grid-column: 1 / -1; grid-row: 2; } }

/* ความกว้าง/สูงของแท่งกราฟตามข้อมูล (CSP ห้าม style="" จึงใช้ class) */
.bw-0 { width: 0%; }
.bw-1 { width: 1%; }
.bw-2 { width: 2%; }
.bw-3 { width: 3%; }
.bw-4 { width: 4%; }
.bw-5 { width: 5%; }
.bw-6 { width: 6%; }
.bw-7 { width: 7%; }
.bw-8 { width: 8%; }
.bw-9 { width: 9%; }
.bw-10 { width: 10%; }
.bw-11 { width: 11%; }
.bw-12 { width: 12%; }
.bw-13 { width: 13%; }
.bw-14 { width: 14%; }
.bw-15 { width: 15%; }
.bw-16 { width: 16%; }
.bw-17 { width: 17%; }
.bw-18 { width: 18%; }
.bw-19 { width: 19%; }
.bw-20 { width: 20%; }
.bw-21 { width: 21%; }
.bw-22 { width: 22%; }
.bw-23 { width: 23%; }
.bw-24 { width: 24%; }
.bw-25 { width: 25%; }
.bw-26 { width: 26%; }
.bw-27 { width: 27%; }
.bw-28 { width: 28%; }
.bw-29 { width: 29%; }
.bw-30 { width: 30%; }
.bw-31 { width: 31%; }
.bw-32 { width: 32%; }
.bw-33 { width: 33%; }
.bw-34 { width: 34%; }
.bw-35 { width: 35%; }
.bw-36 { width: 36%; }
.bw-37 { width: 37%; }
.bw-38 { width: 38%; }
.bw-39 { width: 39%; }
.bw-40 { width: 40%; }
.bw-41 { width: 41%; }
.bw-42 { width: 42%; }
.bw-43 { width: 43%; }
.bw-44 { width: 44%; }
.bw-45 { width: 45%; }
.bw-46 { width: 46%; }
.bw-47 { width: 47%; }
.bw-48 { width: 48%; }
.bw-49 { width: 49%; }
.bw-50 { width: 50%; }
.bw-51 { width: 51%; }
.bw-52 { width: 52%; }
.bw-53 { width: 53%; }
.bw-54 { width: 54%; }
.bw-55 { width: 55%; }
.bw-56 { width: 56%; }
.bw-57 { width: 57%; }
.bw-58 { width: 58%; }
.bw-59 { width: 59%; }
.bw-60 { width: 60%; }
.bw-61 { width: 61%; }
.bw-62 { width: 62%; }
.bw-63 { width: 63%; }
.bw-64 { width: 64%; }
.bw-65 { width: 65%; }
.bw-66 { width: 66%; }
.bw-67 { width: 67%; }
.bw-68 { width: 68%; }
.bw-69 { width: 69%; }
.bw-70 { width: 70%; }
.bw-71 { width: 71%; }
.bw-72 { width: 72%; }
.bw-73 { width: 73%; }
.bw-74 { width: 74%; }
.bw-75 { width: 75%; }
.bw-76 { width: 76%; }
.bw-77 { width: 77%; }
.bw-78 { width: 78%; }
.bw-79 { width: 79%; }
.bw-80 { width: 80%; }
.bw-81 { width: 81%; }
.bw-82 { width: 82%; }
.bw-83 { width: 83%; }
.bw-84 { width: 84%; }
.bw-85 { width: 85%; }
.bw-86 { width: 86%; }
.bw-87 { width: 87%; }
.bw-88 { width: 88%; }
.bw-89 { width: 89%; }
.bw-90 { width: 90%; }
.bw-91 { width: 91%; }
.bw-92 { width: 92%; }
.bw-93 { width: 93%; }
.bw-94 { width: 94%; }
.bw-95 { width: 95%; }
.bw-96 { width: 96%; }
.bw-97 { width: 97%; }
.bw-98 { width: 98%; }
.bw-99 { width: 99%; }
.bw-100 { width: 100%; }
.bh-0 { height: 0%; }
.bh-1 { height: 1%; }
.bh-2 { height: 2%; }
.bh-3 { height: 3%; }
.bh-4 { height: 4%; }
.bh-5 { height: 5%; }
.bh-6 { height: 6%; }
.bh-7 { height: 7%; }
.bh-8 { height: 8%; }
.bh-9 { height: 9%; }
.bh-10 { height: 10%; }
.bh-11 { height: 11%; }
.bh-12 { height: 12%; }
.bh-13 { height: 13%; }
.bh-14 { height: 14%; }
.bh-15 { height: 15%; }
.bh-16 { height: 16%; }
.bh-17 { height: 17%; }
.bh-18 { height: 18%; }
.bh-19 { height: 19%; }
.bh-20 { height: 20%; }
.bh-21 { height: 21%; }
.bh-22 { height: 22%; }
.bh-23 { height: 23%; }
.bh-24 { height: 24%; }
.bh-25 { height: 25%; }
.bh-26 { height: 26%; }
.bh-27 { height: 27%; }
.bh-28 { height: 28%; }
.bh-29 { height: 29%; }
.bh-30 { height: 30%; }
.bh-31 { height: 31%; }
.bh-32 { height: 32%; }
.bh-33 { height: 33%; }
.bh-34 { height: 34%; }
.bh-35 { height: 35%; }
.bh-36 { height: 36%; }
.bh-37 { height: 37%; }
.bh-38 { height: 38%; }
.bh-39 { height: 39%; }
.bh-40 { height: 40%; }
.bh-41 { height: 41%; }
.bh-42 { height: 42%; }
.bh-43 { height: 43%; }
.bh-44 { height: 44%; }
.bh-45 { height: 45%; }
.bh-46 { height: 46%; }
.bh-47 { height: 47%; }
.bh-48 { height: 48%; }
.bh-49 { height: 49%; }
.bh-50 { height: 50%; }
.bh-51 { height: 51%; }
.bh-52 { height: 52%; }
.bh-53 { height: 53%; }
.bh-54 { height: 54%; }
.bh-55 { height: 55%; }
.bh-56 { height: 56%; }
.bh-57 { height: 57%; }
.bh-58 { height: 58%; }
.bh-59 { height: 59%; }
.bh-60 { height: 60%; }
.bh-61 { height: 61%; }
.bh-62 { height: 62%; }
.bh-63 { height: 63%; }
.bh-64 { height: 64%; }
.bh-65 { height: 65%; }
.bh-66 { height: 66%; }
.bh-67 { height: 67%; }
.bh-68 { height: 68%; }
.bh-69 { height: 69%; }
.bh-70 { height: 70%; }
.bh-71 { height: 71%; }
.bh-72 { height: 72%; }
.bh-73 { height: 73%; }
.bh-74 { height: 74%; }
.bh-75 { height: 75%; }
.bh-76 { height: 76%; }
.bh-77 { height: 77%; }
.bh-78 { height: 78%; }
.bh-79 { height: 79%; }
.bh-80 { height: 80%; }
.bh-81 { height: 81%; }
.bh-82 { height: 82%; }
.bh-83 { height: 83%; }
.bh-84 { height: 84%; }
.bh-85 { height: 85%; }
.bh-86 { height: 86%; }
.bh-87 { height: 87%; }
.bh-88 { height: 88%; }
.bh-89 { height: 89%; }
.bh-90 { height: 90%; }
.bh-91 { height: 91%; }
.bh-92 { height: 92%; }
.bh-93 { height: 93%; }
.bh-94 { height: 94%; }
.bh-95 { height: 95%; }
.bh-96 { height: 96%; }
.bh-97 { height: 97%; }
.bh-98 { height: 98%; }
.bh-99 { height: 99%; }
.bh-100 { height: 100%; }
.rep-img:not([hidden]) { display: contents; }

/* ===== หน้าแรกสาธารณะ: ป้ายรับสมัคร + วงแหวนรายระดับ ===== */
.ps-hero { display: flex; align-items: center; gap: 16px; min-height: 44px; padding: 18px 22px; border-radius: 16px; text-decoration: none;
  background: linear-gradient(135deg, var(--r-acc) 0%, var(--r-acc2) 100%); color: #fff; box-shadow: 0 6px 20px var(--shadow-2); border-left: 6px solid var(--gold); }
.ps-hero-txt { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.ps-hero-txt b { font-size: 1.6rem; line-height: 1.25; color: #fff; }
.ps-hero-txt span { font-size: .95rem; color: #fff; opacity: .92; }
.ps-hero-go { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; font-weight: 700;
  background: var(--gold); color: var(--on-gold); }
.ps-hero:hover, .ps-hero:focus-visible { color: #fff; text-decoration: none; }
.ps-hero:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.ps-hero-alt { margin: 10px 4px 16px; font-size: .95rem; color: var(--muted); }
.ps-hero-alt a { font-weight: 600; display: inline-block; padding: 10px 0; }
@media (prefers-reduced-motion: no-preference) {
  .ps-hero, .ps-hero-go { transition: transform 150ms var(--ease), box-shadow 150ms var(--ease); }
  .ps-hero:hover { transform: translateY(-2px); box-shadow: 0 10px 26px var(--shadow-2); }
  .ps-hero:hover .ps-hero-go { transform: translateX(4px); }
}
.pubstats .ps-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ps-rings { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; padding: 18px 16px 0; }
.ps-ring { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.ps-ring h3 { margin: 0; font-size: 1rem; color: var(--blue); display: flex; align-items: center; gap: 6px; }
.ps-ring .donut-fig { width: 120px; height: 120px; }
.ps-ring .dn-legend { min-width: 140px; }
.ps-ring-foot { list-style: none; margin: 0; padding: 8px 0 0; border-top: 1px solid var(--line); display: grid; gap: 4px; font-size: .92rem; }
.ps-ring-foot li { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.ps-ring-foot b { color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }
.ps-ring-note { margin: 0; font-size: .8rem; color: var(--muted); }
.ps-level > summary { list-style: none; cursor: pointer; min-height: 44px; margin: -4px 0 6px; font-size: 1rem; font-weight: 700; color: var(--blue);
  display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ps-level > summary::-webkit-details-marker { display: none; }
.ps-level > summary > span { display: inline-flex; align-items: center; gap: 6px; }
.ps-level > summary > span::before { content: "▸"; color: var(--muted); transition: transform 150ms; }
.ps-level[open] > summary > span::before { transform: rotate(90deg); }
.ps-level > summary small { font-weight: 600; color: var(--text); background: var(--bg); border-radius: 999px; padding: 1px 10px; white-space: nowrap; }
@media (max-width: 640px) {
  .ps-hero { padding: 16px; gap: 12px; }
  .ps-hero-txt b { font-size: 1.3rem; }
  .ps-hero-go { width: 44px; height: 44px; }
  .pubstats .ps-tiles { grid-template-columns: 1fr 1fr; }
  .pubstats .ps-tile.ps-main { grid-column: auto; }
  .ps-rings { grid-template-columns: 1fr; padding: 14px 12px 0; }
  .ps-ring .donut-box { flex-wrap: nowrap; gap: 14px; }
  .ps-ring .donut-fig { width: 96px; height: 96px; }
  .ps-ring .dn-center b { font-size: 1.2rem; }
  .ps-ring .dn-legend { min-width: 0; }
}
@media print { .ps-hero-go { display: none; } }
.ps-approx { font-size: .55em; font-weight: 600; color: var(--muted); }
.ps-long .dn-center b { font-size: 1rem; }

/* ผู้สมัครแก้ไขแล้ว รอตรวจซ้ำ (24 พ.ย. 2569): ป้ายในรายการ + แถบแจ้งเตือนหน้าภาพรวม/หน้ารายละเอียด (สีส้ม) */
.badge.revised { background: color-mix(in srgb, #f07c1b 16%, var(--surface)); color: #b84a06; display: inline-flex; align-items: center; gap: 3px; margin-top: 3px; }
.badge.revised .icn { width: .95em; height: .95em; }
.alert.revised-box { background: color-mix(in srgb, #f07c1b 12%, var(--surface)); border: 1px solid color-mix(in srgb, #f07c1b 45%, transparent); border-left: 5px solid #f07c1b; color: var(--text); }
.alert.revised-box .btn.small { margin-left: 8px; vertical-align: middle; }
.alert.revised-box q { font-weight: 600; }
@media screen and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.revised { color: #ffb06b; } }
:root[data-theme="dark"] .badge.revised { color: #ffb06b; }

/* ใบสมัคร: ค้นหาในรายการสาขาวิชาเดิม (ผู้จบ ปวช.) */
[data-major-box] .pm-find { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; color: var(--muted); }
[data-major-box] .pm-find input { flex: 1; min-width: 0; font-size: .95rem; background: var(--surface-2); border-style: dashed; }
[data-major-box] [data-major-text]:not([hidden]) { margin-top: 6px; }
/* กรอบแจ้งเตือนด้านบน: รายชื่อช่องที่ต้องแก้ (กดแล้วไปที่ช่อง) */
.err-list { margin: 6px 0 0; padding-left: 1.3em; }
.err-list li { margin: 2px 0; }
.linklike { font: inherit; background: none; border: 0; padding: 2px 0; color: var(--bad); text-decoration: underline; cursor: pointer; text-align: left; min-height: 32px; }
/* ช่องติ๊กที่ยังไม่ได้ติ๊ก: กรอบแดงรอบข้อความ ให้เห็นชัด */
.check-box { border-radius: 8px; }
.check-box.has-err { border: 2px solid var(--bad); background: var(--badbg); padding: 8px 10px; }
.check-box.has-err .check { color: var(--bad); font-weight: 600; }
.check-box.has-err input[type=checkbox] { outline: 2px solid var(--bad); outline-offset: 2px; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.needs-check-hint { flex-basis: 100%; }
/* ช่องรหัสผ่าน + ปุ่มลูกตา */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 48px; }
.pw-eye { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; color: var(--muted, #555); cursor: pointer; border-radius: 6px; }
.pw-eye:hover, .pw-eye:focus-visible { color: var(--blue); }
.pw-eye .icn { width: 22px; height: 22px; margin: 0; }
[data-err-summary], .has-err { scroll-margin-top: 90px; }
/* เตือนเมื่อพิมพ์ขีด/ตัวอักษรในช่องตัวเลข */
.digits-hint { color: var(--warn); background: var(--warnbg); border-radius: 6px; padding: 2px 8px; font-size: .88rem; margin-top: 4px; }
.alert.small-alert { padding: 6px 10px; margin: 6px 0 0; font-size: .92rem; }

/* ไฟล์ที่แนบแล้ว (เก็บไว้ในระบบ): ป้ายเขียวทึบ + ไอคอนชนิดไฟล์เป็นลิงก์ + เปิดดูไฟล์ (29 พ.ย. 2569) */
.file-kept { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; margin: 6px 0 4px; padding: 10px 12px; border-radius: 12px;
  background: var(--okbg); border: 2px solid var(--ok); }
.fk-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--ok); color: var(--on-acc); font-weight: 700; }
.fk-type { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 48px; min-height: 48px; padding: 4px 6px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; font-size: .72rem; font-weight: 700; letter-spacing: .04em; line-height: 1; }
.fk-type .icn { width: 26px; height: 26px; margin: 0; }
.fk-type.fk-pdf { color: var(--bad); }
.fk-type.fk-jpg, .fk-type.fk-png { color: var(--acc); }
.fk-type:hover, .fk-type:focus-visible { border-color: currentColor; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px currentColor; }
.fk-text { display: grid; gap: 2px; min-width: 0; flex: 1 1 180px; }
.fk-open { font-weight: 700; font-size: 1.05rem; color: var(--acc); }
.fk-meta { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.doc-have .file-kept { margin-bottom: 6px; }
.file-limit { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .8rem; font-weight: 600; white-space: nowrap; }
.pages-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 6px 0; font-size: .92rem; color: var(--muted); }
.pages-bar .pages-n { font-weight: 600; color: var(--text); }
/* ตารางเทียบรอบโควตา/รอบปกติ ในหน้าขั้นตอนการสมัคร (28 พ.ย. 2569) */
.kp-front .kp-rounds tbody th { background: var(--surface-2); color: var(--text); text-align: left; white-space: nowrap; font-weight: 600; }
.kp-front .kp-rounds td { vertical-align: top; }

/* ตรวจใบสมัครในกรอบเดียว ปุ่มบันทึกเดียว (29 พ.ย. 2569) */
.doc-view > .check-form { grid-column: 1 / -1; }
.check-grid { display: grid; gap: 14px; grid-template-columns: 1fr; margin-top: 8px; }
@media (min-width: 1100px) { .check-grid { grid-template-columns: repeat(3, 1fr); } }
.check-sec { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); min-width: 0; }
.check-sec legend { font-family: 'Kanit', sans-serif; font-weight: 500; font-size: 1.05rem; padding: 0 6px; display: inline-flex; align-items: center; gap: 8px; }
.step-no { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; font-size: .9rem; }
.quick-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.chip-n { display: inline-block; min-width: 1.6em; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: .85rem; text-align: center; }
.btn:not(.light) .chip-n { background: rgba(255, 255, 255, .25); color: #fff; }
.badge.round-quota { background: var(--okbg); }
/* รูปแบบการเรียนในรายการใบสมัคร: ทวิภาคีเด่นกว่า ปกติ (29 พ.ย. 2569) */
.badge.mode-dual { background: var(--gold-soft); color: var(--gold-text); border: 1px solid var(--gold); }
.badge.mode-normal { background: var(--acc-soft); color: var(--blue); border: 1px solid color-mix(in srgb, var(--blue) 40%, transparent); }
@media (min-width: 640px) { .bulk-filters .span2 { grid-column: span 2; } }
.dtbe.dbe { display: inline-flex; }
.dash-date { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* ตารางบนแท็บเล็ต (641-1100px): ชื่อไม่ขึ้นบรรทัดถี่ ปุ่มในตารางขึ้นบรรทัดใหม่ได้แทนการถูกตัด (29 พ.ย. 2569) */
@media (min-width: 641px) {
  table.list td.cell-name { min-width: 10em; }
  table.list td.cell-paid { min-width: 9.5em; }
  table.list td.cell-act { min-width: 9em; }
  table.list td .btn { white-space: normal; text-align: center; line-height: 1.3; }
}
@media (min-width: 641px) and (max-width: 1100px) {
  table.list th, table.list td { padding-left: 6px; padding-right: 6px; }
  table.list th { white-space: normal; }
}
/* ช่องเลือกไฟล์ภาษาไทย (app.js สร้าง .file-ui แทนปุ่มของเบราว์เซอร์) */
input[type=file].file-native { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; min-height: 0; }
.file-ui { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; padding: 6px 8px; border: 1px solid var(--field-bd); border-radius: 10px; background: var(--surface); }
.file-ui .file-name { color: var(--muted); overflow-wrap: anywhere; min-width: 0; }
.file-ui.has-file .file-name { color: var(--text); font-weight: 600; }
label .file-ui { margin-top: 4px; font-weight: 400; }
.refund-ack { border: 2px solid var(--gold); }
.refund-text { font-size: 1.08rem; margin: 8px 0; }

/* จอสัมผัส (มือถือ/แท็บเล็ต): ปุ่มและลิงก์ที่ต้องกด สูงอย่างน้อย 44px — ผลตรวจระบบ 29 พ.ย. 2569 */
@media (pointer: coarse) {
  .btn.small, input[type=file]::file-selector-button, .file-pick, .topnav a, .topnav button, .theme-btn { min-height: 44px; }
  .auth-links a, .form-links a, .lh-links a, .lh-menu summary { display: inline-flex; align-items: center; min-height: 44px; }
  .lh-btn-sm, .lh-brand { min-height: 44px; }
}

/* แถบประกาศปิดปรับปรุงระบบ (30 พ.ย. 2569) */
.maint-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex; gap: 8px; align-items: flex-start; justify-content: center; padding: 12px 16px; background: var(--warnbg); color: var(--warn); border-top: 2px solid currentColor; font-weight: 600; line-height: 1.5; }
.maint-bar[hidden] { display: none; }
.maint-bar.closed { background: var(--badbg); color: var(--bad); }
.maint-bar.reopened { background: var(--okbg); color: var(--ok); }
.maint-bar .icn { flex: none; margin-top: 3px; }
body.has-maint { padding-bottom: var(--maint-h, 96px); }
body.has-maint .save-bar { bottom: var(--maint-h, 96px); }
.maint-page { text-align: center; margin-top: 32px; }
.maint-page .btn-row { justify-content: center; }
@media print { .maint-bar { display: none; } body.has-maint { padding-bottom: 0; } }
/* รายงานรหัสนักศึกษา (2 ธ.ค. 2569) */
.sid-progs summary { cursor: pointer; font-weight: 700; margin: 8px 0; }
.sid-progs .table-wrap { max-height: 360px; overflow: auto; }
.sid-total td { background: var(--surface-2); }
/* บัญชีรายชื่อนักศึกษาแยกกลุ่ม (2 ธ.ค. 2569) */
.rl-block { margin-top: 18px; }
.rl-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.rl-screen th, .rl-screen td { border: 1px solid var(--line); }
table.rl-screen th { text-align: center; }
table.rl-screen td.c { text-align: center; }
.rl-sum { text-align: right; margin-top: 4px; }
/* ตัวเลขที่คลิกไปดูรายชื่อได้ (รายงานรหัสนักศึกษา 2 ธ.ค. 2569) */
a.num-link { color: inherit; text-decoration: underline; text-underline-offset: 3px; display: inline-block; min-width: 24px; text-align: center; }
a.num-link:hover { color: var(--acc, inherit); }
