/* ──────────────────────────────────────────────────────────────────────────
   course_st.php — โครงสร้างหลักสูตรการศึกษา
   โรงเรียนเทศบาล ๑ กิตติขจร

   รอบ 24 ก.ย. 2569: ภาษาภาพเดียวกับ /zerodropout/ หน้าแรก แดชบอร์ดบุคลากร และปฏิทินการศึกษา
       หัวหน้าน้ำเงินไล่เฉดเต็มจอ ปีของหลักสูตรแกนกลาง (2551) จาง ๆ เป็นลายน้ำ การ์ดกระจก
       "ความครบถ้วนของทะเบียน" (วง + สถานะสามระดับ + โครงสร้างที่บันทึกน้อยที่สุด) แถบตัวเลข
       แล้วแผงลอยทับขอบล่าง: ผังความครบถ้วน แผน x ชั้น · ตัวกรอง · การ์ดแผนการเรียนพร้อมตารางสองภาคเรียน

   ★ โทเคนของหน้าทุกตัวเป็น alias ที่ชี้ไป --tb1-* โหมดมืดจึงพลิกให้เอง
   ★ หน้านี้แนบ css/tb1-display-scale.css (ผ่าน nvabar) โหมดคอนทราสต์สูงพื้นฐานมาจากไฟล์นั้น
   ★ สถานะของโครงสร้างบอกด้วยตัวอักษรเสมอ สีแดงของ "ต่ำกว่าครึ่งเกณฑ์" มีไอคอนสามเหลี่ยมกำกับ
   ★ ธีมกลางบังคับ font-family บน span div li p a ด้วย !important ตัวเซริฟจึงอยู่ที่ h1–h3 และ b
   ★ ไม่มี opacity:0 เป็นสถานะพัก ที่ขยับได้มีแค่ตำแหน่งและความยาวแถบ (สคริปต์ติด cst-motion ก่อนเท่านั้น)
   ★ ห้ามตั้ง display บน <caption> · ห้ามใช้ <footer> ในหน้า (ไฟล์กลางทาพื้นดำให้ footer ทุกตัว)
   ★ ทุก selector ขึ้นต้นด้วย cst- ไม่ชนกับหน้าอื่นหรือไฟล์กลาง (css/tb1-curriculum.css เป็นของ course_detail.php)
   ────────────────────────────────────────────────────────────────────────── */

body.cst-page {
    margin: 0;
    background: var(--tb1-page, #f8fafc);
    color: var(--tb1-ink-2, #334155);
}

html:has(body.cst-page) {
    scroll-padding-top: 5rem;
}

/* ★ ลิงก์ข้ามไปเนื้อหาซ่อนด้วย clip ไม่ใช่ left:-9999px ซึ่งไปโดนตัวตรวจล้นแนวนอน */
body.cst-page a.cst-skip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10000;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

body.cst-page a.cst-skip:focus {
    width: auto;
    height: auto;
    padding: 10px 18px;
    clip-path: none;
    color: #ffffff;
    background: var(--tb1-banner-1, #1d4ed8);
    border-radius: 0 0 10px 0;
    font-weight: 600;
    text-decoration: none;
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

main.cst {
    display: block;
}

main.cst:focus {
    outline: none;
}

/* ── โทเคนของหน้า ─────────────────────────────────────────────────────── */
.cst {
    --cst-paper: var(--tb1-surface, #ffffff);
    --cst-paper-alt: var(--tb1-surface-alt, #f1f5f9);
    --cst-ink: var(--tb1-ink-1, #0f172a);
    --cst-ink-2: var(--tb1-ink-2, #334155);
    --cst-muted: var(--tb1-ink-3, #5a697f);
    --cst-line: var(--tb1-border, #e2e8f0);
    --cst-line-bold: var(--tb1-border-bold, #cbd5e1);
    --cst-field-line: color-mix(in srgb, var(--tb1-ink-3, #5a697f) 85%, var(--tb1-surface, #ffffff));
    --cst-brand: var(--tb1-brand, #1d4ed8);
    --cst-brand-soft: color-mix(in srgb, var(--tb1-brand, #1d4ed8) 10%, var(--tb1-surface, #ffffff));
    --cst-brand-line: color-mix(in srgb, var(--tb1-brand, #1d4ed8) 35%, var(--tb1-border, #e2e8f0));
    --cst-on-brand: var(--tb1-on-brand, #ffffff);
    /* ★ text-danger ของโหมดสว่าง (#dc2626) บนพื้นแดงอ่อนได้ 4.2:1 ไม่ผ่าน AA จึงใช้เฉดเข้มกว่า */
    --cst-err: #b91c1c;
    --cst-err-soft: color-mix(in srgb, #dc2626 8%, var(--tb1-surface, #ffffff));
    --cst-err-line: color-mix(in srgb, #dc2626 35%, var(--tb1-border, #e2e8f0));
    --cst-ok: var(--tb1-text-success, #047857);
    --cst-ok-soft: color-mix(in srgb, #10b981 11%, var(--tb1-surface, #ffffff));
    --cst-ok-line: color-mix(in srgb, #10b981 40%, var(--tb1-border, #e2e8f0));
    --cst-warn: #92400e;
    --cst-warn-soft: color-mix(in srgb, #f59e0b 13%, var(--tb1-surface, #ffffff));
    --cst-warn-line: color-mix(in srgb, #f59e0b 45%, var(--tb1-border, #e2e8f0));
    --cst-on-hero-2: #e0e7ff;
    --cst-gold-text: #fde68a;
    --cst-serif: var(--tb1-font-display, "Noto Sans Thai Looped", sans-serif);
    --cst-sans: var(--tb1-font-body, "Sarabun", system-ui, sans-serif);
    --cst-ease: cubic-bezier(.4, 0, .2, 1);
    --cst-spring: cubic-bezier(.22, 1, .36, 1);
    --cst-gap: clamp(16px, 2vw, 24px);
    --cst-gutter: var(--tb1-shell-gutter, 20px);
    --cst-shadow: 0 14px 32px -24px rgba(15, 23, 42, .55), inset 0 1px 0 rgba(255, 255, 255, .6);
    --cst-shadow-float: 0 30px 60px -34px rgba(15, 23, 42, .7), inset 0 1px 0 rgba(255, 255, 255, .6);
    --cst-hero-a: color-mix(in srgb, var(--tb1-banner-1, #1d4ed8) 60%, var(--tb1-ink-surface, #0f172a));
    --cst-hero-b: var(--tb1-banner-1, #1d4ed8);
    --cst-hero-c: color-mix(in srgb, var(--tb1-banner-1, #1d4ed8) 78%, var(--tb1-accent-strong, #0284c7));
    --cst-primary: var(--tb1-banner-1, #1d4ed8);
    --cst-primary-2: color-mix(in srgb, var(--tb1-banner-1, #1d4ed8) 70%, #020617);

    color: var(--cst-ink-2);
    font-family: var(--cst-sans);
    font-size: 1rem;
    line-height: 1.6;
}

:is(html.dark, html.dark-mode, html[data-theme="dark"],
    body.dark-mode, body[data-theme="dark"]) .cst {
    --cst-err: var(--tb1-text-danger, #fda4af);
    --cst-err-soft: color-mix(in srgb, #f87171 12%, var(--tb1-surface, #111c31));
    --cst-err-line: color-mix(in srgb, #f87171 40%, var(--tb1-border, #1e2d4a));
    --cst-ok-soft: color-mix(in srgb, #34d399 12%, var(--tb1-surface, #111c31));
    --cst-ok-line: color-mix(in srgb, #34d399 40%, var(--tb1-border, #1e2d4a));
    --cst-warn: var(--tb1-text-warning, #fbbf24);
    --cst-warn-soft: color-mix(in srgb, #f59e0b 13%, var(--tb1-surface, #111c31));
    --cst-warn-line: color-mix(in srgb, #f59e0b 42%, var(--tb1-border, #1e2d4a));
    --cst-brand-soft: color-mix(in srgb, var(--tb1-brand, #60a5fa) 16%, var(--tb1-surface, #111c31));
    --cst-field-line: color-mix(in srgb, var(--tb1-ink-3, #94a3b8) 70%, var(--tb1-surface, #111c31));
    --cst-shadow: 0 14px 32px -22px rgba(0, 0, 0, .75), inset 0 1px 0 rgba(255, 255, 255, .055);
    --cst-shadow-float: 0 30px 60px -30px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .06);
    /* โหมดมืด: banner เป็นกรมท่าเข้ม เติมน้ำเงินสดที่ปลายไล่เฉดให้หัวหน้ามีมิติ แบบเดียวกับหน้าแรก */
    --cst-hero-a: #050d22;
    --cst-hero-c: color-mix(in srgb, #1d4ed8 42%, var(--tb1-banner-1, #0e1f45));
    /* ปุ่มหลักบนแผงสีเข้ม: กรมท่าแทบกลืนกับพื้นแผง จึงใช้น้ำเงินสด (ตัวขาวได้ 5.2:1) */
    --cst-primary: #2563eb;
    --cst-primary-2: #1d4ed8;
    color-scheme: dark;
}

.cst *,
.cst *::before,
.cst *::after {
    box-sizing: border-box;
}

.cst :where(h1, h2, h3, h4, p, ul, ol, li, dl, dt, dd, figure, fieldset, legend) {
    margin: 0;
}

.cst :where(ul, ol) {
    list-style: none;
    padding: 0;
}

/* ธีมรวมตั้ง display ให้ element หลายชนิด [hidden] ต้องชนะเสมอ */
.cst [hidden] {
    display: none !important;
}

.cst .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.cst :focus-visible {
    outline: 3px solid var(--cst-brand);
    outline-offset: 2px;
}

.cst-icon {
    display: block;
    flex: none;
    width: 1.15em;
    height: 1.15em;
}

.cst-wrap {
    width: 100%;
    max-width: var(--tb1-page-max-width, 1440px);
    margin-inline: auto;
    padding-inline: var(--cst-gutter);
}

/* ── ปุ่ม ───────────────────────────────────────────────────────────────── */
.cst-acts {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
}

.cst .cst-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 2.75rem;
    padding: 0 1.2rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font: inherit;
    font-size: .96rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s var(--cst-ease), border-color .2s var(--cst-ease), box-shadow .2s var(--cst-ease), color .2s var(--cst-ease);
}

.cst .cst-btn:active {
    transform: translateY(1px);
}

.cst .cst-btn-light {
    color: var(--tb1-banner-1, #1d4ed8);
    background: #ffffff;
    border-color: #ffffff;
    box-shadow: 0 12px 26px -16px rgba(2, 6, 23, .7);
}

.cst .cst-btn-light:hover {
    background: #eef2ff;
    border-color: #eef2ff;
}

/* ★ พื้นขาว .12 บนน้ำเงิน ตัวขาวยังเกิน 4.5:1 ชี้แล้วพื้นเข้มขึ้น (ถ้าสว่างขึ้นจะต่ำกว่า 4.5:1) */
.cst .cst-btn-glass {
    color: #ffffff;
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .45);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.cst .cst-btn-glass:hover {
    background: rgba(2, 6, 23, .2);
    border-color: #ffffff;
}

.cst .cst-link {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    color: var(--cst-brand);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ── สีของสถานะและหมวดรายวิชา ──────────────────────────────────────────────
   ★ ทุกสีเป็นสีตัวอักษรบนกระดาษ ผ่าน 4.5:1 ทั้งสองโหมด ไม่ถมพื้นด้วยสีเดียวกับตัวอักษร */
.cst {
    --cst-s-thin: #b91c1c;
    --cst-s-half: var(--cst-brand);
    --cst-s-full: #047857;
    --cst-k-core: #1d4ed8;
    --cst-k-extra: #0f766e;
    --cst-k-free: #6d28d9;
    --cst-k-act: #b45309;
}

:is(html.dark, html.dark-mode, html[data-theme="dark"],
    body.dark-mode, body[data-theme="dark"]) .cst {
    --cst-s-thin: #fda4af;
    --cst-s-half: #93c5fd;
    --cst-s-full: #6ee7b7;
    --cst-k-core: #93c5fd;
    --cst-k-extra: #5eead4;
    --cst-k-free: #c4b5fd;
    --cst-k-act: #fbbf24;
}

.cst .is-k-core {
    --cst-kc: var(--cst-k-core);
}

.cst .is-k-extra {
    --cst-kc: var(--cst-k-extra);
}

.cst .is-k-free {
    --cst-kc: var(--cst-k-free);
}

.cst .is-k-act {
    --cst-kc: var(--cst-k-act);
}

.cst .is-thin {
    --cst-sc: var(--cst-s-thin);
}

.cst .is-half {
    --cst-sc: var(--cst-s-half);
}

.cst .is-full {
    --cst-sc: var(--cst-s-full);
}

/* ═══════════════════════════════════════════════════════════════════════
   หัวหน้า: น้ำเงินไล่เฉดเต็มจอ ปีของหลักสูตรแกนกลางเป็นลายน้ำ
   ═══════════════════════════════════════════════════════════════════════ */

.cst-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding-block: clamp(26px, 3.4vw, 48px) clamp(92px, 8vw, 118px);
    color: #ffffff;
    /* ★ สีพื้นทึบอยู่ใต้ไล่เฉด ตัวตรวจคอนทราสต์อ่านค่านี้ และเป็นสีที่เห็นจริงตรงกลางหัวหน้า */
    background-color: var(--cst-hero-b);
    background-image: linear-gradient(135deg, var(--cst-hero-a) 0%, var(--cst-hero-b) 52%, var(--cst-hero-c) 100%);
}

.cst-hero.is-plain {
    padding-bottom: clamp(80px, 7vw, 100px);
}

.cst-hero::before,
.cst-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.cst-hero::before {
    background-image:
        radial-gradient(circle at 14% 22%, rgba(255, 255, 255, .09) 0%, transparent 42%),
        radial-gradient(circle at 58% 118%, rgba(56, 189, 248, .12) 0%, transparent 46%);
}

/* เส้นตารางบางแบบใบโครงสร้างเวลาเรียน (ตกแต่ง) */
.cst-hero::after {
    background-image:
        linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
    background-size: 48px 48px;
    -webkit-mask-image: linear-gradient(180deg, #000000 30%, transparent);
    mask-image: linear-gradient(180deg, #000000 30%, transparent);
}

.cst-hero-fx {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.cst-orb {
    position: absolute;
    display: block;
    border-radius: 50%;
}

.cst-orb.is-a {
    top: -14rem;
    right: -10rem;
    width: 38rem;
    height: 38rem;
    background: radial-gradient(circle, rgba(96, 165, 250, .24) 0%, rgba(96, 165, 250, 0) 68%);
}

.cst-orb.is-b {
    bottom: -12rem;
    left: -10rem;
    width: 30rem;
    height: 30rem;
    background: radial-gradient(circle, rgba(56, 189, 248, .14) 0%, rgba(56, 189, 248, 0) 68%);
}

:is(html.dark, html.dark-mode, html[data-theme="dark"], body.dark-mode) .cst-orb.is-a {
    background: radial-gradient(circle, rgba(59, 130, 246, .32) 0%, rgba(59, 130, 246, 0) 68%);
}

/* ปีของหลักสูตรเป็นลายน้ำ: ตัวกลวง (ขอบขาวจาง) ไม่ใช่ข้อความที่ต้องอ่าน จึงอยู่ใน aria-hidden */
.cst-watermark {
    position: absolute;
    right: clamp(-2rem, 2vw, 3rem);
    bottom: clamp(3.5rem, 6vw, 5.5rem);
    font-family: var(--cst-serif);
    font-size: clamp(7rem, 4rem + 11vw, 15rem);
    font-weight: 700;
    line-height: .8;
    letter-spacing: -.02em;
    color: transparent;
    -webkit-text-stroke: 1.5px rgba(255, 255, 255, .13);
    white-space: nowrap;
    user-select: none;
}

.cst-hero :focus-visible {
    outline-color: #ffffff;
}

.cst-hero-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 26px clamp(28px, 3.6vw, 60px);
}

@media (min-width: 1024px) {
    .cst-hero-top {
        grid-template-columns: minmax(0, 1fr) minmax(21rem, 27rem);
    }
}

.cst-hero-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.cst-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.cst-tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    padding: 3px 14px;
    font-size: .86rem;
    font-weight: 500;
    line-height: 1.4;
    color: #ffffff;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

/* ★ ตัวทองบนกระจกขาวได้แค่ 4.3:1 ในโหมดสว่าง ป้ายเตือนจึงเป็นกระจกเข้ม (เกิน 6:1) */
.cst-tag.is-warn {
    font-weight: 600;
    color: var(--cst-gold-text);
    background: rgba(2, 6, 23, .26);
    border-color: rgba(253, 230, 138, .45);
}

.cst-title {
    font-family: var(--cst-serif);
    font-size: clamp(2.1rem, 1.2rem + 3vw, 3.5rem);
    font-weight: 600;
    line-height: 1.15;
    color: #ffffff;
    text-wrap: balance;
    text-shadow: 0 2px 20px rgba(2, 6, 23, .3);
}

.cst-title-y {
    display: block;
    margin-top: 6px;
    font-size: .5em;
    font-weight: 500;
    color: #dbeafe;
}

.cst-lead {
    max-width: 42rem;
    margin-top: 12px;
    font-size: clamp(1rem, .95rem + .3vw, 1.12rem);
    line-height: 1.7;
    color: var(--cst-on-hero-2);
}

/* ── ทางลัดไประดับชั้น: ชิปกระจก ลิงก์ธรรมดา ─────────────────────────── */
.cst-jump {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-top: 20px;
}

.cst-jump-k {
    font-size: .86rem;
    color: var(--cst-on-hero-2);
}

.cst-jump-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cst .cst-jchip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 2.5rem;
    padding: 0 6px 0 14px;
    color: #ffffff;
    text-decoration: none;
    background: rgba(2, 6, 23, .18);
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 999px;
    transition: background-color .2s var(--cst-ease), border-color .2s var(--cst-ease);
}

.cst .cst-jchip b {
    font-size: 1rem;
    font-weight: 700;
}

.cst-jchip-n {
    min-width: 1.9rem;
    padding: 1px 8px;
    font-size: .8rem;
    font-weight: 600;
    text-align: center;
    color: #ffffff;
    background: rgba(255, 255, 255, .14);
    border-radius: 999px;
}

.cst .cst-jchip:hover {
    background: rgba(2, 6, 23, .32);
    border-color: #ffffff;
}

.cst-hero-main .cst-acts {
    margin-top: 20px;
}

/* ═══════════════════════════════════════════════════════════════════════
   การ์ดกระจกขวา: ความครบถ้วนของทะเบียน และโครงสร้างที่บันทึกไว้น้อยที่สุด
   ═══════════════════════════════════════════════════════════════════════ */

.cst-glance {
    display: grid;
    gap: 14px;
    min-width: 0;
    padding: 18px;
    color: #ffffff;
    background: rgba(2, 6, 23, .3);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 24px;
    box-shadow: 0 30px 60px -32px rgba(2, 6, 23, .85), inset 0 1px 0 rgba(255, 255, 255, .14);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.cst-glance-sec + .cst-glance-sec {
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, .16);
}

.cst-glance-k {
    margin-bottom: 10px;
    font-family: var(--cst-serif);
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.4;
    color: #ffffff;
}

.cst-ring-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 16px;
}

.cst-ring {
    position: relative;
    display: grid;
    place-items: center;
    width: 6.5rem;
    height: 6.5rem;
}

.cst-ring svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.cst-ring-bg,
.cst-ring-fg {
    fill: none;
    stroke-width: 9;
}

.cst-ring-bg {
    stroke: rgba(255, 255, 255, .16);
}

.cst-ring-fg {
    stroke: #ffffff;
    stroke-linecap: round;
}

.cst-ring-n {
    position: relative;
    font-family: var(--cst-serif);
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
}

.cst-ring-n small {
    font-size: .58em;
    font-weight: 600;
}

.cst-ring-t {
    font-size: .88rem;
    line-height: 1.6;
    color: var(--cst-on-hero-2);
}

/* สถานะสามระดับของทุกโครงสร้าง: แถบซ้อนตามจำนวน + ตัวเลขเป็นข้อความเสมอ */
.cst-split {
    display: flex;
    gap: 3px;
    height: 10px;
    margin-top: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    transform-origin: left center;
}

.cst-split-seg {
    flex: 1 1 0;
    min-width: 6px;
}

.cst-split-seg.is-full,
.cst-split-key .is-full i {
    background: #4ade80;
}

.cst-split-seg.is-half,
.cst-split-key .is-half i {
    background: #93c5fd;
}

/* ต่ำกว่าครึ่ง: ลายทแยง ไม่ใช่สีอย่างเดียว */
.cst-split-seg.is-thin,
.cst-split-key .is-thin i {
    background: repeating-linear-gradient(135deg, #fca5a5 0 3px, #f87171 3px 6px);
}

.cst-split-key {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 10px;
}

.cst-split-key li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 2px 7px;
    font-size: .78rem;
    line-height: 1.35;
    color: var(--cst-on-hero-2);
}

.cst-split-key i {
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.cst-split-key b {
    grid-column: 2;
    font-family: var(--cst-serif);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.1;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
}

.cst .cst-weak-a {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 12px 14px 12px 12px;
    color: #ffffff;
    text-decoration: none;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 16px;
    transition: background-color .2s var(--cst-ease), border-color .2s var(--cst-ease);
}

.cst .cst-weak-a:hover {
    background: rgba(2, 6, 23, .22);
    border-color: rgba(255, 255, 255, .5);
}

/* แผ่นขาวตัวเลขใหญ่ (แบบเดียวกับนับถอยหลังของปฏิทิน) */
.cst-count {
    display: grid;
    place-items: center;
    align-content: center;
    min-width: 5.2rem;
    padding: 8px 10px;
    color: #7f1d1d;
    text-align: center;
    background: linear-gradient(160deg, #ffffff 0%, #fee2e2 100%);
    border-radius: 16px;
    box-shadow: 0 16px 30px -18px rgba(2, 6, 23, .9);
}

.cst-count b {
    font-family: var(--cst-serif);
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
}

.cst-count-k {
    font-size: .76rem;
    font-weight: 600;
    line-height: 1.3;
}

.cst-weak-t {
    display: grid;
    justify-items: start;
    gap: 4px;
    min-width: 0;
}

.cst-weak-t > b {
    font-family: var(--cst-serif);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.cst-weak-t > span {
    font-size: .84rem;
    line-height: 1.5;
    color: var(--cst-on-hero-2);
}

.cst-glance-more {
    margin-top: 8px;
    font-size: .84rem;
    line-height: 1.6;
    color: var(--cst-on-hero-2);
}

.cst .cst-glance-more a {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    color: #ffffff;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ═══════════════════════════════════════════════════════════════════════
   แถบตัวเลข: กระจกเข้มแถวเดียว (แบบเดียวกับแดชบอร์ดและปฏิทิน)
   ═══════════════════════════════════════════════════════════════════════ */

.cst-band {
    margin-top: clamp(24px, 2.6vw, 34px);
}

.cst-stats {
    display: grid;
    grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr));
    overflow: hidden;
    background: rgba(2, 6, 23, .28);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 22px;
    box-shadow: 0 30px 60px -34px rgba(2, 6, 23, .85), inset 0 1px 0 rgba(255, 255, 255, .12);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

/* เส้นคั่นเป็นเงานอกด้านซ้ายและบนของทุกช่อง ขอบแถบตัดส่วนที่ล้นทิ้ง เหลือเฉพาะเส้นระหว่างช่อง */
.cst-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
    padding: 16px clamp(14px, 1.4vw, 22px) 18px;
    box-shadow: -1px 0 0 0 rgba(255, 255, 255, .16), 0 -1px 0 0 rgba(255, 255, 255, .16);
}

.cst-stat-ic {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: 4px;
    color: #1d4ed8;
    background: linear-gradient(150deg, #ffffff 0%, #dbeafe 100%);
    border-radius: 13px;
    box-shadow: 0 14px 26px -16px rgba(2, 6, 23, .9);
}

.cst-stat.is-warn .cst-stat-ic {
    color: #92400e;
    background: linear-gradient(150deg, #ffffff 0%, #fef3c7 100%);
}

.cst-stat-k {
    font-size: .86rem;
    line-height: 1.4;
    color: var(--cst-on-hero-2);
}

.cst-stat-v {
    font-size: .92rem;
    line-height: 1.25;
    color: var(--cst-on-hero-2);
}

.cst-stat-v b {
    font-family: var(--cst-serif);
    font-size: clamp(1.6rem, 1.15rem + 1.1vw, 2.15rem);
    font-weight: 600;
    line-height: 1.15;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
}

/* ตัวเลขที่ต้องจัดการ: ทองบนกระจกเข้ม (ตัวทองอยู่บนพื้นเข้มเท่านั้น) */
.cst-stat.is-warn .cst-stat-v b {
    color: var(--cst-gold-text);
}

.cst-stat-s {
    font-size: .78rem;
    line-height: 1.45;
    color: var(--cst-on-hero-2);
}

/* ═══════════════════════════════════════════════════════════════════════
   ส่วนเนื้อหา: แผงแรกลอยทับขอบล่างของหัวหน้า
   ═══════════════════════════════════════════════════════════════════════ */

.cst-body {
    position: relative;
    z-index: 1;
    display: grid;
    gap: var(--cst-gap);
    margin-top: -68px;
    padding-bottom: clamp(40px, 5vw, 72px);
}

.cst-panel {
    min-width: 0;
    background: var(--cst-paper);
    border: 1px solid var(--cst-line);
    border-radius: 22px;
    box-shadow: var(--cst-shadow-float);
    scroll-margin-top: 5.5rem;
}

.cst-panel:focus {
    outline: none;
}

.cst-panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--cst-line);
    border-radius: 22px 22px 0 0;
    background: linear-gradient(180deg, var(--cst-brand-soft) 0%, var(--cst-paper) 100%);
}

.cst-panel-ic {
    display: grid;
    place-items: center;
    flex: none;
    width: 2.6rem;
    height: 2.6rem;
    color: #ffffff;
    background: linear-gradient(145deg, var(--cst-hero-c) 0%, var(--cst-hero-b) 100%);
    border-radius: 14px;
    box-shadow: 0 12px 22px -14px rgba(15, 23, 42, .8);
}

.cst-panel-title {
    flex: 1 1 16rem;
    min-width: 0;
    font-family: var(--cst-serif);
    font-size: 1.18rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--cst-ink);
}

.cst-panel-sub {
    display: block;
    margin-top: 1px;
    font-size: .84rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--cst-muted);
}

.cst-panel-body {
    padding: 18px 20px 22px;
}

.cst-lede {
    max-width: 62rem;
    margin-bottom: 16px;
    font-size: .92rem;
    line-height: 1.75;
    color: var(--cst-ink-2);
}

/* ── ประกาศ ─────────────────────────────────────────────────────────────── */
.cst-note {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    color: var(--cst-ink-2);
    background: var(--cst-paper);
    border: 1px solid var(--cst-line);
    border-radius: 18px;
    box-shadow: var(--cst-shadow-float), inset 5px 0 0 var(--cst-note-bar, var(--cst-brand));
}

.cst-note.is-warn {
    --cst-note-bar: #d97706;
    background: var(--cst-warn-soft);
    border-color: var(--cst-warn-line);
}

.cst-note-ic {
    display: grid;
    place-items: center;
    flex: none;
    width: 2.4rem;
    height: 2.4rem;
    color: #ffffff;
    background: var(--cst-primary);
    border-radius: 50%;
}

.cst-note.is-warn .cst-note-ic {
    color: #422006;
    background: #fbbf24;
}

.cst-note p {
    display: grid;
    gap: 2px;
    min-width: 0;
    padding-top: 2px;
}

.cst-note b {
    font-family: var(--cst-serif);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--cst-ink);
}

.cst-note span {
    font-size: .93rem;
    line-height: 1.65;
}

/* ═══════════════════════════════════════════════════════════════════════
   ผังความครบถ้วน: แผนการเรียน x ระดับชั้น
   ═══════════════════════════════════════════════════════════════════════ */

.cst-scroll {
    overflow-x: auto;
    border: 1px solid var(--cst-line);
    border-radius: 16px;
    background: var(--cst-paper);
}

.cst-scroll:focus-visible {
    outline-offset: 3px;
}

.cst-grid {
    width: 100%;
    min-width: 40rem;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .9rem;
}

.cst-grid th,
.cst-grid td {
    padding: 0;
    border-bottom: 1px solid var(--cst-line);
    border-left: 1px solid var(--cst-line);
}

.cst-grid tr > :first-child {
    border-left: 0;
}

.cst-grid tbody tr:last-child > * {
    border-bottom: 0;
}

.cst-grid thead th {
    padding: 10px 8px;
    font-size: .88rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    color: var(--cst-ink);
    background: var(--cst-paper-alt);
}

/* คอลัมน์ชื่อแผน: ติดซ้ายเมื่อเลื่อนผังด้านข้างบนจอแคบ */
.cst-grid .cst-grid-plan {
    position: sticky;
    left: 0;
    z-index: 1;
    width: 15rem;
    min-width: 11rem;
    padding: 10px 14px;
    font-size: .88rem;
    font-weight: 600;
    line-height: 1.45;
    text-align: left;
    color: var(--cst-ink);
    background: var(--cst-paper);
    box-shadow: 1px 0 0 var(--cst-line);
}

.cst-grid thead .cst-grid-plan {
    background: var(--cst-paper-alt);
}

.cst-cell {
    position: relative;
    height: 4.6rem;
    vertical-align: middle;
}

.cst .cst-cell-a {
    position: relative;
    display: grid;
    align-content: center;
    gap: 7px;
    width: 100%;
    height: 100%;
    min-height: 4.6rem;
    padding: 10px 14px;
    color: var(--cst-ink);
    text-decoration: none;
    transition: background-color .2s var(--cst-ease), box-shadow .2s var(--cst-ease);
}

.cst .cst-cell-a:hover {
    background: color-mix(in srgb, var(--cst-sc, var(--cst-brand)) 7%, var(--cst-paper));
    box-shadow: inset 0 0 0 2px var(--cst-sc, var(--cst-brand));
}

.cst-cell-top {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.cst-cell-v {
    font-family: var(--cst-serif);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.cst-cell-pct {
    margin-left: auto;
    font-size: .8rem;
    font-weight: 600;
    color: var(--cst-muted);
    font-variant-numeric: tabular-nums;
}

/* ต่ำกว่าครึ่งเกณฑ์: ตัวเลขแดง สันซ้ายแดง และไอคอนสามเหลี่ยม (ไม่ใช่สีอย่างเดียว) */
.cst-cell.is-thin .cst-cell-a {
    box-shadow: inset 4px 0 0 var(--cst-s-thin);
}

.cst .cst-cell.is-thin .cst-cell-a:hover {
    box-shadow: inset 4px 0 0 var(--cst-s-thin), inset 0 0 0 2px var(--cst-s-thin);
}

.cst-cell.is-thin .cst-cell-v,
.cst-cell.is-thin .cst-cell-pct {
    color: var(--cst-s-thin);
}

.cst-cell-warn {
    align-self: center;
    width: 1rem;
    height: 1rem;
    color: var(--cst-s-thin);
}

.cst-cell.is-none {
    background:
        repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--cst-line-bold) 55%, transparent) 7px 8px),
        var(--cst-paper-alt);
}

/* แถบเทียบเกณฑ์: ขีดกลางคือครึ่งเกณฑ์ */
.cst-bar {
    position: relative;
    display: block;
    height: 7px;
    overflow: hidden;
    background: var(--cst-paper-alt);
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px var(--cst-line);
}

.cst-bar::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    margin-left: -1px;
    background: var(--cst-muted);
    opacity: .7;
}

.cst-bar.is-lg {
    height: 10px;
}

.cst-bar-fill {
    display: block;
    height: 100%;
    background: var(--cst-sc, var(--cst-brand));
    border-radius: 999px;
    transform-origin: left center;
}

/* ── รายการเรียงจากน้อยไปมาก (แทนผังบนจอแคบ) ─────────────────────────── */
.cst-rank {
    display: none;
    overflow: hidden;
    border: 1px solid var(--cst-line);
    border-radius: 16px;
}

.cst-rank li + li {
    border-top: 1px solid var(--cst-line);
}

.cst .cst-rank-a {
    display: grid;
    grid-template-columns: 2.6rem minmax(0, 1fr) 3.6rem;
    align-items: center;
    gap: 12px;
    min-height: 3.6rem;
    padding: 9px 14px 9px 12px;
    color: var(--cst-ink);
    text-decoration: none;
    transition: background-color .2s var(--cst-ease);
}

.cst .cst-rank li.is-thin .cst-rank-a {
    box-shadow: inset 4px 0 0 var(--cst-s-thin);
}

.cst .cst-rank-a:hover {
    background: color-mix(in srgb, var(--cst-sc, var(--cst-brand)) 7%, var(--cst-paper));
}

.cst-rank-g {
    display: grid;
    place-items: center;
    height: 2.1rem;
    font-size: .84rem;
    font-weight: 700;
    color: var(--cst-ink);
    background: var(--cst-paper-alt);
    border: 1px solid var(--cst-line);
    border-radius: 10px;
}

.cst-rank-t {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.cst-rank-t b {
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.cst-rank-v {
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    justify-items: end;
    gap: 0 5px;
    text-align: right;
}

.cst-rank-v b {
    font-family: var(--cst-serif);
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.cst-rank-v > span {
    grid-column: 1 / -1;
    font-size: .78rem;
    font-weight: 600;
    color: var(--cst-muted);
    font-variant-numeric: tabular-nums;
}

.cst-rank li.is-thin .cst-rank-v b,
.cst-rank li.is-thin .cst-rank-v > span {
    color: var(--cst-s-thin);
}

.cst-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    margin-top: 14px;
    font-size: .84rem;
    line-height: 1.5;
    color: var(--cst-ink-2);
}

.cst-legend li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cst-key {
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 1.9rem;
    height: 1rem;
    border-radius: 5px;
}

.cst-key.is-fill {
    height: 8px;
    background: linear-gradient(90deg, var(--cst-brand) 0 60%, var(--cst-paper-alt) 60%);
    box-shadow: inset 0 0 0 1px var(--cst-line);
    border-radius: 999px;
}

.cst-key.is-mid {
    height: 8px;
    background: var(--cst-paper-alt);
    box-shadow: inset 0 0 0 1px var(--cst-line);
    border-radius: 999px;
}

.cst-key.is-mid::after {
    content: "";
    width: 2px;
    height: 100%;
    background: var(--cst-muted);
}

.cst-key.is-thin {
    width: 1.4rem;
    height: 1.4rem;
    color: var(--cst-s-thin);
    box-shadow: inset 3px 0 0 var(--cst-s-thin), inset 0 0 0 1px var(--cst-line);
}

.cst-key.is-thin .cst-icon {
    width: .9rem;
    height: .9rem;
}

.cst-key.is-none {
    width: 1.4rem;
    height: 1.4rem;
    background:
        repeating-linear-gradient(135deg, transparent 0 4px, var(--cst-line-bold) 4px 5px),
        var(--cst-paper-alt);
    box-shadow: inset 0 0 0 1px var(--cst-line);
}

/* ═══════════════════════════════════════════════════════════════════════
   แผงรายวิชา: สีประจำหมวด ตัวกรอง
   ═══════════════════════════════════════════════════════════════════════ */

.cst-kinds {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: auto;
}

.cst-kinds li {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 3px 12px;
    font-size: .82rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--cst-ink-2);
    background: var(--cst-paper);
    border: 1px solid var(--cst-line);
    border-radius: 999px;
}

.cst-dot {
    display: inline-block;
    flex: none;
    width: 10px;
    height: 10px;
    background: var(--cst-kc, var(--cst-brand));
    border-radius: 3px;
}

.cst-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    margin-bottom: 14px;
    padding: 12px 14px;
    background: var(--cst-paper-alt);
    border: 1px solid var(--cst-line);
    border-radius: 16px;
}

.cst-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cst .cst-filter {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 2.4rem;
    padding: 0 14px;
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    color: var(--cst-ink-2);
    background: var(--cst-paper);
    border: 1.5px solid var(--cst-line-bold);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color .2s var(--cst-ease), border-color .2s var(--cst-ease), color .2s var(--cst-ease);
}

.cst .cst-filter span {
    font-size: .78rem;
    font-weight: 600;
    color: var(--cst-muted);
}

.cst .cst-filter:hover {
    border-color: var(--cst-brand);
}

.cst .cst-filter[aria-pressed="true"] {
    color: #ffffff;
    background: var(--cst-primary);
    border-color: var(--cst-primary);
}

.cst .cst-filter[aria-pressed="true"] span {
    color: #ffffff;
}

.cst-only {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 2.4rem;
    font-size: .9rem;
    color: var(--cst-ink-2);
    cursor: pointer;
}

.cst-only input {
    width: 24px;
    height: 24px;
    margin: 0;
    accent-color: var(--cst-primary);
}

.cst-shown {
    margin-left: auto;
    font-size: .84rem;
    color: var(--cst-muted);
}

.cst-howto {
    max-width: 62rem;
    font-size: .88rem;
    line-height: 1.8;
    color: var(--cst-ink-2);
}

.cst-none {
    padding: 18px;
    font-size: .95rem;
    text-align: center;
    color: var(--cst-muted);
    background: var(--cst-paper);
    border: 1px dashed var(--cst-line-bold);
    border-radius: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════
   ระดับชั้น
   ═══════════════════════════════════════════════════════════════════════ */

.cst-grade {
    display: grid;
    gap: 14px;
    min-width: 0;
    scroll-margin-top: 5rem;
}

.cst-grade:focus {
    outline: none;
}

.cst-grade + .cst-grade,
.cst-plans-panel + .cst-grade {
    margin-top: 10px;
}

.cst-grade-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 4px 2px 12px;
    border-bottom: 2px solid var(--cst-line-bold);
}

.cst-grade-badge {
    display: grid;
    place-items: center;
    flex: none;
    width: 3.4rem;
    height: 3.4rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(145deg, var(--cst-hero-c) 0%, var(--cst-hero-a) 100%);
    border-radius: 16px;
    box-shadow: 0 14px 24px -16px rgba(15, 23, 42, .85);
}

.cst-grade-id {
    flex: 1 1 18rem;
    min-width: 0;
}

.cst-grade-t {
    font-family: var(--cst-serif);
    font-size: clamp(1.3rem, 1.1rem + .6vw, 1.6rem);
    font-weight: 600;
    line-height: 1.3;
    color: var(--cst-ink);
}

.cst-grade-s {
    margin-top: 2px;
    font-size: .88rem;
    line-height: 1.55;
    color: var(--cst-muted);
}

.cst .cst-up {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 2.4rem;
    padding: 0 14px;
    font-size: .86rem;
    font-weight: 600;
    color: var(--cst-brand);
    text-decoration: none;
    background: var(--cst-paper);
    border: 1px solid var(--cst-brand-line);
    border-radius: 999px;
    transition: background-color .2s var(--cst-ease), border-color .2s var(--cst-ease);
}

.cst .cst-up:hover {
    background: var(--cst-brand-soft);
    border-color: var(--cst-brand);
}

.cst-up .cst-icon {
    width: 1rem;
    height: 1rem;
}

.cst-grade-plans {
    display: grid;
    gap: 14px;
}

/* ═══════════════════════════════════════════════════════════════════════
   การ์ดแผนการเรียน
   ═══════════════════════════════════════════════════════════════════════ */

.cst-plan {
    min-width: 0;
    padding: 18px 20px 20px;
    background: var(--cst-paper);
    border: 1px solid var(--cst-line);
    border-radius: 20px;
    box-shadow: var(--cst-shadow), inset 5px 0 0 var(--cst-sc, var(--cst-brand));
    scroll-margin-top: 5.5rem;
    transition: border-color .2s var(--cst-ease), box-shadow .2s var(--cst-ease);
}

.cst-plan:focus {
    outline: none;
}

/* แผนที่ถูกเปิดจากลิงก์ (ผัง หรือหน้าคำอธิบายรายวิชา): กรอบน้ำเงิน ไม่มีสคริปต์ก็เห็น */
.cst-plan:target {
    border-color: var(--cst-brand);
    box-shadow: var(--cst-shadow), inset 5px 0 0 var(--cst-sc, var(--cst-brand)), 0 0 0 3px color-mix(in srgb, var(--cst-brand) 30%, transparent);
}

.cst-plan-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px 28px;
    align-items: center;
}

@media (min-width: 760px) {
    .cst-plan-head {
        grid-template-columns: minmax(0, 1fr) minmax(15rem, 21rem);
    }
}

.cst-plan-eyebrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.cst-plan-g {
    font-size: .86rem;
    font-weight: 700;
    color: var(--cst-muted);
}

.cst-state {
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.7;
    color: var(--cst-sc);
    background: var(--cst-paper);
    border: 1.5px solid var(--cst-sc);
    border-radius: 999px;
}

.cst-plan-t {
    font-family: var(--cst-serif);
    font-size: clamp(1.1rem, 1rem + .35vw, 1.3rem);
    font-weight: 600;
    line-height: 1.45;
    color: var(--cst-ink);
    overflow-wrap: anywhere;
}

.cst-pm {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    background: var(--cst-paper-alt);
    border: 1px solid var(--cst-line);
    border-radius: 14px;
}

.cst-pm-k {
    font-size: .88rem;
    line-height: 1.4;
    color: var(--cst-ink-2);
}

.cst-pm-k b {
    font-family: var(--cst-serif);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--cst-ink);
    font-variant-numeric: tabular-nums;
}

.cst-plan.is-thin .cst-pm-k b {
    color: var(--cst-s-thin);
}

.cst-pm-s {
    font-size: .8rem;
    color: var(--cst-muted);
}

.cst-figs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.cst-figs li {
    display: grid;
    gap: 2px;
    min-width: 0;
    padding: 9px 12px;
    border: 1px solid var(--cst-line);
    border-radius: 12px;
}

.cst-fig-k {
    font-size: .78rem;
    line-height: 1.4;
    color: var(--cst-muted);
}

.cst-fig-v {
    font-size: .84rem;
    line-height: 1.35;
    color: var(--cst-ink-2);
}

.cst-fig-v b {
    font-family: var(--cst-serif);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--cst-ink);
    font-variant-numeric: tabular-nums;
}

.cst-flags {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

/* แจ้งเตือนในการ์ด: กระดาษปกติ สันซ้ายสีเตือน (พื้นสีเต็มใบทำให้ลิงก์ข้างในตกเกณฑ์ บทเรียนเดิม) */
.cst-flag {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    font-size: .9rem;
    line-height: 1.6;
    color: var(--cst-ink-2);
    background: var(--cst-paper);
    border: 1px solid var(--cst-warn-line);
    border-radius: 12px;
    box-shadow: inset 4px 0 0 #d97706;
}

.cst-flag .cst-icon {
    margin-top: .2em;
    color: var(--cst-warn);
}

.cst-flag b {
    color: var(--cst-ink);
    font-variant-numeric: tabular-nums;
}

/* ── ตารางรายวิชาสองภาคเรียน ─────────────────────────────────────────── */
.cst-terms {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px 22px;
    margin-top: 16px;
}

@media (min-width: 1000px) {
    .cst-terms {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.cst-term {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cst-term-h,
.cst-term-h b {
    margin-bottom: 8px;
    font-family: var(--cst-serif);
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--cst-ink);
}

.cst-tbl {
    flex: 1 1 auto;
    /* ★ ไม่ใช่ hidden: เมื่อผู้ใช้ขยายระยะตัวอักษร (1.4.12) ตารางกว้างเกินการ์ดต้องเลื่อนดูได้ ไม่ใช่ถูกตัด */
    overflow-x: auto;
    border: 1px solid var(--cst-line);
    border-radius: 14px;
}

.cst-courses {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
    line-height: 1.5;
}

.cst-courses th,
.cst-courses td {
    padding: 6px 12px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--cst-line);
}

.cst-courses thead th {
    padding-block: 8px;
    font-size: .8rem;
    font-weight: 700;
    color: var(--cst-muted);
    background: var(--cst-paper-alt);
}

.cst-courses .cst-code {
    width: 6.5rem;
    white-space: nowrap;
    color: var(--cst-ink-2);
    font-variant-numeric: tabular-nums;
}

.cst-courses .cst-num {
    width: 5.2rem;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.cst-courses td.cst-num {
    font-weight: 600;
    color: var(--cst-ink);
}

.cst-cat th {
    padding-top: 10px;
    font-size: .88rem;
    font-weight: 700;
    color: var(--cst-ink);
    background: color-mix(in srgb, var(--cst-kc, var(--cst-brand)) 6%, var(--cst-paper));
    box-shadow: inset 4px 0 0 var(--cst-kc, var(--cst-brand));
}

.cst-cat-n {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cst-cat-hint {
    display: block;
    margin-top: 1px;
    font-size: .8rem;
    font-weight: 400;
    color: var(--cst-muted);
}

/* ★ ลิงก์ในตารางไม่ได้อยู่ในประโยค จึงต้องมีเป้ากดอย่างน้อย 24px (ช่องตารางลดระยะบนล่างชดเชย แถวสูงเท่าเดิม) */
.cst .cst-course {
    display: inline-block;
    min-height: 24px;
    padding-block: 2px;
    color: var(--cst-brand);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--cst-brand) 35%, transparent);
    text-underline-offset: 3px;
    transition: text-decoration-color .2s var(--cst-ease);
}

.cst .cst-course:hover {
    text-decoration-color: currentColor;
}

.cst-courses tr.is-dup > td {
    background: var(--cst-warn-soft);
}

.cst-courses tr.is-dup > td:first-child {
    box-shadow: inset 4px 0 0 #d97706;
}

.cst-courses tr.is-dup td.cst-num,
.cst-courses tr.is-alt td.cst-num {
    font-weight: 400;
    color: var(--cst-muted);
}

.cst-tag-s {
    display: inline-block;
    padding: 0 8px;
    font-size: .74rem;
    font-weight: 700;
    line-height: 1.6;
    white-space: nowrap;
    color: var(--cst-muted);
    border: 1px solid var(--cst-line-bold);
    border-radius: 999px;
    vertical-align: .1em;
}

.cst-tag-s.is-dup {
    color: var(--cst-warn);
    border-color: var(--cst-warn-line);
}

.cst-sum th,
.cst-sum td {
    font-size: .84rem;
    font-weight: 600;
    text-align: right;
    color: var(--cst-ink-2);
    background: var(--cst-paper-alt);
}

.cst-courses tbody:last-child tr:last-child > * {
    border-bottom: 0;
}

.cst-term-total {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.cst-term-total li {
    padding: 3px 12px;
    font-size: .84rem;
    line-height: 1.6;
    color: var(--cst-ink-2);
    background: var(--cst-brand-soft);
    border: 1px solid var(--cst-brand-line);
    border-radius: 999px;
}

.cst-term-total b {
    font-weight: 700;
    color: var(--cst-ink);
    font-variant-numeric: tabular-nums;
}

.cst-empty {
    padding: 16px;
    font-size: .9rem;
    color: var(--cst-muted);
    background: var(--cst-paper-alt);
    border: 1px dashed var(--cst-line-bold);
    border-radius: 14px;
}

/* ── ท้ายหน้า (ไม่ใช่ <footer>: ไฟล์กลางทาพื้นดำให้ footer ทุกตัว) ──────── */
.cst-foot {
    padding: 16px 20px;
    font-size: .9rem;
    line-height: 1.7;
    color: var(--cst-ink-2);
    background: var(--cst-paper);
    border: 1px solid var(--cst-line);
    border-radius: 18px;
}

.cst-foot-t {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-weight: 700;
    color: var(--cst-ink);
}

.cst-foot-t .cst-icon {
    color: var(--cst-brand);
}

.cst-foot ul {
    display: grid;
    gap: 4px;
    padding-left: 1.2rem;
    list-style: disc;
}

.cst-foot li::marker {
    color: var(--cst-muted);
}

/* ═══════════════════════════════════════════════════════════════════════
   ช่วงจอ
   ═══════════════════════════════════════════════════════════════════════ */

/* แถบตัวเลขหกช่อง: สามต่อแถวบนแท็บเล็ต สองต่อแถวบนมือถือ */
@media (max-width: 1099.98px) {
    .cst-stats[data-n="6"] {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1023.98px) {
    .cst-hero-top {
        align-items: start;
    }

    .cst-watermark {
        bottom: auto;
        top: 1rem;
        font-size: clamp(6rem, 3rem + 14vw, 10rem);
    }
}

@media (max-width: 1023.98px) {
    .cst-grid .cst-grid-plan {
        width: 11rem;
        min-width: 10rem;
    }
}

/* ผังหกคอลัมน์ต้องการราว 900px จึงจะไม่ต้องเลื่อนข้าง ต่ำกว่านั้นใช้รายการเรียงจากน้อยไปมาก */
@media (max-width: 899.98px) {
    .cst-scroll,
    .cst-legend .cst-legend-none {
        display: none;
    }

    .cst-rank {
        display: block;
    }
}

@media (max-width: 759.98px) {
    .cst-hero {
        padding-bottom: 84px;
    }

    .cst-body {
        margin-top: -60px;
    }

    .cst-panel-head {
        padding: 14px 16px;
    }

    .cst-panel-body {
        padding: 14px 14px 18px;
    }

    .cst-kinds {
        flex-basis: 100%;
        margin-left: 0;
    }

    .cst-shown {
        flex-basis: 100%;
        margin-left: 0;
    }

    .cst-glance {
        padding: 14px;
        border-radius: 20px;
    }

    .cst-plan {
        padding: 14px 14px 16px 16px;
        border-radius: 18px;
    }

    .cst-figs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cst-note {
        padding: 14px 16px;
    }

    .cst-courses th,
    .cst-courses td {
        padding: 6px 10px;
    }

    .cst-courses .cst-code {
        width: 5.4rem;
    }

    .cst-courses .cst-num {
        width: 4.4rem;
    }
}

@media (max-width: 639.98px) {
    .cst-stats,
    .cst-stats[data-n] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cst-stat {
        padding: 14px 14px 16px;
    }
}

@media (max-width: 479.98px) {
    .cst-title {
        font-size: 2rem;
    }

    .cst-hero-main .cst-acts {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
    }

    .cst-ring-row {
        gap: 12px;
    }

    .cst-ring {
        width: 5.6rem;
        height: 5.6rem;
    }

    .cst-ring-n {
        font-size: 1.45rem;
    }

    .cst .cst-weak-a {
        grid-template-columns: minmax(0, 1fr);
    }

    .cst-count {
        grid-auto-flow: column;
        justify-content: start;
        gap: 8px;
        min-width: 0;
        padding: 8px 14px;
    }

    .cst-count b {
        font-size: 1.6rem;
    }

    .cst-grade-head .cst-up {
        margin-left: calc(3.4rem + 16px);
    }

    /* ตารางรายวิชาบนจอแคบมาก: ช่องรหัสและหน่วยกิตแคบลง ชื่อวิชาได้ที่มากขึ้น */
    .cst-courses th,
    .cst-courses td {
        padding: 6px 8px;
    }

    .cst-courses .cst-code {
        width: 4.9rem;
        font-size: .84rem;
    }

    .cst-courses .cst-num {
        width: 3.6rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   การเคลื่อนไหว
   ★ ทุกอย่างมองเห็นได้ตั้งแต่แรก ที่ขยับมีแค่ตำแหน่งและความยาวแถบ (ไม่มี opacity 0 เป็นสถานะพัก)
   ★ มีผลเฉพาะเมื่อสคริปต์ติดคลาส cst-motion ที่ .cst-shell แล้วเท่านั้น
   ★ ทุกแอนิเมชันเล่นครั้งเดียวแล้วจบ
   ═══════════════════════════════════════════════════════════════════════ */

@keyframes cst-up {
    from {
        transform: translate3d(0, 18px, 0);
    }

    to {
        transform: none;
    }
}

@keyframes cst-drift {
    from {
        transform: translate3d(60px, -40px, 0) scale(.9);
    }

    to {
        transform: none;
    }
}

@keyframes cst-drift-b {
    from {
        transform: translate3d(-50px, 40px, 0) scale(.9);
    }

    to {
        transform: none;
    }
}

@keyframes cst-watermark {
    from {
        transform: translate3d(0, 40px, 0);
    }

    to {
        transform: none;
    }
}

.cst-motion .cst-hero-main > * {
    animation: cst-up .7s var(--cst-spring) backwards;
}

.cst-motion .cst-hero-main > :nth-child(2) {
    animation-delay: .06s;
}

.cst-motion .cst-hero-main > :nth-child(3) {
    animation-delay: .12s;
}

.cst-motion .cst-hero-main > :nth-child(4) {
    animation-delay: .18s;
}

.cst-motion .cst-hero-main > :nth-child(5) {
    animation-delay: .24s;
}

.cst-motion .cst-orb.is-a {
    animation: cst-drift 1.8s var(--cst-spring) backwards;
}

.cst-motion .cst-orb.is-b {
    animation: cst-drift-b 2.2s var(--cst-spring) .1s backwards;
}

.cst-motion .cst-watermark {
    animation: cst-watermark 1.6s var(--cst-spring) .1s backwards;
}

/* ส่วนที่เลื่อนเข้ามาในจอ: ยกขึ้นจากด้านล่าง ลูกในส่วนนั้นตามมาทีละตัว */
.cst-motion [data-cst-reveal] {
    transition: transform .75s var(--cst-spring), border-color .2s var(--cst-ease), box-shadow .2s var(--cst-ease);
}

.cst-motion [data-cst-reveal]:not(.is-in) {
    transform: translate3d(0, 28px, 0);
}

.cst-motion [data-cst-reveal] .cst-stat {
    transition: transform .6s var(--cst-spring);
    transition-delay: calc(var(--k, 0) * 45ms + 100ms);
}

.cst-motion [data-cst-reveal]:not(.is-in) .cst-stat {
    transform: translate3d(0, 16px, 0);
}

/* แถบเทียบเกณฑ์และแถบสถานะ: ยืดออกจากซ้ายเมื่อเข้ามาในจอ แถวในผังตามกันทีละแถว */
.cst-motion [data-cst-reveal] :is(.cst-bar-fill, .cst-split) {
    transition: transform 1s var(--cst-spring) .25s;
}

.cst-motion [data-cst-reveal] .cst-grid tr .cst-bar-fill {
    transition-delay: calc(min(var(--r, 0), 12) * 50ms + 250ms);
}

.cst-motion [data-cst-reveal]:not(.is-in) :is(.cst-bar-fill, .cst-split) {
    transform: scaleX(0);
}

/* เฟรมแรกหลังติดคลาส: กระโดดไปตำแหน่งเริ่มโดยไม่เล่นทรานสิชันย้อนกลับ */
.cst-motion.cst-arming [data-cst-reveal],
.cst-motion.cst-arming [data-cst-reveal] * {
    transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .cst *,
    .cst *::before,
    .cst *::after {
        animation: none !important;
        transition: none !important;
    }

    .cst [data-cst-reveal],
    .cst [data-cst-reveal] * {
        transform: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   โหมดคอนทราสต์สูง
   ไฟล์กลางบังคับพื้นดำ ตัวอักษรขาว ลิงก์และปุ่มเหลือง ที่นี่เขียนเฉพาะสิ่งที่ไฟล์กลางไม่รู้จัก
   ★ สถานะยังแยกได้ด้วยตัวอักษรและรูปทรง (ไอคอนสามเหลี่ยม ลายทแยง) เมื่อเหลือแค่ขาว ดำ เหลือง
   ═══════════════════════════════════════════════════════════════════════ */

html.tb1-contrast-high body.cst-page {
    background: #000000;
}

html.tb1-contrast-high .cst {
    --cst-shadow: none;
    --cst-shadow-float: none;
    --cst-on-hero-2: #ffffff;
    --cst-gold-text: #facc15;
    --cst-s-thin: #facc15;
    --cst-s-half: #ffffff;
    --cst-s-full: #ffffff;
    --cst-k-core: #ffffff;
    --cst-k-extra: #ffffff;
    --cst-k-free: #ffffff;
    --cst-k-act: #ffffff;
    --cst-warn: #facc15;
}

html.tb1-contrast-high .cst-hero {
    background: #000000 !important;
    border-bottom: 3px solid #ffffff;
}

html.tb1-contrast-high .cst .cst-hero {
    padding-bottom: 36px;
}

html.tb1-contrast-high .cst .cst-body {
    margin-top: 28px;
}

html.tb1-contrast-high .cst-hero::before,
html.tb1-contrast-high .cst-hero::after,
html.tb1-contrast-high .cst-hero-fx {
    display: none;
}

html.tb1-contrast-high .cst :where(.cst-tag, .cst-glance, .cst-count, .cst-stats, .cst-stat-ic, .cst-panel, .cst-panel-head,
    .cst-panel-ic, .cst-note, .cst-note-ic, .cst-scroll, .cst-grid th, .cst-grid td, .cst-bar, .cst-key, .cst-kinds li, .cst-tools,
    .cst-none, .cst-grade-badge, .cst-plan, .cst-state, .cst-pm, .cst-figs li, .cst-flag, .cst-tbl, .cst-courses th, .cst-courses td,
    .cst-tag-s, .cst-term-total li, .cst-empty, .cst-foot, .cst-jchip-n, .cst-split, .cst-rank, .cst-rank-g) {
    background: #000000 !important;
    border-color: #ffffff !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

html.tb1-contrast-high .cst :where(.cst-glance, .cst-panel, .cst-note, .cst-plan, .cst-tools, .cst-foot, .cst-scroll, .cst-tbl,
    .cst-pm, .cst-figs li, .cst-flag, .cst-bar, .cst-state, .cst-tag-s, .cst-term-total li, .cst-kinds li, .cst-count,
    .cst-stat-ic, .cst-panel-ic, .cst-note-ic, .cst-grade-badge, .cst-jchip-n, .cst-split, .cst-rank, .cst-rank-g) {
    border: 1px solid #ffffff !important;
}

html.tb1-contrast-high .cst .cst-rank li.is-thin .cst-rank-a {
    box-shadow: inset 0 0 0 3px #facc15 !important;
}

html.tb1-contrast-high .cst .cst-tag.is-warn,
html.tb1-contrast-high .cst .cst-tag.is-warn * {
    color: #facc15 !important;
    border-color: #facc15 !important;
}

/* สิ่งที่ต้องจัดการ: กรอบเหลืองหนา */
html.tb1-contrast-high .cst .cst-note.is-warn,
html.tb1-contrast-high .cst .cst-plan.is-thin,
html.tb1-contrast-high .cst .cst-flag,
html.tb1-contrast-high .cst .cst-plan:target {
    border: 3px solid #facc15 !important;
}

html.tb1-contrast-high .cst .cst-state.is-thin,
html.tb1-contrast-high .cst .cst-tag-s.is-dup {
    color: #facc15 !important;
    border: 2px solid #facc15 !important;
}

html.tb1-contrast-high .cst .cst-stat.is-warn .cst-stat-v b {
    color: #facc15 !important;
}

/* ลิงก์ที่มีกรอบของตัวเอง: พื้นดำ ขอบเหลือง ชี้แล้วกลับสี */
html.tb1-contrast-high .cst :where(a.cst-btn, a.cst-jchip, a.cst-weak-a, a.cst-up) {
    color: #facc15 !important;
    background: #000000 !important;
    border: 2px solid #facc15 !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

html.tb1-contrast-high .cst :where(a.cst-btn, a.cst-jchip, a.cst-weak-a, a.cst-up, a.cst-cell-a, a.cst-rank-a):hover,
html.tb1-contrast-high .cst :where(a.cst-btn, a.cst-jchip, a.cst-weak-a, a.cst-up, a.cst-cell-a, a.cst-rank-a):hover * {
    color: #000000 !important;
    background: #facc15 !important;
    border-color: #facc15 !important;
}

html.tb1-contrast-high .cst :focus-visible,
html.tb1-contrast-high .cst-hero :focus-visible {
    outline: 3px solid #facc15;
    outline-offset: 3px;
}

/* ── วงและแถบสถานะ ─────────────────────────────────────────────────────── */
html.tb1-contrast-high .cst .cst-ring-bg {
    stroke: #333333;
}

html.tb1-contrast-high .cst .cst-ring-fg {
    stroke: #ffffff;
}

html.tb1-contrast-high .cst .cst-split-seg.is-full,
html.tb1-contrast-high .cst .cst-split-key .is-full i,
html.tb1-contrast-high .cst .cst-split-seg.is-half,
html.tb1-contrast-high .cst .cst-split-key .is-half i {
    background: #ffffff !important;
}

html.tb1-contrast-high .cst .cst-split-seg.is-thin,
html.tb1-contrast-high .cst .cst-split-key .is-thin i {
    background: repeating-linear-gradient(135deg, #facc15 0 3px, #000000 3px 6px) !important;
}

/* ── ผังความครบถ้วน ─────────────────────────────────────────────────────── */
html.tb1-contrast-high .cst .cst-bar-fill {
    background: #ffffff !important;
}

html.tb1-contrast-high .cst .cst-cell.is-thin .cst-bar-fill,
html.tb1-contrast-high .cst .cst-rank li.is-thin .cst-bar-fill,
html.tb1-contrast-high .cst .cst-plan.is-thin .cst-bar-fill {
    background: #facc15 !important;
}

html.tb1-contrast-high .cst .cst-bar::after {
    background: #ffffff;
    opacity: 1;
}

html.tb1-contrast-high .cst .cst-cell.is-thin .cst-cell-a {
    box-shadow: inset 0 0 0 3px #facc15 !important;
}

html.tb1-contrast-high .cst .cst-cell.is-none {
    background: repeating-linear-gradient(135deg, #000000 0 7px, #555555 7px 8px) !important;
}

html.tb1-contrast-high .cst .cst-key.is-fill {
    background: linear-gradient(90deg, #ffffff 0 60%, #000000 60%) !important;
    border: 1px solid #ffffff !important;
}

html.tb1-contrast-high .cst .cst-key.is-mid::after {
    background: #ffffff;
}

html.tb1-contrast-high .cst .cst-key.is-thin {
    border: 3px solid #facc15 !important;
}

html.tb1-contrast-high .cst .cst-key.is-none {
    background: repeating-linear-gradient(135deg, #000000 0 4px, #ffffff 4px 5px) !important;
}

/* ── ตารางรายวิชา ───────────────────────────────────────────────────────── */
html.tb1-contrast-high .cst .cst-dot {
    background: #ffffff !important;
}

html.tb1-contrast-high .cst .cst-cat th {
    border-left: 4px solid #ffffff !important;
}

html.tb1-contrast-high .cst .cst-courses tr.is-dup > td:first-child {
    border-left: 4px solid #facc15 !important;
}

html.tb1-contrast-high .cst .cst-grade-head {
    border-bottom-color: #ffffff;
}

html.tb1-contrast-high .cst .cst-title,
html.tb1-contrast-high .cst .cst-lead {
    text-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════════════
   ฉบับพิมพ์: หัวใบ ผังความครบถ้วน แล้วทุกระดับชั้นขึ้นหน้าใหม่ ตารางสองภาคเรียนคู่กัน
   ═══════════════════════════════════════════════════════════════════════ */
@media print {
    @page {
        size: A4;
        margin: 12mm;
    }

    body.cst-page {
        background: #ffffff;
    }

    body.cst-page a.cst-skip,
    .cst-hero-fx,
    .cst-hero::before,
    .cst-hero::after,
    .cst-acts,
    .cst-jump,
    .cst-glance,
    .cst-band,
    .cst-tools,
    .cst-none,
    .cst-up,
    .cst-plans-panel .cst-panel-ic,
    .cst-howto {
        display: none !important;
    }

    .cst {
        --cst-paper: #ffffff;
        --cst-paper-alt: #f3f4f6;
        --cst-ink: #000000;
        --cst-ink-2: #1f2937;
        --cst-muted: #374151;
        --cst-line: #9ca3af;
        --cst-line-bold: #6b7280;
        --cst-brand: #1e3a8a;
        --cst-brand-soft: #ffffff;
        --cst-brand-line: #9ca3af;
        --cst-on-hero-2: #1f2937;
        --cst-shadow: none;
        --cst-shadow-float: none;
        color: #000000;
    }

    .cst-wrap {
        max-width: none;
        padding-inline: 0;
    }

    .cst-hero {
        padding: 0 0 8px;
        color: #000000;
        background: none !important;
        border-bottom: 2px solid #000000;
    }

    .cst-hero-top {
        display: block;
    }

    .cst-tag {
        color: #000000;
        background: none;
        border-color: #9ca3af;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .cst-tag.is-warn {
        color: #000000;
        background: none;
        border-color: #6b7280;
    }

    .cst-title,
    .cst-title-y {
        color: #000000;
        text-shadow: none;
    }

    .cst-title {
        font-size: 1.6rem;
    }

    .cst-lead {
        margin-top: 4px;
        font-size: .9rem;
    }

    .cst-body {
        display: block;
        margin-top: 10px;
        padding-bottom: 0;
    }

    .cst-body > * + * {
        margin-top: 10px;
    }

    .cst-panel-head {
        padding: 6px 0;
        background: none;
        border: 0;
    }

    .cst-panel-ic {
        display: none;
    }

    .cst-panel,
    .cst-note,
    .cst-foot {
        border: 0;
        border-radius: 0;
    }

    .cst-panel-body {
        padding: 0;
    }

    /* ★ หน้า A4 กว้างไม่ถึง 760px กฎจอแคบจึงทำงานตอนพิมพ์ด้วย ต้องยืนยันให้ผังกลับมาแทนรายการ */
    .cst-scroll {
        display: block !important;
        overflow: visible;
    }

    .cst-rank {
        display: none !important;
    }

    .cst-legend .cst-legend-none {
        display: inline-flex !important;
    }

    .cst-grid {
        min-width: 0;
        font-size: .72rem;
    }

    .cst-cell,
    .cst .cst-cell-a {
        height: auto;
        min-height: 0;
    }

    .cst .cst-cell-a {
        padding: 4px 6px;
        gap: 3px;
    }

    .cst-cell-v {
        font-size: .95rem;
    }

    .cst-grid .cst-grid-plan {
        position: static;
        width: 11rem;
        padding: 4px 6px;
        font-size: .72rem;
    }

    .cst-grade {
        break-before: page;
    }

    .cst-plan {
        padding: 8px 0 12px;
        border: 0;
        border-top: 1.5px solid #000000;
        border-radius: 0;
        box-shadow: none;
    }

    .cst-plan-head {
        grid-template-columns: minmax(0, 1fr) 14rem;
    }

    .cst-figs {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
        margin-top: 6px;
    }

    .cst-figs li {
        padding: 3px 6px;
    }

    .cst-terms {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-top: 8px;
    }

    .cst-courses {
        font-size: .7rem;
    }

    .cst-courses th,
    .cst-courses td {
        padding: 2px 5px;
    }

    .cst-courses .cst-code {
        width: 4.4rem;
    }

    .cst-courses .cst-num {
        width: 3.2rem;
    }

    .cst .cst-course {
        color: #000000;
        text-decoration: none;
    }

    .cst-courses tr,
    .cst-plan-head,
    .cst-flag {
        break-inside: avoid;
    }

    /* สีที่เป็นข้อมูลต้องติดกระดาษ */
    .cst-bar,
    .cst-bar-fill,
    .cst-cell.is-none,
    .cst-cell.is-thin .cst-cell-a,
    .cst-cat th,
    .cst-dot,
    .cst-key {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .cst [data-cst-reveal],
    .cst [data-cst-reveal] *,
    .cst .cst-hero-main > * {
        transform: none !important;
        animation: none !important;
        transition: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ★ 6 ต.ค. 2569 โครงสร้างตามเอกสารหลักสูตรสถานศึกษา (includes/course_plans_view.php คลาส cpl-*)
   ตารางแบบเอกสาร: รหัส | รายวิชา | นก. | ชม./ส. หัวหมวดมียอดของหมวด แถวรวมท้ายภาคเรียน
   ═══════════════════════════════════════════════════════════════════════════ */
/* ★ 30 ต.ค. 2569: ฝั่งขวาเป็นแผงตัวเลข (.cpl-band) ตั้งแต่จอ 1080 px ต่ำกว่านั้นเรียงลง ดูท้ายไฟล์ */
.cst .cpl-hero-top {
    grid-template-columns: minmax(0, 1fr);
}

.cpl-jump .cst-jump-list {
    flex-wrap: wrap;
}

.cpl-jchip b {
    white-space: nowrap;
}

.cpl-sum-tbl {
    min-width: 46rem;
}

.cpl-sum-tbl td {
    text-align: center;
    vertical-align: middle;
}

.cpl-sum-off {
    background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--cst-line) 70%, transparent) 6px 7px);
}

.cpl-sum-a {
    display: grid;
    place-items: center;
    min-height: 3.2rem;
    padding: 6px 4px;
    color: var(--cst-ink);
    text-decoration: none;
    font-variant-numeric: tabular-nums;
}

.cpl-sum-a b {
    font-size: 1.05rem;
    font-weight: 700;
}

.cpl-sum-a small {
    font-size: .76rem;
    color: var(--cst-muted);
}

.cpl-sum-a:hover b,
.cpl-sum-a:focus-visible b {
    color: var(--cst-brand);
    text-decoration: underline;
}

.cpl-sum-scroll {
    position: relative;   /* containing block for the .sr-only spans in the cells, else they widen the page on phones */
    border-radius: 14px;
}

.cpl-badge {
    font-size: .8rem;
    line-height: 1.15;
    text-align: center;
}

.cpl-plan-sec {
    scroll-margin-top: 16px;
}

.cpl-plan-of {
    font-size: .82rem;
    color: var(--cst-muted);
}

.cpl-figs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 0;
}

@media (min-width: 760px) {
    .cpl-plan .cst-plan-head {
        grid-template-columns: minmax(0, 1fr) minmax(24rem, 34rem);
    }
}

.cpl-figs .cst-fig-v {
    white-space: nowrap;
}

.cpl-fig-s {
    display: block;
    font-size: .76rem;
    color: var(--cst-muted);
    white-space: normal;
}

.cpl-grade-anchor {
    display: block;
    height: 0;
    scroll-margin-top: 16px;
}

.cst-courses.cpl-tbl .cpl-code {
    width: 5.6rem;
    white-space: nowrap;
    color: var(--cst-ink-2);
    font-variant-numeric: tabular-nums;
}

.cst-courses.cpl-tbl .cst-num {
    width: 3.6rem;
}

.cst-courses.cpl-tbl abbr {
    text-decoration: none;
    cursor: help;
}

.cpl-tbl .cpl-cat > th {
    padding-top: 8px;
}

.cpl-tbl .cpl-cat > td.cst-num {
    padding-top: 8px;
    font-weight: 700;
    color: var(--cst-ink);
    background: color-mix(in srgb, var(--cst-kc, var(--cst-brand)) 6%, var(--cst-paper));
}

.cpl-tbl tbody.is-sub .cpl-cat > th {
    box-shadow: inset 4px 0 0 var(--cst-kc, var(--cst-brand)), inset 8px 0 0 var(--cst-paper);
}

.cpl-tbl tr.is-opt > td {
    padding-top: 3px;
    padding-bottom: 3px;
    font-size: .86rem;
    color: var(--cst-ink-2);
}

.cpl-tbl tr.is-opt > td.cst-name {
    padding-left: 1.6rem;
    position: relative;
}

.cpl-tbl tr.is-opt > td.cst-name::before {
    content: "";
    position: absolute;
    left: .8rem;
    top: .95em;
    width: .35rem;
    height: .35rem;
    border-radius: 50%;
    background: var(--cst-kc, var(--cst-brand));
}

.cpl-choice {
    font-weight: 600;
    color: var(--cst-ink);
}

.cpl-tbl tr.is-act > td.cpl-code {
    color: var(--cst-muted);
}

.cpl-note {
    display: block;
    font-size: .8rem;
    color: var(--cst-muted);
}

.cpl-tbl .cpl-total > * {
    padding-block: 8px;
    font-weight: 700;
    color: var(--cst-ink);
    background: var(--cst-paper-alt);
    border-bottom: 0;
}

.cpl-tbl .cpl-total > th {
    text-align: right;
}

@media (max-width: 639.98px) {
    .cpl-figs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .cpl-figs li {
        padding: 7px 8px;
    }

    .cst-courses.cpl-tbl .cpl-code {
        width: 4.6rem;
    }

    .cst-courses.cpl-tbl th,
    .cst-courses.cpl-tbl td {
        padding-left: 7px;
        padding-right: 7px;
    }
}

@media print {
    .cst-courses.cpl-tbl .cpl-code {
        width: 4.2rem;
    }

    .cpl-tbl .cpl-cat > td.cst-num,
    .cpl-tbl .cpl-total > * {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .cpl-plan {
        break-inside: avoid-page;
    }
}

html.tb1-contrast-high .cst .cpl-tbl .cpl-cat > td.cst-num,
html.tb1-contrast-high .cst .cpl-tbl .cpl-total > * {
    color: #ffffff;
    background: #000000;
}

/* โครงสร้างหลักสูตร: หัวหน้าและตารางกระชับตามธีมของเว็บ */
@media screen {
    .cst .cst-hero,
    .cst .cst-hero.is-plain { padding-block: 24px; }
    .cst .cst-title { font-size: clamp(1.6rem, 3vw, 2.2rem); }
    .cst .cst-lead { margin-top: 10px; }
    .cst .cst-jump { margin-top: 14px; }
    .cst .cst-jchip { padding: 7px 10px; }
    .cst .cst-band { margin-top: 16px; }
    .cst .cst-stat { padding: 12px; }
    .cst .cst-body { margin-top: 16px; gap: 18px; }
    .cst .cst-panel-head { padding: 10px 14px; }
    .cst .cst-panel-body { padding: 14px; }
    .cst .cst-grade + .cst-grade { margin-top: 6px; }
    .cst .cst-grade-plans { gap: 14px; }
    .cst .cst-plan { padding: 14px; }
    .cst .cst-terms { gap: 14px; align-items: stretch; }
    .cst .cst-term { min-width: 0; }
    .cst .cst-tbl { overscroll-behavior-inline: contain; }
    .cst .cst-btn { min-height: 40px; }
    .cst .cst-retry { margin-top: 12px; }
}
@media screen and (max-width: 640px) {
    .cst .cst-hero,
    .cst .cst-hero.is-plain { padding-block: 18px; }
    .cst .cst-plan { padding: 12px; }
    .cst .cst-btn { min-height: 44px; }
}
.cpl-plan-picker { margin-top: 14px; }
.cpl-plan-picker > summary {
    cursor: pointer;
    width: fit-content;
    padding: 10px 14px;
    min-height: 44px;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 12px;
    background: rgba(255,255,255,.1);
    font-weight: 600;
}
@media print {
    .cpl-plan-picker { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════
   ★ 30 ต.ค. 2569: หัวหน้าสองฝั่ง — ข้อความซ้าย ตัวเลขขวา (ผังเดียวกับหน้าตารางสอนครูและหน้าแนวโน้มนักเรียน)
   เดิมฝั่งขวาของหัวหน้าว่าง แถบตัวเลขห้าช่องเป็นอีกแถวข้างล่าง
   ตัวเลขเป็นแผงกระจกฝ้าสีเข้ม แถวละหนึ่งตัว (ไอคอน ชื่อ | คำอธิบาย | ตัวเลข หน่วย)
   หน่วยอยู่ในช่องกว้างคงที่ ตัวเลขทุกแถวจบตรงกัน · กระดาษซ่อนแถบตัวเลขอยู่แล้ว
   ตัวเลือกขึ้นต้น .cst.cst เพื่อชนะกฎแถบตัวเลขเดิม (สองช่องต่อแถวบนมือถือ ช่องละ 12px)
   ═══════════════════════════════════════════════════════════════════════ */
@media screen {
    .cst .cst-band.cpl-band {
        min-width: 0;
        width: 100%;
        max-width: 46rem;
        margin-top: 0;
    }

    .cst.cst .cpl-band .cst-stats {
        grid-template-columns: minmax(0, 1fr);
        padding: 6px 10px;
        border-radius: var(--tb1-radius-lg, 22px);
    }

    .cst.cst .cpl-band .cst-stat {
        display: grid;
        grid-template-columns: 26px minmax(0, 9.5rem) minmax(0, 1fr) auto;
        grid-template-areas: "ic k s v";
        align-items: center;
        gap: 2px 10px;
        padding: 6px;
        box-shadow: none;
    }

    .cst.cst .cpl-band .cst-stat + .cst-stat {
        border-top: 1px solid rgba(255, 255, 255, .16);
    }

    .cst.cst .cpl-band .cst-stat-ic {
        grid-area: ic;
        width: 26px;
        height: 26px;
        margin: 0;
        color: #ffffff;
        background: rgba(255, 255, 255, .14);
        border-radius: 8px;
        box-shadow: none;
    }

    .cst.cst .cpl-band .cst-stat-ic svg {
        width: 15px;
        height: 15px;
    }

    .cst.cst .cpl-band .cst-stat-k {
        grid-area: k;
        font-size: .875rem;
        font-weight: 600;
        line-height: 1.35;
        color: #ffffff;
    }

    .cst.cst .cpl-band .cst-stat-s {
        grid-area: s;
        font-size: .875rem;
        line-height: 1.4;
        color: var(--cst-on-hero-2);
    }

    .cst.cst .cpl-band .cst-stat-v {
        grid-area: v;
        display: inline-grid;
        grid-template-columns: auto 5.6em;
        align-items: baseline;
        column-gap: 6px;
        font-size: .875rem;
        white-space: nowrap;
    }

    .cst.cst .cpl-band .cst-stat-v b {
        text-align: right;
        font-size: clamp(1.25rem, 1.7vw, 1.45rem);
    }
}

@media screen and (min-width: 1080px) {
    .cst .cpl-hero-top {
        grid-template-columns: minmax(0, 1fr) minmax(30rem, 38rem);
    }

    .cst .cst-band.cpl-band {
        max-width: none;
    }
}

@media screen and (min-width: 1280px) {
    .cst .cpl-hero-top {
        grid-template-columns: minmax(0, 1fr) minmax(30rem, 42rem);
    }
}

@media screen and (max-width: 640px) {
    .cst.cst .cpl-band .cst-stat {
        grid-template-columns: 26px minmax(0, 1fr) auto;
        grid-template-areas: "ic k v" ". s v";
        padding: 7px 4px;
    }
}
