@charset "utf-8";
/* color-mix fallback */
/* ทุก declaration ที่ใช้ color-mix() มีค่าสำรองอยู่ก่อนหน้า (prop: สำรอง; prop: color-mix(...);)
 * สำหรับเบราว์เซอร์รุ่นเก่า (แท็บเล็ต / Chrome < 111 / Safari < 16.2) — เพิ่มกฎใหม่ที่ใช้ color-mix ให้ใส่ค่าสำรองแบบเดียวกัน */
/* ==================================================================
 * GLOBAL — style กลางที่ใช้ร่วมกันทุกหน้า (ครู / นักเรียน / login)
 * ลำดับการโหลด: theme.css → global.css → style.css หรือ style_t.css
 * สีทั้งหมดอ้างจาก theme.css ห้ามใส่รหัสสีตรง ๆ ในไฟล์นี้
 * ================================================================== */

/* ---------- 1) ตัวอักษร ---------- */
body          { font-family: var(--font-main); color: var(--text); }
.f-kanit      { font-family: "Kanit", sans-serif; font-style: normal; }
.f-sarabun    { font-family: "Sarabun", sans-serif; font-style: normal; }
.f-300        { font-weight: 300; }
.f-500        { font-weight: 500; }
.f-700        { font-weight: 700; }
.f-900        { font-weight: 900; }
/* ช่องกรอก / dropdown / ข้อมูลในฟอร์ม และรายการรายชื่อ (list) → ฟอนต์ปกติของเครื่อง ไม่ใช่ Kanit
 * (!important เพราะเป็นกฎทั้งเว็บ ต้องชนะ font-family: inherit ของ Bootstrap / หน้า login / .f-kanit) */
input:not([type=submit]):not([type=button]):not([type=reset]), select, option, textarea,
.form-control, .form-select, datalist,
.ps-list, .mg-list, .xs-list, .cr-teachers, .as-list, .bc-table, .bc-left, .fr-list, .ck-list, .mt-names, .mt-list { font-family: var(--font-system) !important; }

/* ปุ่มเป็น Kanit เสมอ — รวมปุ่มที่อยู่ในรายการ/ตารางที่ใช้ฟอนต์ปกติของเครื่อง */
.btn { font-family: var(--font-main); }

.mono         { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.text-theme   { color: var(--primary) !important; }
.text-muted-2 { color: var(--muted) !important; }


/* ---------- 2) ปรับ Bootstrap ให้ใช้สีจาก theme ---------- */
.btn-primary {
    --bs-btn-bg: var(--primary);               --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-dark);    --bs-btn-hover-border-color: var(--primary-dark);
    --bs-btn-active-bg: var(--primary-dark);   --bs-btn-active-border-color: var(--primary-dark);
    --bs-btn-disabled-bg: var(--primary);      --bs-btn-disabled-border-color: var(--primary);
}
.btn-outline-primary {
    --bs-btn-color: var(--primary);            --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary);         --bs-btn-hover-border-color: var(--primary);
    --bs-btn-active-bg: var(--primary-dark);   --bs-btn-active-border-color: var(--primary-dark);
}
.bg-primary   { background-color: var(--primary) !important; }
.text-primary { color: var(--primary) !important; }
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 .25rem rgba(var(--primary-rgb), .15);
}
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.page-link              { color: var(--primary); }
.active > .page-link    { background-color: var(--primary); border-color: var(--primary); }

/* alert ของ Bootstrap → ใช้ชุดสีสถานะ */
.alert-success { --bs-alert-bg: var(--success-bg); --bs-alert-color: var(--success-text); --bs-alert-border-color: var(--success-bg); }
.alert-warning { --bs-alert-bg: var(--warning-bg); --bs-alert-color: var(--warning-text); --bs-alert-border-color: var(--warning-bg); }
.alert-danger  { --bs-alert-bg: var(--danger-bg);  --bs-alert-color: var(--danger-text);  --bs-alert-border-color: var(--danger-bg); }
.alert-info    { --bs-alert-bg: var(--info-bg);    --bs-alert-color: var(--info-text);    --bs-alert-border-color: var(--info-bg); }
.alert         { border-left: 4px solid currentColor; border-radius: var(--radius); }


/* ---------- 3) ชุดสีสถานะ: ป้าย (badge) ----------
 * ใช้: <span class="badge-st st-success">อนุมัติแล้ว</span>
 * สี: st-primary | st-success | st-warning | st-danger | st-info | st-neutral */
.badge-st {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 999px;
    font-size: .85rem; font-weight: 500; line-height: 1.4; white-space: nowrap;
}
.badge-st.st-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-st.st-success { background: var(--success-bg);    color: var(--success-text); }
.badge-st.st-warning { background: var(--warning-bg);    color: var(--warning-text); }
.badge-st.st-danger  { background: var(--danger-bg);     color: var(--danger-text); }
.badge-st.st-info    { background: var(--info-bg);       color: var(--info-text); }
.badge-st.st-neutral { background: var(--neutral-bg);    color: var(--neutral-text); }

/* ---------- 4) ชุดสีสถานะ: ปุ่ม ----------
 * ใช้: <button class="btn btn-st btn-st-danger">ลบ</button> */
.btn-st          { --st: var(--primary); --st-hover: var(--primary-dark);
                   --bs-btn-color: #fff; --bs-btn-bg: var(--st); --bs-btn-border-color: var(--st);
                   --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--st-hover); --bs-btn-hover-border-color: var(--st-hover);
                   --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--st-hover); --bs-btn-active-border-color: var(--st-hover); }
.btn-st-success  { --st: var(--success); --st-hover: var(--success-text); }
.btn-st-warning  { --st: var(--warning); --st-hover: var(--warning-text); }
.btn-st-danger   { --st: var(--danger);  --st-hover: var(--danger-text); }
.btn-st-info     { --st: var(--info);    --st-hover: var(--info-text); }
.btn-st-neutral  { --st: var(--neutral); --st-hover: var(--neutral-text); }

/* ---------- 5) สถานะการเช็คชื่อ ----------
 * ป้าย: <span class="att-badge att-present">มา</span>
 * ปุ่มเลือก: <label class="att-btn att-late [active]">สาย</label>
 * สถานะ: att-present | att-late | att-absent | att-sick | att-business | att-activity | att-skip | att-noline */
.att-present  { --att: var(--att-present); }
.att-late     { --att: var(--att-late); }
.att-absent   { --att: var(--att-absent); }
.att-sick     { --att: var(--att-sick); }
.att-business { --att: var(--att-business); }
.att-activity { --att: var(--att-activity); }
.att-skip     { --att: var(--att-skip); }   /* หนีเรียน (เช็ครายคาบ) */
.att-noline   { --att: var(--att-noline); }   /* ไม่เข้าแถว (เช็คตอนเช้า) */

.att-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 11px; border-radius: 999px;
    font-size: .85rem; font-weight: 500; white-space: nowrap;
    color: var(--att); background: #fff; background: color-mix(in srgb, var(--att) 12%, #fff);
}
.att-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    min-width: 54px; padding: 6px 10px; border-radius: var(--radius-sm);
    border: 1.5px solid var(--att); color: var(--att); background: var(--surface);
    font-size: .9rem; cursor: pointer; user-select: none;
    transition: background .15s, color .15s;
}
.att-btn:hover  { background: #fff; background: color-mix(in srgb, var(--att) 10%, #fff); }
.att-btn.active,
input:checked + .att-btn { background: var(--att); color: #fff; }


/* ---------- 6) กล่อง / การ์ด ---------- */
.bgbox  { --box-pad: 30px; background: var(--surface); padding: var(--box-pad); border-radius: 16px; }
.bgbox2 { background: var(--surface); padding: 20px; border-radius: var(--radius-sm); margin: 10px; }

.page-head h3 { color: #212529; margin-bottom: 2px; }   /* หัวข้อหน้า: สีดำ */
.page-head h5 { color: var(--muted); font-weight: 400; }

.info-card { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; background: var(--surface); }
.info-card > .ic-head {
    background: var(--primary-light); border-bottom: 1px solid var(--border);
    padding: 12px 18px; font-weight: 600; color: var(--primary);
    display: flex; align-items: center; gap: 9px;
}
.info-card > .ic-body { padding: 18px; }

.dl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 24px; }
.dl-cell { border-bottom: 1px dashed var(--line-soft); padding-bottom: 10px; }
.dl-cell.full { grid-column: 1 / -1; }
.dl-cell .k { color: var(--muted); font-size: .85rem; margin-bottom: 3px; }
.dl-cell .v { color: var(--text); font-weight: 500; }
@media (max-width: 576px) { .dl-grid { grid-template-columns: 1fr; } }

/* กล่องข้อความว่าง / รอดำเนินการ */
.empty-box {
    max-width: 480px; margin: 48px auto; text-align: center;
    border: 1px solid var(--border); border-radius: 16px;
    padding: 48px 32px; background: var(--bg);
}
.empty-box > i      { font-size: 3rem; color: var(--primary); }
.empty-box .eb-title { color: var(--primary); font-weight: 600; font-size: 1.25rem; margin: 16px 0 8px; }
.empty-box .eb-text  { color: var(--muted); line-height: 1.7; }

/* เมนูแบบไทล์ (ไอคอนใหญ่ + ข้อความ) */
.menu-tile {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    height: 100%; min-height: 150px; padding: 22px 12px;
    border-radius: var(--radius-lg); text-decoration: none; text-align: center;
    color: #fff; font-weight: 500; line-height: 1.3;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    transition: transform .18s ease, filter .18s ease;
}
.menu-tile i { font-size: 3rem; line-height: 1; transition: transform .18s ease; }
.menu-tile::after {
    content: ''; position: absolute; width: 120px; height: 120px; border-radius: 50%;
    right: -40px; top: -40px; background: rgba(255, 255, 255, .14); pointer-events: none;
}
a.menu-tile:hover   { color: #fff; transform: translateY(-3px); filter: brightness(1.07); }
a.menu-tile:hover i { transform: scale(1.08); }
.menu-tile .tile-badge {
    position: absolute; top: 10px; left: 10px; z-index: 1;
    background: #fff; color: var(--danger); font-size: .72rem; font-weight: 600;
    padding: 2px 9px; border-radius: 20px;
}
.menu-tile.disabled { filter: grayscale(.85); opacity: .6; cursor: not-allowed; }
@media (max-width: 576px) {
    .menu-tile   { min-height: 120px; font-size: .92rem; border-radius: 16px; }
    .menu-tile i { font-size: 2.4rem; }
}


/* ---------- 7) Footer ---------- */
.site-footer         { flex-shrink: 0; margin-top: 40px; background: var(--primary); color: #fff; }
.site-footer-rainbow { height: 3px; width: 100%; background: linear-gradient(90deg, var(--accent) 0%, var(--primary-light) 100%); }
.site-footer-content { padding: 14px 24px 30px; font-size: .85rem; line-height: 1.7; }


/* ---------- 8) แจ้งเตือนลอย (toast) ----------
 * ใช้: <div class="app-toast st-danger" id="toast">...</div> + app-toast.js ในหน้า */
.app-toast {
    position: fixed; top: 20px; left: 50%; z-index: 1100;
    width: max-content; max-width: calc(100% - 32px);
    display: flex; align-items: center; gap: 10px;
    padding: 12px 12px 12px 16px; border-radius: var(--radius);
    font-size: 14px; background: var(--surface);
    border-left: 4px solid currentColor;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .16);
    transform: translate(-50%, 0); opacity: 1;
    transition: transform .35s ease, opacity .35s ease;
    animation: app-toast-in .35s ease;
}
.app-toast span       { color: var(--text); }
.app-toast.hide       { transform: translate(-50%, -24px); opacity: 0; pointer-events: none; }
.app-toast.st-success { color: var(--success); }
.app-toast.st-warning { color: var(--warning); }
.app-toast.st-danger  { color: var(--danger); }
.app-toast.st-info    { color: var(--info); }
.app-toast-close { border: none; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; padding: 2px 4px; cursor: pointer; }
@keyframes app-toast-in {
    from { transform: translate(-50%, -24px); opacity: 0; }
    to   { transform: translate(-50%, 0);     opacity: 1; }
}


/* ==================================================================
 * 9) หน้า Login (index.php) — ครอบด้วย body.login-page
 * ================================================================== */
body.login-page {
    margin: 0; font-weight: 300;
    background: var(--page-bg);
    min-height: 100vh; min-height: 100dvh;
    display: flex; padding: 24px 16px;
    position: relative; overflow-x: hidden;
    box-sizing: border-box; /* รวม padding ในความสูง 100vh ไม่ให้หน้าสูงเกินจอ */
}
body.login-page *, body.login-page *::before, body.login-page *::after { box-sizing: border-box; }
body.login-page::before, body.login-page::after {
    content: ""; position: fixed; border-radius: 50%; z-index: 0; pointer-events: none;
}
body.login-page::before {
    width: 520px; height: 520px; top: -180px; right: -160px;
    background: radial-gradient(circle, rgba(var(--primary-rgb), .22), rgba(var(--primary-rgb), 0) 70%);
}
body.login-page::after {
    width: 460px; height: 460px; bottom: -200px; left: -140px;
    background: radial-gradient(circle, rgba(var(--primary-rgb), .16), rgba(var(--primary-rgb), 0) 70%);
}

/* ลายเส้นโรงเรียน: ใช้ pattern.png (เส้นขาวพื้นโปร่งใส) เป็น mask แล้วเติมสีหลักจาง ๆ
 * - หน้า login:      <div class="login-pattern">
 * - หน้าธีม sidebar: <body class="bg-pattern">  (วาดด้วย ::before อยู่หลังเนื้อหา) */
.login-pattern,
body.bg-pattern::before {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 0; pointer-events: none;
    background: var(--primary); opacity: .07;
    -webkit-mask: url("../uploads/menu/pattern.png") repeat 0 0 / 420px 420px;
            mask: url("../uploads/menu/pattern.png") repeat 0 0 / 420px 420px;
}
body.bg-pattern::before { content: ""; z-index: -1; }
@media (max-width: 820px) {
    .login-pattern,
    body.bg-pattern::before { -webkit-mask-size: 300px 300px; mask-size: 300px 300px; }
}

.login-wrap {
    position: relative; z-index: 1;
    width: 100%; max-width: 1180px; margin: auto;
    min-height: 640px; min-height: min(680px, calc(100dvh - 48px));
    display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    background: var(--surface); border-radius: 28px; overflow: hidden;
    box-shadow: 0 24px 60px rgba(var(--primary-rgb), .18), 0 2px 6px rgba(var(--primary-rgb), .06);
}

/* ฝั่งซ้าย: ข้อมูลโรงเรียน */
.login-brand {
    position: relative; padding: 60px 56px; color: #fff;
    background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
}
.login-brand::after {
    content: ""; position: absolute; width: 420px; height: 420px; right: -140px; bottom: -140px;
    border-radius: 50%; border: 48px solid rgba(255, 255, 255, .07);
}
.login-brand > * { position: relative; z-index: 1; }
.brand-logo { display: flex; align-items: center; gap: 14px; }
.brand-logo .logo-box {
    flex: 0 0 76px; width: 76px; height: 76px; border-radius: 18px; background: #fff;
    display: flex; align-items: center; justify-content: center; padding: 6px;
}
.brand-logo .logo-box img { width: 100%; height: 100%; object-fit: contain; }
.brand-logo .logo-box i   { font-size: 32px; color: var(--primary); }
.brand-logo .school   { font-size: 15px; line-height: 1.45; opacity: .9; }
.brand-logo .school b { display: block; font-size: 21px; font-weight: 500; opacity: 1; }

.brand-title { margin: 44px 0 0; font-size: 40px; font-weight: 500; line-height: 1.25; }
/* โลโก้ระบบแทนชื่อ (uploads/menu/logo_phraohub.png) — กลางแผง ไม่มีพื้นหลัง */
.brand-hero { margin: 40px auto 0; max-width: 460px; line-height: 0; }
.brand-hero img { display: block; width: 100%; height: auto; }
.brand-hero + .brand-sub, .brand-hero ~ .brand-year { text-align: center; }
.login-brand .brand-hero ~ .brand-year { display: flex; width: max-content; margin-left: auto; margin-right: auto; }
@media (max-width: 575.98px) { .brand-hero { margin-top: 20px; } }

/* เข้าสู่ระบบสำเร็จ — หน้าต้อนรับเต็มจอ ~2.6 วิ แล้วเปลี่ยนหน้าขณะยังเต็มจอ (index.php)
   หน้าเมนู (menu_page.php · html.from-welcome) เริ่มใต้ชั้นสีเดียวกัน แล้วค่อยจางเผยเมนู → ต่อเนื่อง ไม่เห็นหน้า login */
.login-welcome {
    position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 50% 40%, var(--primary) 0%, var(--primary-dark) 75%);
    color: #fff; text-align: center; overflow: hidden; animation: lw-in .35s ease-out both;
}
.login-welcome.go .lw-body { animation: lw-go .35s ease-in forwards; }   /* เนื้อหาลอยจางขึ้น พื้นสีคงไว้ระหว่างโหลดหน้าเมนู */
@keyframes lw-go { to { opacity: 0; transform: translateY(-14px) scale(.97); } }
/* หน้าเมนูที่มาจากหน้าต้อนรับ: ชั้นสีม่วงเต็มจอ → จางออกเผยเมนู + เมนูลอยขึ้นเล็กน้อย */
html.from-welcome body::before {
    content: ""; position: fixed; inset: 0; z-index: 5000; pointer-events: none;
    background: radial-gradient(circle at 50% 40%, var(--primary) 0%, var(--primary-dark) 75%);
    animation: lw-reveal .7s ease-out .1s both;
}
html.from-welcome body > * { animation: lw-rise .7s ease-out .15s both; }
@keyframes lw-reveal { from { opacity: 1; } to { opacity: 0; visibility: hidden; } }
@keyframes lw-rise   { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.lw-ring {
    position: absolute; left: 50%; top: 42%; width: 220px; height: 220px; margin: -110px 0 0 -110px; border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .35); animation: lw-ring 1.6s ease-out .2s infinite;
}
.lw-body { position: relative; padding: 0 24px; }
.lw-logo  { display: block; width: min(320px, 72vw); height: auto; margin: 0 auto 6px; animation: lw-pop .6s cubic-bezier(.2, 1.4, .4, 1) .1s both; }
.lw-check { width: 56px; height: 56px; margin: 4px auto 10px; display: block; }
.lw-check circle { fill: none; stroke: rgba(255, 255, 255, .9); stroke-width: 3; stroke-dasharray: 151; stroke-dashoffset: 151; animation: lw-draw .5s ease-out .35s forwards; }
.lw-check path   { fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 36; stroke-dashoffset: 36; animation: lw-draw .35s ease-out .8s forwards; }
.lw-hello { font-size: 18px; opacity: .85; animation: lw-up .45s ease-out .5s both; }
.lw-name  { font-size: 28px; font-weight: 600; line-height: 1.3; animation: lw-up .45s ease-out .62s both; }
.lw-bar   { width: 180px; height: 4px; margin: 18px auto 8px; border-radius: 999px; background: rgba(255, 255, 255, .25); overflow: hidden; animation: lw-up .4s ease-out .7s both; }
.lw-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: #fff; animation: lw-fill 1.6s ease-in-out .8s forwards; }
.lw-note  { font-size: 13px; opacity: .75; animation: lw-up .4s ease-out .75s both; }
@keyframes lw-in   { from { opacity: 0; } to { opacity: 1; } }
@keyframes lw-pop  { from { opacity: 0; transform: scale(.7) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes lw-up   { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes lw-draw { to { stroke-dashoffset: 0; } }
@keyframes lw-fill { to { width: 100%; } }
@keyframes lw-ring { from { transform: scale(.6); opacity: .9; } to { transform: scale(2.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .login-welcome, .login-welcome *, html.from-welcome body::before, html.from-welcome body > * { animation: none !important; }
    html.from-welcome body::before { display: none; }
    .lw-check circle, .lw-check path { stroke-dashoffset: 0; }
    .lw-bar span { width: 100%; }
    .lw-ring { display: none; }
}
@media (max-width: 575.98px) { .lw-name { font-size: 22px; } }
.brand-sub   { margin: 10px 0 0; font-size: 16px; opacity: .88; line-height: 1.6; }
.brand-year {
    display: inline-flex; align-items: center; gap: 8px; margin-top: 20px;
    padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, .16); font-size: 14px;
}

/* ฝั่งขวา: ฟอร์ม */
.login-form { padding: 60px 64px; display: flex; flex-direction: column; justify-content: center; }
.login-form > * { width: 100%; max-width: 440px; margin-left: auto; margin-right: auto; }
.login-form h2 { margin-top: 0; margin-bottom: 0; font-size: 30px; font-weight: 500; }
.login-form .hint { margin-top: 6px; margin-bottom: 28px; color: var(--muted); font-size: 15px; }

.login-field { margin-bottom: 18px; }
.login-field label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 400; }
.login-input { position: relative; display: flex; align-items: center; }
.login-input > i { position: absolute; left: 15px; color: var(--muted); font-size: 17px; pointer-events: none; }
.login-input input {
    width: 100%; height: 54px; padding: 0 46px 0 44px;
    border: 1.5px solid var(--border); border-radius: var(--radius);
    font-family: inherit; font-size: 15px; color: var(--text); background: var(--bg);
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.login-input input:focus {
    outline: none; border-color: var(--primary); background: var(--surface);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .14);
}
.toggle-pass {
    position: absolute; right: 8px; width: 36px; height: 36px;
    border: none; border-radius: var(--radius-sm); background: transparent;
    color: var(--muted); font-size: 17px; cursor: pointer;
}
.toggle-pass:hover { color: var(--primary); background: var(--primary-light); }

.login-remember {
    display: flex; align-items: center; gap: 8px; margin: 2px 0 18px;
    font-size: 14px; color: var(--muted); cursor: pointer; user-select: none;
}
.login-remember input { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }

.btn-login {
    width: 100%; height: 56px; border: none; border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff; font-family: inherit; font-size: 16px; font-weight: 400;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
    box-shadow: 0 8px 20px rgba(var(--primary-rgb), .3);
    transition: transform .15s, box-shadow .15s, opacity .15s;
}
.btn-login:hover    { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(var(--primary-rgb), .36); }
.btn-login:active   { transform: translateY(0); }
.btn-login:disabled { opacity: .75; cursor: wait; }

.back-link { margin-top: 22px; text-align: center; font-size: 14px; }
.back-link a { color: var(--primary); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.back-link a:hover { text-decoration: underline; }

.login-footer {
    margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--border);
    text-align: center; color: var(--muted); font-size: 12px; line-height: 1.6;
}

/* จอไม่เล็ก (≥ 768px): กรอบกลางจอ จำกัดกว้าง/สูง (จอกลาง 860px · จอใหญ่ 1000px) — จอเตี้ยลดระยะบน-ล่างตามกฎด้านล่าง */
@media (min-width: 768px) {
    body.login-page { --login-gap: 80px; --login-gap-y: var(--login-gap); padding: 80px; padding: var(--login-gap-y) var(--login-gap); }
    .login-wrap {
        max-width: 860px; margin: auto;
        min-height: 560px; min-height: min(560px, calc(100dvh - var(--login-gap-y) * 2));
    }
}

/* จอกลาง (768–991px): ยัง 2 คอลัมน์ เต็มความกว้าง */
@media (max-width: 991.98px) {
    .login-brand { padding: 44px 36px; }
    .brand-title { margin-top: 34px; font-size: 32px; }
    .login-form  { padding: 44px 36px; }
}

/* จอใหญ่ (≥ 1200px): กรอบกว้างสุด 1000px สูง 600px */
@media (min-width: 1200px) {
    .login-wrap { max-width: 1000px; min-height: 600px; min-height: min(600px, calc(100dvh - var(--login-gap-y) * 2)); }
}

/* จอไม่สูง (โน้ตบุ๊ก 768px / จอแนวนอนเตี้ย): ลดระยะบน-ล่าง + ระยะในกรอบ ไม่ให้เกิดสกรอล์บน-ล่าง (ระยะซ้าย-ขวาคง --login-gap) */
@media (min-width: 768px) and (max-height: 900px) {
    body.login-page { --login-gap-y: 40px; }
    .login-brand, .login-form { padding-top: 40px; padding-bottom: 40px; }
    .brand-title { margin-top: 28px; }
    .login-form .hint { margin-bottom: 20px; }
    .login-footer { margin-top: 20px; }
}
@media (min-width: 768px) and (max-height: 760px) {
    body.login-page { --login-gap-y: 20px; }
    .login-brand, .login-form { padding-top: 26px; padding-bottom: 26px; }
    .brand-title { margin-top: 20px; font-size: 30px; }
    .login-field { margin-bottom: 12px; }
    .login-input input { height: 48px; }
    .btn-login { height: 50px; }
    .back-link { margin-top: 14px; }
    .login-footer { margin-top: 14px; padding-top: 12px; }
}

/* จอเล็ก (< 768px): เต็มหน้าจอ ไม่มีมุมโค้ง / เงา / ระยะขอบ — หัวข้อมูลโรงเรียนด้านบน ฟอร์มเต็มพื้นที่ที่เหลือ */
@media (max-width: 767.98px) {
    body.login-page { padding: 0; }
    .login-wrap {
        max-width: none; margin: 0; border-radius: 0; box-shadow: none;
        min-height: 100vh; min-height: 100dvh;
        grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr;
    }
    .login-brand { padding: 28px 22px 26px; }
    .login-brand::after { width: 260px; height: 260px; right: -110px; bottom: -130px; border-width: 36px; }
    .brand-logo .logo-box { flex-basis: 60px; width: 60px; height: 60px; border-radius: 14px; }
    .brand-logo .school b { font-size: 18px; }
    .brand-title { margin-top: 20px; font-size: 26px; }
    .brand-sub   { font-size: 14px; }
    .login-form  { padding: 30px 22px 24px; justify-content: flex-start; }
    .login-form h2 { font-size: 26px; }
}


/* ==================================================================
 * 10) หน้าเมนูหลัก (student/menu.php, teacher/menu.php → config/menu_page.php)
 *     ครอบด้วย body.menu-page — สีการ์ดใช้ --tile-* จาก theme.css ผ่าน class t-ชื่อสี
 * ================================================================== */
body.menu-page {
    margin: 0; min-height: 100vh; display: flex; flex-direction: column;
    background: var(--bg); font-weight: 300;
}
body.menu-page .site-footer { margin-top: 48px; }
body.menu-page .site-footer-content { text-align: center; }
.mp-wrap { width: 100%; max-width: 1320px; margin: 0 auto; padding: 0 24px; }

/* ---------- แถบบน ---------- */
.mp-topbar {
    position: sticky; top: 0; z-index: 1020;
    background: var(--primary-dark); color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
}
.mp-topbar-in { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 24px; } /* เต็มความกว้างจอ */
.mp-brand {
    display: inline-flex; align-items: center; gap: 10px; min-width: 0;
    color: #fff; text-decoration: none; font-size: 18px;
}
.mp-brand:hover    { color: #fff; }
.mp-brand > i      { font-size: 20px; color: var(--accent); }
.mp-brand-name     { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-brand-side     { font-weight: 300; opacity: .85; white-space: nowrap; }
.mp-topnav         { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.mp-topnav a {
    display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 10px;
    color: #fff; text-decoration: none; font-size: 15px; font-weight: 400;
    transition: background .15s;
}
.mp-topnav a:hover  { background: rgba(255, 255, 255, .14); color: #fff; }
.mp-topnav-out      { display: none !important; }

/* ---------- โปรไฟล์ ---------- */
.mp-hero {
    position: relative; overflow: hidden; color: #fff;
    padding: 34px 0 96px;
    background-color: var(--primary);
    background-image:
        radial-gradient(90% 120% at 100% 0%, rgba(255, 255, 255, .18) 0%, rgba(255, 255, 255, 0) 60%),
        linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}
/* ลายเส้นโรงเรียน: PNG เส้นขาวพื้นโปร่งใส → เข้ากับสีธีมทุกสี (ปรับความเข้มที่ opacity) */
.mp-hero::before {
    content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none;
    background: url("../uploads/menu/pattern.png") repeat 0 0 / 420px 420px;
    opacity: .18;
}
.mp-hero > .mp-wrap { position: relative; z-index: 1; }
@media (max-width: 575.98px) {
    .mp-hero::before { background-size: 300px 300px; }
}
.mp-profile {
    display: flex; align-items: center; gap: 24px;
    max-width: 1100px; margin: 0 auto; padding: 24px 28px;
    border-radius: 22px;
    background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .24);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .12);
    animation: mp-rise .5s ease both;
}
.mp-avatar {
    flex: 0 0 96px; width: 96px; height: 96px; border-radius: 50%; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: #fff; color: var(--primary);
    border: 4px solid rgba(255, 255, 255, .7);
    box-shadow: 0 0 0 6px rgba(255, 255, 255, .14), 0 10px 24px rgba(0, 0, 0, .18);
}
.mp-avatar img   { width: 100%; height: 100%; object-fit: cover; }
.mp-avatar i     { font-size: 52px; }
.mp-initial      { font-size: 40px; font-weight: 600; }
/* modal ที่ยาวเกินจอ: ใช้ .modal-dialog-scrollable เสมอ — ถ้ามี <form> ครอบ header/body/footer
   form ต้องเป็น flex column ด้วย ไม่งั้น modal-body ไม่ scroll (ทั้งกล่องเลยขอบจอ) — ใช้ได้กับทุก modal ในเว็บ */
.modal-dialog-scrollable .modal-content > form { display: flex; flex-direction: column; min-height: 0; max-height: 100%; overflow: hidden; }
.modal-dialog-scrollable .modal-content > form > .modal-body { overflow-y: auto; }
/* รูปโปรไฟล์คลิกได้ (เปิด modal เปลี่ยนรูป — $avatar_modal) */
.mp-avatar-btn   { position: relative; padding: 0; cursor: pointer; font-family: inherit; }
.mp-avatar-cam {
    position: absolute; left: 0; right: 0; bottom: 0; height: 32%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .45); color: #fff; transition: background .15s;
}
.mp-avatar .mp-avatar-cam i { font-size: 14px; }
.mp-avatar-btn:hover .mp-avatar-cam, .mp-avatar-btn:focus-visible .mp-avatar-cam { background: rgba(0, 0, 0, .65); }
/* modal เปลี่ยนรูป (student/photo.php) */
.ph-preview {
    width: 140px; height: 140px; margin: 0 auto; border-radius: 50%; overflow: hidden; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    background: #f1f3f5; color: #adb5bd; border: 3px solid #dee2e6;
}
.ph-preview img  { width: 100%; height: 100%; object-fit: cover; }
.ph-preview i    { font-size: 72px; }
.mp-who          { flex: 1 1 auto; min-width: 0; }
.mp-greet        { margin: 0 0 2px; font-size: 14px; opacity: .85; }
.mp-name         { margin: 0; font-size: clamp(22px, 2.6vw, 30px); font-weight: 600; line-height: 1.3; }
.mp-chips        { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mp-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
    font-size: 13px; font-weight: 400;
    background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .3);
}
.mp-side   { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.mp-today  { display: flex; align-items: flex-start; gap: 10px; text-align: right; font-size: 13px; line-height: 1.5; }
.mp-today > i { font-size: 20px; color: var(--accent); order: 2; }
.mp-today b   { display: block; font-weight: 500; font-size: 14px; }
.mp-today span { opacity: .85; }
.mp-logout {
    display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 12px;
    color: #fff; text-decoration: none; font-size: 14px; font-weight: 400;
    border: 1px solid rgba(255, 255, 255, .45); background: rgba(255, 255, 255, .08);
    transition: background .15s, color .15s;
}
.mp-logout:hover { background: #fff; color: var(--danger); }

/* ---------- แผงเมนู ---------- */
.mp-main  { position: relative; z-index: 1; margin-top: -64px; flex: 1 0 auto; }
.mp-panel {
    background: var(--surface); border-radius: 24px; padding: 26px 32px 34px;
    box-shadow: 0 18px 48px rgba(var(--primary-rgb), .10), 0 2px 6px rgba(0, 0, 0, .04);
}
.mp-panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    padding-bottom: 18px; margin-bottom: 24px; border-bottom: 1px solid var(--border);
}
.mp-title { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 600; color: var(--primary-dark); }
.mp-title i { color: var(--primary); }
.mp-search { position: relative; flex: 0 1 280px; margin: 0; }
.mp-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.mp-search input {
    width: 100%; height: 42px; padding: 0 14px 0 40px;
    border: 1.5px solid var(--border); border-radius: 999px; background: var(--bg);
    font-family: inherit; font-size: 15px; color: var(--text);
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.mp-search input:focus {
    outline: none; border-color: var(--primary); background: var(--surface);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .12);
}

.mp-group + .mp-group { margin-top: 34px; }
.mp-group-title {
    display: flex; align-items: center; gap: 14px; margin: 0 0 18px;
    font-size: 16px; font-weight: 500; color: var(--muted);
}
.mp-group-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.mp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 20px; }

/* ---------- การ์ดเมนู ---------- */
/* ค่าเริ่มต้นสีของ component = สีหลัก — ใช้ :where() (ความสำคัญ 0) เพื่อให้ class t-สี ด้านล่างชนะเสมอ
 * ไม่ว่ากฎของ component จะอยู่ก่อนหรือหลังในไฟล์ — ห้ามใส่ --tc ในกฎของ component เอง */
:where(.mp-tile, .set-card, .sys-head, .ps-group, .pf-box) { --tc: var(--primary); }

.t-violet { --tc: var(--tile-violet); }  .t-blue   { --tc: var(--tile-blue); }
.t-indigo { --tc: var(--tile-indigo); }  .t-teal   { --tc: var(--tile-teal); }
.t-green  { --tc: var(--tile-green); }   .t-amber  { --tc: var(--tile-amber); }
.t-orange { --tc: var(--tile-orange); }  .t-red    { --tc: var(--tile-red); }
.t-pink   { --tc: var(--tile-pink); }    .t-slate  { --tc: var(--tile-slate); }
.t-navy   { --tc: var(--tile-navy); }    .t-purple { --tc: var(--tile-purple); }

.mp-tile {
    display: flex; flex-direction: column; overflow: hidden;
    border-radius: 18px; background: var(--surface); text-decoration: none;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .05);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    animation: mp-rise .45s ease both;
}
.mp-tile[hidden] { display: none; }
.mp-tile:hover {
    transform: translateY(-5px); border-color: transparent; border-color: color-mix(in srgb, var(--tc) 35%, transparent);
    box-shadow: 0 16px 30px transparent; box-shadow: 0 16px 30px color-mix(in srgb, var(--tc) 28%, transparent);
}
.mp-tile:focus-visible { outline: 3px solid var(--tc); outline: 3px solid color-mix(in srgb, var(--tc) 55%, transparent); outline-offset: 2px; }

.mp-art {
    position: relative; overflow: hidden; aspect-ratio: 3 / 2; /* เท่ารูปเมนู 1536×1024 */
    display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(70% 90% at 20% 15%, rgba(255, 255, 255, .35) 0%, rgba(255, 255, 255, 0) 60%),
        linear-gradient(150deg, var(--tc) 0%, var(--tc) 45%, var(--tc) 100%); background:
        radial-gradient(70% 90% at 20% 15%, rgba(255, 255, 255, .35) 0%, rgba(255, 255, 255, 0) 60%),
        linear-gradient(150deg, color-mix(in srgb, var(--tc) 78%, #fff) 0%, var(--tc) 45%, color-mix(in srgb, var(--tc) 72%, #000) 100%);
}
/* เนินคลื่นด้านล่าง */
.mp-art::after {
    content: ""; position: absolute; left: -10%; right: -10%; bottom: -46px; height: 80px;
    border-radius: 50%; background: rgba(255, 255, 255, .16);
}
/* เส้นรัศมีมุมขวาบน */
.mp-burst {
    position: absolute; top: -18px; right: -18px; width: 86px; height: 86px; border-radius: 50%;
    background: repeating-conic-gradient(rgba(255, 255, 255, .7) 0deg 7deg, transparent 7deg 30deg);
    -webkit-mask: radial-gradient(circle, transparent 38%, #000 39%, #000 64%, transparent 65%);
            mask: radial-gradient(circle, transparent 38%, #000 39%, #000 64%, transparent 65%);
    transition: transform .6s ease;
}
.mp-star         { position: absolute; color: rgba(255, 255, 255, .55); transition: transform .4s ease; }
.mp-star.s1      { top: 14px; left: 16px; font-size: 18px; transform: rotate(-12deg); }
.mp-star.s2      { bottom: 22px; right: 22px; font-size: 12px; color: var(--accent); color: color-mix(in srgb, var(--accent) 80%, #fff); }
.mp-dot {
    position: absolute; bottom: 18px; left: 22px; width: 26px; height: 26px; border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, .45);
}
.mp-icon {
    position: relative; z-index: 1;
    width: 78px; height: 78px; border-radius: 24px;
    display: flex; align-items: center; justify-content: center;
    background: #fff; color: var(--tc);
    box-shadow: 0 12px 22px var(--tc), inset 0 -4px 0 #fff; box-shadow: 0 12px 22px color-mix(in srgb, var(--tc) 55%, #000 10%), inset 0 -4px 0 color-mix(in srgb, var(--tc) 14%, #fff);
    transform: rotate(-6deg);
    transition: transform .25s ease;
}
.mp-icon i { font-size: 38px; line-height: 1; }
/* การ์ดที่มีรูป: รูปเต็มพื้นที่ ไม่แสดงลายตกแต่ง */
.mp-art.has-img        { background: var(--tc); }
.mp-art.has-img::after { display: none; }
.mp-img {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover;
    transition: transform .35s ease;
}
.mp-tile:hover .mp-img   { transform: scale(1.06); }
.mp-tile:hover .mp-icon  { transform: rotate(0) scale(1.08); }
.mp-tile:hover .mp-burst { transform: rotate(40deg); }
.mp-tile:hover .mp-star.s1 { transform: rotate(20deg) scale(1.15); }

.mp-flag, .mp-badge {
    position: absolute; z-index: 2; top: 10px;
    padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 500; line-height: 1.6;
}
.mp-flag  { left: 10px; background: rgba(0, 0, 0, .28); color: #fff; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.mp-badge { right: 10px; background: #fff; color: var(--danger); box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }
.mp-tile.is-soon .mp-icon { box-shadow: 0 8px 16px transparent; box-shadow: 0 8px 16px color-mix(in srgb, var(--tc) 40%, transparent); }

.mp-label {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 14px 10px 16px; text-align: center; line-height: 1.35;
}
.mp-label b     { font-size: 15.5px; font-weight: 600; color: var(--text); }
.mp-label small { font-size: 12.5px; color: var(--tc); color: color-mix(in srgb, var(--tc) 80%, #000); }

/* ---------- งานค้าง (config/pending.php) — แดง = งานของตัวเอง · ส้ม = รออนุมัติ (ผู้ดูแลระบบ) ---------- */
.mp-tile.has-pend { border-color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.mp-pend-n {
    position: absolute; z-index: 2; top: 8px; right: 8px;
    min-width: 30px; height: 30px; padding: 0 9px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; line-height: 1; color: #fff;
    border: 2px solid #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .25);
}
.mp-pend-n.is-todo { background: var(--danger); }
.mp-pend-n.is-wait { background: var(--tile-orange); }
.mp-pend {
    margin-top: 6px; max-width: 100%; padding: 2px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 500; line-height: 1.6;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mp-pend.is-todo { background: var(--danger-bg); color: var(--danger-text); }
.mp-pend.is-wait { background: #fff1e6; color: #b04a0a; }

.mp-todo {
    margin-bottom: 24px; border-radius: 18px; overflow: hidden;
    border: 1px solid var(--border); border-left: 5px solid var(--danger); background: var(--surface);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .05);
}
.mp-todo-head {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px;
    padding: 12px 18px; background: var(--danger-bg);
}
.mp-todo-ic {
    width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--danger); color: #fff; font-size: 15px;
}
.mp-todo-head b   { font-size: 16px; font-weight: 600; color: var(--danger-text); }
.mp-todo-n        { padding: 1px 10px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 12.5px; font-weight: 600; }
.mp-todo-time     { margin-left: auto; font-size: 12px; color: var(--muted); }
.mp-todo-list     { list-style: none; margin: 0; padding: 0; }
.mp-todo-list li + li { border-top: 1px solid var(--border); }
.mp-todo-list a {
    display: flex; align-items: center; gap: 12px; padding: 10px 18px;
    color: var(--text); text-decoration: none; transition: background .15s;
}
.mp-todo-list a:hover { background: var(--bg); }
.mp-todo-dot      { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; background: var(--danger); }
.is-wait .mp-todo-dot { background: var(--tile-orange); }
.mp-todo-body     { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.mp-todo-sys      { font-size: 12px; color: var(--muted); }
.mp-todo-txt      { font-size: 14.5px; font-weight: 500; }
.mp-todo-go {
    flex: 0 0 auto; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 500;
    background: var(--danger-bg); color: var(--danger-text); white-space: nowrap;
}
.is-wait .mp-todo-go { background: #fff1e6; color: #b04a0a; }
@media (max-width: 575.98px) {
    .mp-todo-head  { padding: 10px 14px; }
    .mp-todo-time  { margin-left: 0; flex-basis: 100%; }
    .mp-todo-list a { padding: 10px 14px; gap: 10px; }
    .mp-todo-txt   { font-size: 13.5px; }
    .mp-todo-go    { padding: 4px 10px; font-size: 12px; }
    .mp-pend-n     { min-width: 26px; height: 26px; font-size: 12.5px; top: 6px; right: 6px; }
    .mp-pend       { font-size: 11px; padding: 1px 8px; }
}

.mp-empty   { padding: 40px 16px; text-align: center; color: var(--muted); }
.mp-empty i { font-size: 2.4rem; color: var(--primary); }
.mp-empty p { margin: 10px 0 0; }

/* การ์ดค่อย ๆ ปรากฏทีละใบ */
.mp-grid .mp-tile:nth-child(2) { animation-delay: .04s; }  .mp-grid .mp-tile:nth-child(3) { animation-delay: .08s; }
.mp-grid .mp-tile:nth-child(4) { animation-delay: .12s; }  .mp-grid .mp-tile:nth-child(5) { animation-delay: .16s; }
.mp-grid .mp-tile:nth-child(6) { animation-delay: .20s; }  .mp-grid .mp-tile:nth-child(n+7) { animation-delay: .24s; }
@keyframes mp-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- แท็บเล็ต ---------- */
@media (max-width: 991.98px) {
    .mp-profile { flex-wrap: wrap; }
    .mp-side    { flex: 1 1 100%; flex-direction: row; align-items: center; justify-content: space-between;
                  padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .2); }
    .mp-today   { text-align: left; }
    .mp-today > i { order: 0; }
    .mp-panel   { padding: 22px 22px 28px; }
    .mp-grid    { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
}

/* ---------- มือถือ ---------- */
@media (max-width: 575.98px) {
    .mp-wrap         { padding: 0 12px; }
    .mp-topbar-in    { min-height: 52px; padding: 0 12px; }
    .mp-brand        { font-size: 16px; }
    .mp-topnav a span { display: none; }
    .mp-topnav-out   { display: inline-flex !important; }
    .mp-hero         { padding: 18px 0 80px; }
    .mp-profile      { gap: 14px; padding: 18px; border-radius: 18px; }
    .mp-avatar       { flex-basis: 64px; width: 64px; height: 64px; border-width: 3px; }
    .mp-avatar i     { font-size: 36px; }
    .mp-initial      { font-size: 28px; }
    .mp-name         { font-size: 19px; }
    .mp-chip         { font-size: 12px; padding: 3px 10px; }
    .mp-side         { padding-top: 12px; }
    .mp-logout       { display: none; }
    .mp-main         { margin-top: -56px; }
    .mp-panel        { padding: 18px 14px 22px; border-radius: 20px; }
    .mp-panel-head   { padding-bottom: 14px; margin-bottom: 18px; }
    .mp-title        { font-size: 18px; }
    .mp-search       { flex: 1 1 100%; }
    .mp-grid         { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .mp-tile         { border-radius: 16px; }
    .mp-icon         { width: 58px; height: 58px; border-radius: 18px; }
    .mp-icon i       { font-size: 28px; }
    .mp-burst        { width: 64px; height: 64px; }
    .mp-label        { padding: 10px 6px 12px; }
    .mp-label b      { font-size: 14px; }
    .mp-label small  { font-size: 11.5px; }
}

@media (prefers-reduced-motion: reduce) {
    .mp-profile, .mp-tile { animation: none; }
    .mp-tile, .mp-icon, .mp-burst, .mp-star, .mp-img { transition: none; }
}


/* ==================================================================
 * 11) การ์ดเมนูหน้าตั้งค่า (teacher/setting/index.php)
 *     <a class="set-card t-teal t2-green"> — หัวการ์ดไล่สี 2 สี (t-สีแรก → t2-สีที่สอง)
 *     หัวการ์ด: ตัวหนังสือขาว / เนื้อหา: ตัวหนังสือดำ + ปุ่มสีของการ์ด
 * ================================================================== */
.t2-violet { --tc2: var(--tile-violet); }  .t2-blue   { --tc2: var(--tile-blue); }
.t2-indigo { --tc2: var(--tile-indigo); }  .t2-teal   { --tc2: var(--tile-teal); }
.t2-green  { --tc2: var(--tile-green); }   .t2-amber  { --tc2: var(--tile-amber); }
.t2-orange { --tc2: var(--tile-orange); }  .t2-red    { --tc2: var(--tile-red); }
.t2-pink   { --tc2: var(--tile-pink); }    .t2-slate  { --tc2: var(--tile-slate); }
.t2-navy   { --tc2: var(--tile-navy); }   .t2-purple { --tc2: var(--tile-purple); }

.set-card {
    position: relative; height: 100%;
    display: flex; flex-direction: column;
    border-radius: var(--radius-lg); overflow: hidden;
    background: var(--surface); color: #212529; text-decoration: none;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
    transition: transform .18s ease, box-shadow .18s ease;
}
.set-card:hover { color: #212529; transform: translateY(-4px); box-shadow: 0 16px 32px rgba(0, 0, 0, .14); }

/* หัวการ์ด: ไล่สี + วงกลมตกแต่ง */
.set-card-top {
    position: relative; overflow: hidden;
    display: flex; align-items: center; gap: 14px;
    padding: 20px 20px 18px; color: #fff;
    background: linear-gradient(135deg, var(--tc) 0%, var(--tc2, var(--tc)) 100%);
}
.set-card-top::after {
    content: ""; position: absolute; width: 140px; height: 140px; border-radius: 50%;
    right: -40px; top: -60px; background: rgba(255, 255, 255, .16); pointer-events: none;
}
.set-card-icon {
    flex: 0 0 52px; width: 52px; height: 52px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; color: var(--tc); background: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .12);
}
.set-card-title { font-size: 1.2rem; font-weight: 600; line-height: 1.3; }
.set-card-stat  { margin-left: auto; text-align: right; line-height: 1.1; position: relative; z-index: 1; }
.set-card-stat b { display: block; font-size: 1.9rem; font-weight: 700; }
.set-card-stat small { font-size: .78rem; opacity: .9; }

/* เนื้อหาการ์ด */
.set-card-body { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 16px 20px 18px; }
.set-card-desc { flex: 1; color: #495057; font-size: .92rem; line-height: 1.65; }
.set-card-go {
    align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 999px; font-size: .88rem; font-weight: 500;
    color: var(--tc); background: #fff; background: color-mix(in srgb, var(--tc) 12%, #fff);
    transition: background .18s, color .18s;
}
.set-card:hover .set-card-go { background: var(--tc); color: #fff; }

/* ==================================================================
 * 12) หัวระบบ (config/head.php) — แถบคลุมเต็มขอบบนของ .bgbox
 *     สีอ่อนกว่า navbar: ไล่จาก primary-light → สีระบบจาง ๆ
 *     เปลี่ยนสีรายระบบด้วย $sys_color → class t-ชื่อสี (--tc)
 * ================================================================== */
.sys-head {
    display: flex; align-items: center; gap: 20px;
    /* ดึงออกชนขอบกล่อง .bgbox ทั้งบน ซ้าย ขวา */
    margin: calc(-1 * var(--box-pad, 30px)) calc(-1 * var(--box-pad, 30px)) var(--box-pad, 30px);
    padding: 22px var(--box-pad, 30px);
    border-radius: inherit; border-bottom-left-radius: 0; border-bottom-right-radius: 0;
    background:
        radial-gradient(circle at 100% 0%, transparent 0, transparent 55%),
        linear-gradient(120deg, #fff 0%, #fff 100%); background:
        radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--tc) 16%, transparent) 0, transparent 55%),
        linear-gradient(120deg, color-mix(in srgb, var(--tc) 10%, #fff) 0%, color-mix(in srgb, var(--tc) 20%, #fff) 100%);
    border-bottom: 1px solid #fff; border-bottom: 1px solid color-mix(in srgb, var(--tc) 22%, #fff);
}
.sys-head-art {
    flex: 0 0 auto; width: 120px; aspect-ratio: 3 / 2;
    border-radius: var(--radius); overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface); color: var(--tc); font-size: 40px;
    box-shadow: 0 6px 16px transparent; box-shadow: 0 6px 16px color-mix(in srgb, var(--tc) 25%, transparent);
}
.sys-head-art img { width: 100%; height: 100%; object-fit: cover; }
.sys-head-text  { min-width: 0; }
.sys-head-title { margin: 0; font-size: 1.75rem; font-weight: 700; line-height: 1.25; color: var(--tc); color: color-mix(in srgb, var(--tc) 85%, #000); }
.sys-head-sub   { margin-top: 2px; font-size: 1rem; color: var(--tc); color: color-mix(in srgb, var(--tc) 70%, #fff); font-weight: 500; letter-spacing: .3px; }

@media (max-width: 576px) {
    .sys-head       { gap: 14px; padding-top: 16px; padding-bottom: 16px; }
    .sys-head-art   { width: 110px; font-size: 34px; border-radius: var(--radius-sm); }
    .sys-head-title { font-size: 1.25rem; }
    .sys-head-sub   { font-size: .85rem; }
}


/* ==================================================================
 * 13) ทำเนียบบุคลากร (teacher/setting/personnel.php)
 *     <section class="ps-group t-สีกลุ่ม"> หัวกลุ่ม + รายการรายคน .ps-list > .ps-row
 * ================================================================== */
.ps-group { margin-bottom: 30px; }
.ps-group-head {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; margin-bottom: 14px; border-radius: var(--radius);
    color: #fff; background: linear-gradient(135deg, var(--tc) 0%, var(--tc) 100%); background: linear-gradient(135deg, var(--tc) 0%, color-mix(in srgb, var(--tc) 70%, #fff) 100%);
    box-shadow: 0 4px 12px transparent; box-shadow: 0 4px 12px color-mix(in srgb, var(--tc) 30%, transparent);
}
.ps-group-icon {
    width: 34px; height: 34px; border-radius: 10px; flex: 0 0 34px;
    display: flex; align-items: center; justify-content: center;
    background: #fff; color: var(--tc); font-size: 18px;
}
.ps-group-title { font-size: 1.05rem; font-weight: 600; }
.ps-group-count { margin-left: auto; padding: 2px 12px; border-radius: 999px; background: rgba(255, 255, 255, .22); font-size: .85rem; white-space: nowrap; }

/* รายการรายคน: ลำดับ | รูป | ชื่อ+ตำแหน่ง | ติดต่อ | ปุ่ม */
.ps-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.ps-row {
    display: grid; grid-template-columns: 34px 56px minmax(0, 1.3fr) minmax(0, 1fr) auto;
    align-items: center; gap: 14px; padding: 10px 16px;
    border-left: 4px solid var(--tc);
    transition: background .15s;
}
.ps-row + .ps-row { border-top: 1px solid var(--line-soft); }
.ps-row:nth-child(even) { background: #fff; background: color-mix(in srgb, var(--tc) 4%, #fff); }
.ps-row:hover { background: #fff; background: color-mix(in srgb, var(--tc) 9%, #fff); }
.ps-no { text-align: center; color: #868e96; font-size: .9rem; }
.ps-photo {
    width: 52px; height: 52px; border-radius: 50%; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: #fff; background: color-mix(in srgb, var(--tc) 14%, #fff); color: var(--tc);
    font-size: 22px; font-weight: 600;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #fff; box-shadow: 0 0 0 2px #fff, 0 0 0 4px color-mix(in srgb, var(--tc) 35%, #fff);
}
.ps-photo img { width: 100%; height: 100%; object-fit: cover; }
.ps-name    { font-weight: 600; color: #212529; line-height: 1.35; }
.ps-pos     { margin-top: 2px; font-size: .86rem; color: var(--tc); font-weight: 500; }
.ps-contact { font-size: .84rem; color: #6c757d; line-height: 1.6; word-break: break-all; }
.ps-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }

/* จอเล็ก: ติดต่อลงไปอยู่ใต้ชื่อ, ปุ่มเหลือแต่ไอคอน */
@media (max-width: 768px) {
    .ps-row { grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; padding: 10px 12px; }
    .ps-no  { display: none; }
    .ps-photo { grid-row: 1 / 3; }
    .ps-contact { grid-column: 2 / 3; grid-row: 2; margin-top: -4px; }
    .ps-actions { grid-column: 3; grid-row: 1 / 3; flex-direction: column; }
    .ps-actions .btn span { display: none; }
}


/* ==================================================================
 * 14) ฟอร์มข้อมูล (teacher/setting/personnel_form.php และฟอร์มอื่น ๆ)
 *     <div class="pf-box t-สี"> หัวกล่องสี + เนื้อหาพื้นขาว
 * ================================================================== */
.pf-box { border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.pf-box-head {
    display: flex; align-items: center; gap: 8px; padding: 11px 18px;
    font-weight: 600; color: #fff;
    background: linear-gradient(135deg, var(--tc) 0%, var(--tc) 100%); background: linear-gradient(135deg, var(--tc) 0%, color-mix(in srgb, var(--tc) 72%, #fff) 100%);
}
.pf-box-body { padding: 18px; }
.pf-box .form-label { font-weight: 500; color: #343a40; margin-bottom: 4px; }
/* เนื้อหาในกล่องใช้สีของกล่องนั้น (ไม่ยึดสีธีม): พื้นจาง, ไอคอนหน้าป้าย, กรอบตอนพิมพ์, สวิตช์/ติ๊ก */
.pf-box-body { background: linear-gradient(180deg, #fff 0%, #fff 70%); background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 5%, #fff) 0%, #fff 70%); }
.pf-box .form-label > .bi { color: var(--tc); margin-right: 2px; }
.pf-box .form-control, .pf-box .form-select { border-color: #dee2e6; border-color: color-mix(in srgb, var(--tc) 22%, #dee2e6); }
.pf-box .form-control:focus, .pf-box .form-select:focus {
    border-color: var(--tc); box-shadow: 0 0 0 .25rem transparent; box-shadow: 0 0 0 .25rem color-mix(in srgb, var(--tc) 18%, transparent);
}
.pf-box .form-check-input:checked { background-color: var(--tc); border-color: var(--tc); }
.pf-box .form-check-input:focus { border-color: var(--tc); box-shadow: 0 0 0 .25rem transparent; box-shadow: 0 0 0 .25rem color-mix(in srgb, var(--tc) 18%, transparent); }
.pf-box .form-control.is-valid   { border-color: var(--success); }
.pf-box .form-control.is-invalid { border-color: var(--danger); }

.pf-photo {
    width: 180px; height: 180px; margin: 6px auto 0; border-radius: 50%; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: #fff; background: color-mix(in srgb, var(--tc) 12%, #fff); color: var(--tc); font-size: 84px;
    box-shadow: 0 0 0 5px #fff, 0 0 0 8px #fff; box-shadow: 0 0 0 5px #fff, 0 0 0 8px color-mix(in srgb, var(--tc) 35%, #fff);
}
.pf-photo img { width: 100%; height: 100%; object-fit: cover; }

.pf-footer {
    display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
    margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line-soft);
}
@media (max-width: 576px) {
    .pf-photo  { width: 140px; height: 140px; font-size: 64px; }
    .pf-footer .btn { flex: 1; }
}


/* ==================================================================
 * 15) ผู้ดูแลระบบงาน (teacher/setting/admins.php) — ใช้กล่อง .pf-box t-สี
 * ================================================================== */
.mg-count { margin-left: auto; padding: 1px 12px; border-radius: 999px; background: rgba(255, 255, 255, .22); font-size: .85rem; font-weight: 400; }
.mg-desc  { color: #6c757d; font-size: .88rem; margin: 0 0 12px; }
.mg-empty {
    padding: 14px; border-radius: var(--radius); text-align: center;
    border: 1.5px dashed #dee2e6; border: 1.5px dashed color-mix(in srgb, var(--tc) 35%, #dee2e6); color: #868e96; font-size: .9rem;
}
.mg-list { border: 1px solid #e9ecef; border: 1px solid color-mix(in srgb, var(--tc) 20%, #e9ecef); border-radius: var(--radius); overflow: hidden; background: #fff; }
.mg-row  { display: flex; align-items: center; gap: 12px; padding: 9px 14px; }
.mg-row + .mg-row { border-top: 1px solid var(--line-soft); }
.mg-row:hover { background: #fff; background: color-mix(in srgb, var(--tc) 6%, #fff); }
.mg-photo {
    flex: 0 0 42px; width: 42px; height: 42px; border-radius: 50%; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: #fff; background: color-mix(in srgb, var(--tc) 14%, #fff); color: var(--tc); font-weight: 600; font-size: 18px;
}
.mg-photo img { width: 100%; height: 100%; object-fit: cover; }
.mg-main { flex: 1; min-width: 0; }
.mg-name { font-weight: 600; color: #212529; }
.mg-sub  { font-size: .82rem; color: #6c757d; }
.mg-lock { color: #adb5bd; font-size: 1.1rem; padding: 0 10px; cursor: help; }
.mg-add  { display: flex; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed #dee2e6; border-top: 1px dashed color-mix(in srgb, var(--tc) 25%, #dee2e6); }
.mg-add .js-filter { max-width: 170px; }
@media (max-width: 576px) {
    .mg-add { flex-wrap: wrap; }
    .mg-add .js-filter { max-width: none; flex: 1 1 100%; }
    .mg-add select { flex: 1; }
}


/* ==================================================================
 * 16) ตั้งค่าเว็บไซต์ (teacher/setting/website.php)
 * ================================================================== */
.ws-logo {
    width: 170px; height: 170px; margin: 6px auto 0; padding: 14px; border-radius: 24px;
    display: flex; align-items: center; justify-content: center;
    background: #fff; color: var(--tc); font-size: 72px;
    border: 2px dashed #dee2e6; border: 2px dashed color-mix(in srgb, var(--tc) 40%, #dee2e6);
}
.ws-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ตัวอย่างข้อความท้ายเว็บ — หน้าตาเหมือน footer จริง */
.ws-foot-preview { margin-top: 10px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.ws-foot-label   { padding: 4px 12px; font-size: .75rem; color: #6c757d; background: #f8f9fa; border-bottom: 1px solid var(--border); }
.ws-foot-preview .site-footer-content { background: var(--primary); color: #fff; padding: 12px 16px; text-align: left; }
.ws-foot-preview .site-footer-content a { color: #fff; }


/* ==================================================================
 * 17) ระบบงานภายนอก (teacher/setting/external.php, external_form.php)
 * ================================================================== */
:where(.ex-stat, .ex-row) { --tc: var(--primary); }

/* การ์ดสรุปยอด */
.ex-stat {
    display: flex; align-items: center; gap: 14px; height: 100%;
    padding: 16px 18px; border-radius: var(--radius-lg); color: #fff;
    background: linear-gradient(135deg, var(--tc) 0%, var(--tc) 100%); background: linear-gradient(135deg, var(--tc) 0%, color-mix(in srgb, var(--tc) 65%, #fff) 100%);
    box-shadow: 0 6px 16px transparent; box-shadow: 0 6px 16px color-mix(in srgb, var(--tc) 30%, transparent);
}
.ex-stat > i { font-size: 30px; opacity: .9; }
.ex-stat b    { display: block; font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.ex-stat span { font-size: .85rem; opacity: .95; }

/* รายการระบบงาน */
.ex-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; }
.ex-row {
    display: grid; grid-template-columns: 120px minmax(0, 1.4fr) minmax(0, 1fr) auto;
    align-items: center; gap: 16px; padding: 14px 16px;
    border-left: 4px solid var(--tc);
}
.ex-row + .ex-row { border-top: 1px solid var(--line-soft); }
.ex-row:hover { background: #fff; background: color-mix(in srgb, var(--tc) 5%, #fff); }
.ex-row.is-off { opacity: .6; }
.ex-img {
    width: 120px; aspect-ratio: 3 / 2; border-radius: var(--radius-sm); overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--tc), var(--tc)); background: linear-gradient(135deg, var(--tc), color-mix(in srgb, var(--tc) 60%, #fff)); color: #fff; font-size: 30px;
}
.ex-img img { width: 100%; height: 100%; object-fit: cover; }
.ex-name { font-weight: 600; color: #212529; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ex-sub  { font-size: .85rem; color: #6c757d; }
.ex-url  { display: block; margin-top: 2px; font-size: .82rem; color: var(--tc); word-break: break-all; text-decoration: none; }
.ex-url:hover { text-decoration: underline; }
.ex-for  { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.ex-for .badge-st { font-size: .75rem; padding: 2px 9px; }

.ex-big  { font-size: .9rem; color: #6c757d; }
.ex-big b { font-size: 1.5rem; color: var(--tc); font-weight: 700; }
.ex-bar  { height: 6px; border-radius: 99px; background: #f1f3f5; overflow: hidden; margin: 4px 0 6px; }
.ex-bar span { display: block; height: 100%; border-radius: 99px; background: var(--tc); }
.ex-mini { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .78rem; color: #868e96; }
.ex-mini b { color: #343a40; font-weight: 600; }
.ex-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }   /* ปุ่ม 2x2: สถิติ แก้ไข / ซ่อน ลบ */
.ex-actions form { margin: 0; }
.ex-actions .btn { width: 100%; white-space: nowrap; }

/* ตัวอย่างรูปในฟอร์ม (3:2 เหมือนการ์ดเมนู) */
.ex-preview {
    width: 100%; max-width: 300px; margin: 6px auto 0; aspect-ratio: 3 / 2; border-radius: var(--radius);
    overflow: hidden; display: flex; align-items: center; justify-content: center;
    background: #fff; background: color-mix(in srgb, var(--tc) 12%, #fff); color: var(--tc); font-size: 54px;
    border: 2px dashed #dee2e6; border: 2px dashed color-mix(in srgb, var(--tc) 40%, #dee2e6);
}
.ex-preview img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 992px) {
    .ex-row { grid-template-columns: 96px minmax(0, 1fr) auto; }
    .ex-img { width: 96px; }
    .ex-nums { grid-column: 2 / 3; grid-row: 2; }
    .ex-actions { grid-column: 3; grid-row: 1 / 3; }
}
@media (max-width: 576px) {
    /* จอเล็ก: รูป | ชื่อ+สถิติ / ปุ่ม 4 ปุ่มเรียงแถวเดียวเต็มความกว้างด้านล่าง */
    .ex-row { grid-template-columns: 72px minmax(0, 1fr); gap: 10px; padding: 12px; }
    .ex-img { width: 72px; font-size: 22px; }
    .ex-actions { grid-column: 1 / -1; grid-row: 3; grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .ex-actions .btn { padding-left: 4px; padding-right: 4px; font-size: .82rem; }
}

/* สถิติรายบุคคล (teacher/setting/external_stats.php) */
:where(.xs-list, .xs-chip) { --tc: var(--primary); }
.xs-filter { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.xs-chips  { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.xs-chip-label { font-size: .85rem; color: #6c757d; margin-right: 2px; }
.xs-chip {
    padding: 4px 14px; border-radius: 999px; font-size: .88rem; text-decoration: none;
    color: var(--tc); background: #fff; background: color-mix(in srgb, var(--tc) 10%, #fff);
    border: 1px solid #fff; border: 1px solid color-mix(in srgb, var(--tc) 25%, #fff);
}
.xs-chip:hover  { color: var(--tc); background: #fff; background: color-mix(in srgb, var(--tc) 18%, #fff); }
.xs-chip.active { color: #fff; background: var(--tc); border-color: var(--tc); }

.xs-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; }
.xs-row {
    display: grid; grid-template-columns: 34px 42px minmax(0, 1fr) minmax(140px, .7fr) 210px;
    align-items: center; gap: 12px; padding: 9px 16px; border-left: 4px solid var(--tc);
}
.xs-row + .xs-row { border-top: 1px solid var(--line-soft); }
.xs-row:not(.xs-head):hover { background: #fff; background: color-mix(in srgb, var(--tc) 5%, #fff); }
.xs-head { font-size: .8rem; color: #868e96; background: #f8f9fa; padding-top: 7px; padding-bottom: 7px; }
.xs-no   { text-align: center; color: #868e96; font-size: .9rem; }
.xs-main { min-width: 0; }
.xs-count { font-size: .85rem; color: #6c757d; }
.xs-count b { font-size: 1.25rem; color: var(--tc); font-weight: 700; }
.xs-count .ex-bar span { background: var(--tc); }
.xs-time { font-size: .8rem; color: #6c757d; line-height: 1.6; }
@media (max-width: 768px) {
    .xs-row { grid-template-columns: 26px 42px minmax(0, 1fr) 100px; gap: 10px; padding: 9px 12px; }
}


/* ==================================================================
 * 18) ระบบข้อมูลนักเรียน (teacher/student_info/)
 * ================================================================== */
:where(.si-grade, .si-room) { --tc: var(--primary); }
.si-grade { margin-bottom: 26px; }
.si-grade-head {
    display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
    font-weight: 600; color: #212529; font-size: 1.05rem;
}
.si-grade-badge {
    padding: 3px 14px; border-radius: 999px; color: #fff; font-weight: 600;
    background: linear-gradient(135deg, var(--tc), var(--tc)); background: linear-gradient(135deg, var(--tc), color-mix(in srgb, var(--tc) 70%, #fff));
}
.si-grade-sum { margin-left: auto; font-size: .85rem; font-weight: 400; color: #6c757d; }

.si-room {
    display: block; height: 100%; padding: 14px 16px; border-radius: var(--radius-lg);
    background: #fff; border: 1px solid #e9ecef; border: 1px solid color-mix(in srgb, var(--tc) 25%, #e9ecef);
    border-top: 4px solid var(--tc); text-decoration: none; color: #212529;
    transition: transform .18s ease, box-shadow .18s ease;
}
.si-room:hover { color: #212529; transform: translateY(-3px); box-shadow: 0 10px 22px rgba(0, 0, 0, .1); }
.si-room-name  { font-size: 1.35rem; font-weight: 700; color: var(--tc); }
.si-room-total { color: #6c757d; }
.si-room-total b { font-size: 1.6rem; color: #212529; }
.si-room-gender { display: flex; gap: 14px; margin: 4px 0 8px; font-size: .9rem; }
.si-room-gender .m { color: var(--tile-blue); }
.si-room-gender .f { color: var(--tile-pink); }
.si-room-teacher { padding-top: 8px; border-top: 1px dashed var(--line-soft); font-size: .85rem; color: #495057; font-family: var(--font-system); }

/* การ์ดสรุปยอด (หน้าภาพรวมข้อมูลนักเรียน) — พื้นสีไล่ + ตัวหนังสือขาว + ไอคอนกล่องขาว + วงกลม/ไอคอนจางตกแต่ง */
:where(.si-stat) { --tc: var(--primary); }
.si-stat {
    position: relative; overflow: hidden; height: 100%;
    padding: 16px 18px 14px; border-radius: var(--radius-lg); color: #fff;
    background: linear-gradient(135deg, var(--tc) 0%, var(--tc) 100%); background: linear-gradient(135deg, var(--tc) 0%, color-mix(in srgb, var(--tc) 62%, #fff) 100%);
    box-shadow: 0 8px 20px transparent; box-shadow: 0 8px 20px color-mix(in srgb, var(--tc) 32%, transparent);
    transition: transform .18s ease, box-shadow .18s ease;
}
.si-stat::before {
    content: ""; position: absolute; width: 130px; height: 130px; border-radius: 50%;
    right: -40px; top: -55px; background: rgba(255, 255, 255, .16); pointer-events: none;
}
.si-stat:hover { transform: translateY(-3px); box-shadow: 0 14px 28px transparent; box-shadow: 0 14px 28px color-mix(in srgb, var(--tc) 40%, transparent); }
.si-stat-top   { position: relative; display: flex; align-items: center; gap: 10px; }
.si-stat-icon  {
    flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: #fff; color: var(--tc); font-size: 19px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .12);
}
.si-stat-label { font-size: .92rem; font-weight: 500; line-height: 1.3; }
.si-stat-num   { position: relative; margin-top: 12px; font-size: 2.2rem; font-weight: 700; line-height: 1; }
.si-stat-num small { margin-left: 6px; font-size: .9rem; font-weight: 400; opacity: .9; }
.si-stat-bar   { position: relative; height: 6px; margin-top: 10px; border-radius: 99px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.si-stat-bar span { display: block; height: 100%; border-radius: 99px; background: #fff; }
.si-stat-sub   { position: relative; margin-top: 8px; font-size: .8rem; opacity: .95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.si-stat-deco  {
    position: absolute; right: -8px; bottom: -16px; font-size: 84px; line-height: 1;
    color: #fff; opacity: .14; pointer-events: none;
}
@media (max-width: 576px) {
    .si-stat-num { font-size: 1.7rem; }
    .si-stat-label { font-size: .82rem; }
}

/* ห้องเรียน / ครูประจำชั้น (teacher/student_info/classrooms.php) — ใช้สีของระดับชั้นจาก .si-grade */
.cr-card {
    height: 100%; display: flex; flex-direction: column; gap: 8px;
    padding: 14px 16px; border-radius: var(--radius-lg); background: #fff;
    border: 1px solid #e9ecef; border: 1px solid color-mix(in srgb, var(--tc) 25%, #e9ecef); border-top: 4px solid var(--tc);
}
.cr-head  { display: flex; align-items: center; gap: 10px; }
.cr-name  { font-size: 1.4rem; font-weight: 700; color: var(--tc); }
.cr-total { font-size: .85rem; color: #6c757d; padding: 2px 10px; border-radius: 999px; background: #fff; background: color-mix(in srgb, var(--tc) 10%, #fff); }
.cr-del   { border: 0; background: transparent; color: #adb5bd; padding: 4px 6px; border-radius: 8px; }
.cr-del:hover { color: var(--danger); background: var(--danger-bg); }
.cr-label { font-size: .82rem; color: #868e96; }
.cr-none  { font-size: .88rem; color: var(--danger); }
.cr-teachers { display: flex; flex-direction: column; gap: 6px; }
.cr-teacher {
    display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 5px; border-radius: 999px;
    background: #fff; background: color-mix(in srgb, var(--tc) 8%, #fff);
}
.cr-avatar {
    flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: var(--tc); color: #fff; font-size: 14px; font-weight: 600;
}
.cr-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cr-tname { flex: 1; min-width: 0; font-size: .9rem; color: #212529; }
.cr-x     { border: 0; background: transparent; color: #adb5bd; width: 26px; height: 26px; border-radius: 50%; }
.cr-x:hover { color: #fff; background: var(--danger); }
.cr-add   { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--line-soft); }

/* รายชื่อนักเรียน (teacher/student_info/students.php) — ตาราง + ช่องเลขที่แก้ไขได้ */
:where(.st-wrap) { --tc: var(--primary); }
.st-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 14px; }
.st-tool label { display: block; font-size: .85rem; color: #495057; margin-bottom: 4px; }
.st-tool select { min-width: 200px; }
.st-tool-grow { flex: 1 1 280px; }

.st-numbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px;
    padding: 8px 12px; border-radius: var(--radius); font-size: .88rem; color: #6c4a00;
    background: var(--warning-bg); border: 1px dashed var(--warning); border: 1px dashed color-mix(in srgb, var(--warning) 50%, #fff);
}
.st-numbar > span { flex: 1 1 220px; }

.st-wrap { border: 1px solid #e9ecef; border: 1px solid color-mix(in srgb, var(--tc) 25%, #e9ecef); border-radius: var(--radius); overflow-x: auto; background: #fff; }
.st-table { width: 100%; border-collapse: collapse; font-family: var(--font-system); font-size: .93rem; }
.st-table thead th {
    position: sticky; top: 0; z-index: 1; padding: 10px 12px; white-space: nowrap;
    font-family: var(--font-main); font-weight: 500; font-size: .9rem; color: #fff; text-align: left;
    background: linear-gradient(135deg, var(--tc), var(--tc)); background: linear-gradient(135deg, var(--tc), color-mix(in srgb, var(--tc) 72%, #fff));
}
.st-table td { padding: 7px 12px; border-top: 1px solid var(--line-soft); vertical-align: middle; color: #212529; }
.st-table tbody tr:nth-child(even) { background: #fff; background: color-mix(in srgb, var(--tc) 4%, #fff); }
.st-table tbody tr:hover { background: #fff; background: color-mix(in srgb, var(--tc) 10%, #fff); }
.st-c-no    { width: 70px; text-align: center !important; }
.st-c-photo { width: 52px; padding-right: 0 !important; }
.st-c-act   { width: 96px; white-space: nowrap; text-align: center !important; }
/* students.php: ตัวเลือกสถานะตอนออกจากรายชื่อ */
.si-leave-opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.si-leave-opt:has(input:checked) { border-color: var(--tile-violet); background: color-mix(in srgb, var(--tile-violet) 6%, #fff); }
.si-leave-opt .form-check-input { margin: 0; flex: none; }
.st-name    { font-weight: 500; }

.st-no-input {
    width: 52px; padding: 3px 4px; text-align: center; font-weight: 600;
    border: 1.5px solid #dee2e6; border: 1.5px solid color-mix(in srgb, var(--tc) 30%, #dee2e6); border-radius: 8px; background: #fff;
}
.st-no-input:focus { outline: none; border-color: var(--tc); box-shadow: 0 0 0 3px transparent; box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 20%, transparent); }
.st-no-input.is-changed { background: var(--warning-bg); }
.st-no-input.is-dup { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }

.st-avatar {
    width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 15px;
}
.st-avatar.is-m { background: var(--tile-blue); }
.st-avatar.is-f { background: var(--tile-pink); }
.st-avatar img  { width: 100%; height: 100%; object-fit: cover; }
.st-g.m { color: var(--tile-blue); }
.st-g.f { color: var(--tile-pink); }
.cr-semester { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; padding: 10px 14px; border-radius: var(--radius); background: var(--warning-bg); }
.cr-sem-label { font-weight: 500; color: #6c4a00; margin-right: 4px; }

/* จัดนักเรียนเข้าห้อง (teacher/student_info/assign.php) */
:where(.as-tab, .as-pick-box) { --tc: var(--primary); }
.as-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; border-bottom: 2px solid var(--line-soft); }
.as-tab {
    padding: 9px 18px; border-radius: 12px 12px 0 0; margin-bottom: -2px; text-decoration: none;
    color: #6c757d; border: 2px solid transparent; border-bottom: none; font-weight: 500;
}
.as-tab:hover  { color: var(--tc); background: #fff; background: color-mix(in srgb, var(--tc) 6%, #fff); }
.as-tab.active { color: #fff; background: linear-gradient(135deg, var(--tc), var(--tc)); background: linear-gradient(135deg, var(--tc), color-mix(in srgb, var(--tc) 70%, #fff)); }

.as-pick { display: flex; flex-wrap: wrap; align-items: stretch; gap: 12px; margin-bottom: 18px; }
.as-pick-box {
    flex: 1 1 260px; padding: 10px 14px; border-radius: var(--radius);
    background: #fff; background: color-mix(in srgb, var(--tc) 8%, #fff); border: 1.5px solid #fff; border: 1.5px solid color-mix(in srgb, var(--tc) 35%, #fff);
}
.as-pick-box label { display: block; font-size: .85rem; font-weight: 600; color: var(--tc); margin-bottom: 4px; }
.as-arrow { display: flex; align-items: center; font-size: 2rem; color: #adb5bd; }
@media (max-width: 576px) { .as-arrow { width: 100%; justify-content: center; transform: rotate(90deg); font-size: 1.6rem; margin: -6px 0; } }

.as-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.as-all   { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: .9rem; cursor: pointer; }
.as-list  { max-height: 460px; overflow-y: auto; border: 1px solid #e9ecef; border: 1px solid color-mix(in srgb, var(--tc) 20%, #e9ecef); border-radius: var(--radius); background: #fff; }
.as-item  { display: flex; align-items: center; gap: 10px; padding: 7px 12px; margin: 0; cursor: pointer; }
.as-item + .as-item { border-top: 1px solid var(--line-soft); }
.as-item:hover { background: #fff; background: color-mix(in srgb, var(--tc) 6%, #fff); }
.as-item.is-on { background: #fff; background: color-mix(in srgb, var(--tc) 14%, #fff); }
.as-list-view .as-item { cursor: default; }
.as-no   { width: 26px; text-align: center; color: #868e96; font-size: .85rem; }
.as-code { width: 70px; color: #6c757d; font-size: .85rem; }
.as-name { flex: 1; min-width: 0; color: #212529; }

/* เลื่อนชั้นขึ้นปีการศึกษาใหม่ (assign.php?mode=promote) */
.pm-list { display: flex; flex-direction: column; gap: 10px; }
.pm-room {
    border: 1px solid #e9ecef; border: 1px solid color-mix(in srgb, var(--tile-indigo) 22%, #e9ecef); border-left: 4px solid var(--tile-indigo);
    border-radius: var(--radius); background: #fff; overflow: hidden;
}
.pm-room[data-t="grad"] { border-left-color: var(--tile-blue); background: #fff; background: color-mix(in srgb, var(--tile-blue) 4%, #fff); }
.pm-room[data-t="skip"] { border-left-color: #adb5bd; background: #f8f9fa; opacity: .75; }
.pm-row  { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 14px; }
.pm-src  { min-width: 120px; }
.pm-badge {
    display: inline-block; padding: 3px 12px; border-radius: 999px; color: #fff; font-weight: 600;
    background: linear-gradient(135deg, var(--tile-indigo), var(--tile-indigo)); background: linear-gradient(135deg, var(--tile-indigo), color-mix(in srgb, var(--tile-indigo) 65%, #fff));
}
.pm-n     { font-size: .88rem; color: #6c757d; margin-left: 4px; }
.pm-arrow { color: #adb5bd; font-size: 1.2rem; }
.pm-dst   { flex: 1 1 220px; max-width: 320px; }
.pm-toggle { margin-left: auto; }
.pm-ex    { color: var(--danger); font-weight: 600; }
.pm-students { border-top: 1px dashed var(--line-soft); padding: 6px 14px 10px; background: #fcfcfd; font-family: var(--font-system); }
.pm-st    { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 8px; }
.pm-st select { width: 220px; flex: 0 0 auto; }
.pm-st.is-ex  { background: var(--warning-bg); }
@media (max-width: 576px) {
    .pm-st { flex-wrap: wrap; }
    .pm-st select { width: 100%; }
    .pm-toggle { margin-left: 0; }
}

/* นำเข้านักเรียนจากไฟล์ (teacher/student_info/student_import.php) */
.im-steps { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.im-step  { display: flex; align-items: center; gap: 8px; color: #adb5bd; font-weight: 500; }
.im-step b {
    width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: #e9ecef; color: #868e96;
}
.im-step.done { color: var(--tile-violet); }
.im-step.done b { background: var(--tile-violet); color: #fff; }
.im-line { flex: 0 1 60px; height: 2px; background: #dee2e6; }

.im-drop {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 30px 16px; cursor: pointer; text-align: center;
    border: 2px dashed #dee2e6; border: 2px dashed color-mix(in srgb, var(--tc) 45%, #dee2e6); border-radius: var(--radius-lg);
    background: #fff; background: color-mix(in srgb, var(--tc) 5%, #fff); color: #495057;
}
.im-drop i { font-size: 46px; color: var(--tc); }
.im-drop small { color: #868e96; }
.im-drop:hover, .im-drop.has-file { background: #fff; background: color-mix(in srgb, var(--tc) 12%, #fff); }
.im-drop.has-file span { font-weight: 600; color: var(--tc); }

.im-spec { width: 100%; font-size: .88rem; font-family: var(--font-system); }
.im-spec th { color: #868e96; font-weight: 500; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.im-spec td { padding: 5px 6px; border-bottom: 1px solid var(--line-soft); }
.im-spec td:first-child { font-weight: 700; color: var(--tc); width: 34px; }

.im-notes { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; padding: 10px 14px; border-radius: var(--radius); background: #f8f9fa; font-size: .9rem; }
.im-table { max-height: 520px; overflow-y: auto; }
.im-table tr.im-err td { background: var(--danger-bg); }


/* ==================================================================
 * 99) ค่าสำรองสำหรับเบราว์เซอร์รุ่นเก่า (แท็บเล็ต) ที่ไม่รองรับ aspect-ratio
 * ================================================================== */
@supports not (aspect-ratio: 1 / 1) {
    .mp-art       { height: 0; padding-top: 66.667%; }   /* กรอบรูปการ์ดเมนู 3:2 */
    .sys-head-art { height: 80px; }
    .ex-img       { height: 80px; }
    .ex-preview   { height: 200px; }
    @media (max-width: 576px) {
        .sys-head-art { height: 73px; }
        .ex-img       { height: 48px; }
    }
}


/* ==================================================================
 * 19) ระบบตารางสอน (teacher/timetable/)
 * ================================================================== */
:where(.tt-step) { --tc: var(--primary); }
.tt-step {
    position: relative; height: 100%; display: flex; align-items: flex-start; gap: 12px;
    padding: 16px 16px 16px 18px; border-radius: var(--radius-lg); background: #fff;
    border: 1px solid #e9ecef; border: 1px solid color-mix(in srgb, var(--tc) 25%, #e9ecef);
    border-left: 5px solid var(--tc);
}
.tt-step-no {
    position: absolute; top: 10px; right: 14px; font-size: 1.6rem; font-weight: 700; line-height: 1;
    color: #e9ecef; color: color-mix(in srgb, var(--tc) 22%, #fff);
}
.tt-step-icon {
    flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 20px; background: var(--tc);
}
.tt-step-title { font-weight: 600; color: #212529; }
.tt-step-desc  { font-size: .85rem; color: #6c757d; line-height: 1.5; margin-top: 2px; padding-right: 22px; }

/* เวลาเรียน (teacher/timetable/periods.php) */
.tp-gen > summary { cursor: pointer; list-style: none; }
.tp-gen > summary::-webkit-details-marker { display: none; }
.tp-gen > summary::after { content: "\F282"; font-family: "bootstrap-icons"; margin-left: auto; transition: transform .2s; }
.tp-gen[open] > summary::after { transform: rotate(180deg); }
.tp-gen:not([open]) > summary { border-radius: var(--radius-lg); }
.tp-table td { padding-top: 5px; padding-bottom: 5px; }
.tp-table { min-width: 880px; }   /* จอเล็ก: เลื่อนในกรอบ .st-wrap แทนการบีบช่องชื่อคาบ */
.tp-table .tp-name { min-width: 120px; }
.tp-table tr.is-break td { background: #fff8e6 !important; }
.tp-table tr.is-break .tp-no { color: var(--warning-text); font-weight: 600; }
.tp-table .tp-min { color: #6c757d; }
.tp-summary { margin-top: 10px; font-size: .9rem; color: #495057; }

/* รายวิชา (teacher/timetable/subjects.php) */
:where(.sj-sg) { --tc: var(--primary); }
.sj-grade-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
/* แท็บระดับชั้น (subjects.php — ใช้ .as-tabs/.as-tab) · ป้ายจำนวนรายวิชา · ชั้นที่ยังไม่มีวิชา = จาง */
.sj-tab-n { display: inline-block; min-width: 22px; margin-left: 4px; padding: 0 7px; border-radius: 999px; font-size: .78rem; text-align: center;
            background: #eef0f3; color: #6c757d; }
.as-tab.active .sj-tab-n { background: rgba(255, 255, 255, .25); color: #fff; }
.as-tab.is-empty:not(.active) { opacity: .55; }
/* แท็บแคปซูล (เฉพาะ .sj-tabs — แท็บ .as-tabs หน้าอื่นคงแบบเดิม) */
.sj-tabs { gap: 8px; padding: 6px; border: none; border-radius: 999px; background: #f1f3f5; display: inline-flex; max-width: 100%; }
.sj-tabs .as-tab {
    margin: 0; padding: 7px 16px; border: none; border-radius: 999px; background: transparent;
    display: inline-flex; align-items: center; gap: 4px; transition: background .15s, color .15s, box-shadow .15s;
}
.sj-tabs .as-tab:hover { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.sj-tabs .as-tab.active {
    color: #fff; background: var(--tc); background: linear-gradient(135deg, var(--tc), color-mix(in srgb, var(--tc) 70%, #fff));
    box-shadow: 0 3px 10px rgba(0, 0, 0, .15); box-shadow: 0 3px 10px color-mix(in srgb, var(--tc) 35%, transparent);
}
.sj-tabs .sj-tab-n { margin-left: 2px; }
@media (max-width: 576px) { .sj-tabs { border-radius: 18px; } }
.sj-load { font-size: .85rem; color: #495057; padding: 3px 12px; border-radius: 999px; background: #f1f3f5; }
.sj-load.is-full { background: var(--success-bg); color: var(--success-text); }
.sj-load.is-over { background: var(--danger-bg);  color: var(--danger-text); font-weight: 600; }
.sj-code { font-size: 1.02rem; color: var(--tile-navy); letter-spacing: .3px; }
.sj-sg {
    display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: .82rem; white-space: nowrap;
    color: var(--tc); background: #f1f3f5; background: color-mix(in srgb, var(--tc) 12%, #fff);
}
.st-table tr.sj-off td { opacity: .55; }

/* ครูผู้สอนรายวิชา (teacher/timetable/courses.php) */
:where(.cs-card) { --tc: var(--primary); }
.cs-rooms { display: flex; flex-wrap: wrap; gap: 8px; }
.cs-room {
    display: flex; flex-direction: column; gap: 2px; min-width: 120px; padding: 8px 14px; border-radius: var(--radius);
    background: #f1f3f5; font-size: .85rem; color: #495057; border-left: 4px solid #adb5bd;
}
.cs-room b { font-size: 1rem; color: #212529; }
.cs-room.is-full { background: var(--success-bg); border-left-color: var(--success); }
.cs-room.is-over { background: var(--danger-bg);  border-left-color: var(--danger); }
.cs-warn { color: var(--danger-text); font-size: .8rem; }
.cs-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
/* ปุ่มมุมมอง รายวิชา / รายห้องเรียน (ครูผู้สอนรายวิชา) */
.cs-view { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: #f1f3f5; }
.cs-view a { padding: 5px 14px; border-radius: 999px; color: #6c757d; text-decoration: none; font-size: .88rem; font-weight: 500; white-space: nowrap; }
.cs-view a:hover { background: #fff; }
.cs-view a.active { color: #fff; background: var(--tile-navy, var(--primary)); }
/* มุมมองรายห้องเรียน: ช่องรายวิชา + แถวสรุปคาบท้ายตาราง */
.cs-subj { width: 34%; padding-left: 14px !important; line-height: 1.25; }
.cs-subj b { display: block; color: #212529; }
.cs-subj small { display: block; color: #6c757d; }
.cs-table tr.cs-subhead td { background: #f3f0ff; color: #5b3fc4; font-weight: 600; font-size: .85rem; padding-left: 14px; }
.cs-table tr.cs-sum td { background: #f1f3f5; font-weight: 600; padding: 8px 14px; border-top: 2px solid var(--line-soft); }
.cs-table tr.cs-sum td small { font-weight: 400; color: #6c757d; }
.cs-table tr.cs-sum.is-full td { background: var(--success-bg); color: var(--success-text); }
.cs-table tr.cs-sum.is-over td { background: var(--danger-bg); color: var(--danger-text); }

.cs-card {
    height: 100%; border-radius: var(--radius-lg); overflow: hidden; background: #fff;
    border: 1px solid #e9ecef; border: 1px solid color-mix(in srgb, var(--tc) 25%, #e9ecef);
}
.cs-head {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 14px; color: #fff;
    background: var(--tc); background: linear-gradient(135deg, var(--tc) 0%, color-mix(in srgb, var(--tc) 72%, #fff) 100%);
}
.cs-code { font-size: 1.15rem; font-weight: 700; letter-spacing: .3px; }
.cs-name { font-size: .95rem; opacity: .95; }
.cs-meta { margin-left: auto; font-size: .78rem; padding: 1px 10px; border-radius: 999px; background: rgba(255, 255, 255, .22); }
.cs-table { width: 100%; }
.cs-table td { padding: 5px 8px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.cs-table tr:first-child td { border-top: 0; }
.cs-table tr.is-new td { background: #fbfbfd; }
.cs-table tr.is-off td { opacity: .55; }   /* คาบ 0 = ไม่สอนวิชานี้ในห้องนี้ */
.cs-table tr.is-off td.is-changed { opacity: 1; }
.cs-room-label { width: 64px; font-weight: 600; color: #212529; white-space: nowrap; padding-left: 14px !important; }
.cs-p { width: 72px; }
.cs-p input { text-align: center; }
.cs-parts { font-size: .72rem; text-align: center; color: var(--tile-indigo); line-height: 1.2; margin-top: 2px; }   /* แบ่งวิชาเป็นส่วน (#71) */
.cs-l { width: 78px; padding-left: 0 !important; }
.cs-l input { text-align: center; }
.cs-lp + .cs-lp { margin-top: 4px; }   /* สถานที่แยกตามส่วนของวิชา */
.cs-lp small { display: block; font-size: .68rem; text-align: center; color: var(--tile-indigo); line-height: 1.2; }
.cs-locbar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); background: #fffaf5; }
.cs-locbar > i { color: #C2410C; }
.cs-locbar .cs-locall { max-width: 150px; }
.cs-locbar .btn { white-space: nowrap; }
.cs-table td.is-changed { background: var(--warning-bg) !important; }

/* ภาระสอนรายครู: กริดเดียวทั้งกล่อง (แถว = display: contents) → คอลัมน์ชื่อ / แถบ / ตัวเลข ตรงกันทุกแถว (ข้อความ "ร่วมสอน" ยาวไม่ดันแถบ) */
.cs-loads { display: grid; grid-template-columns: minmax(140px, 1.2fr) minmax(80px, 2fr) auto; align-items: center; gap: 6px 10px; font-family: var(--font-system); font-size: .9rem; }
.cs-load { display: contents; }
.cs-load-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-load-bar { height: 8px; border-radius: 99px; background: #f1f3f5; overflow: hidden; }
.cs-load-bar span { display: block; height: 100%; border-radius: 99px; background: var(--tile-violet); }
.cs-load-n { color: #6c757d; white-space: nowrap; }
/* การ์ดรายวิชา: 2 คอลัมน์ (lg) · จอใหญ่มาก (≥1800px) 3 คอลัมน์ */
@media (min-width: 1800px) { .cs-col { flex: 0 0 auto; width: 33.3333%; } }
/* หัวกลุ่มรายวิชาประเภท "กลุ่ม" (ครูร่วมสอน) */
.cs-grp-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 10px; padding: 10px 14px; border-radius: 12px;
               background: #f3f0ff; color: #5b3fc4; font-weight: 600; }
.cs-grp-head span { font-weight: 400; font-size: .82rem; color: #6c757d; }
.cs-cos { display: flex; flex-direction: column; align-items: flex-start; }
.cs-cos .cs-co { width: 100%; }
/* ครูร่วมสอน — ปุ่มเพิ่มช่อง + ช่องเลือกใต้ครูหลัก */
.cs-co-add { display: inline-flex; align-items: center; gap: 4px; margin-top: 3px; padding: 0 8px; border: 1px dashed #c3c8cf; border-radius: 999px;
             background: transparent; color: #6c757d; font-size: .75rem; line-height: 1.6; }
.cs-co-add:hover { color: var(--primary); border-color: var(--primary); }
.cs-co { margin-top: 4px; font-size: .8rem; background-color: #f8f9fb; }
.cs-co-n { color: var(--tile-violet); }
/* ภาระสอนรายครู แยกตามกลุ่มสาระ — คอลัมน์การ์ด (สีตามกลุ่มสาระ --tc) · แถว = ชื่อ + จำนวนคาบ */
.cs-sgs { columns: 4 240px; column-gap: 14px; }
.cs-sg { break-inside: avoid; margin-bottom: 14px; border-radius: 12px; overflow: hidden; background: #fff;
         border: 1px solid #e9ecef; border-top: 4px solid var(--tc, var(--primary)); font-family: var(--font-system); }
.cs-sg-head { display: flex; align-items: center; gap: 6px; padding: 8px 12px; font-weight: 700; color: var(--tc, var(--primary));
              background: #f8f9fa; background: color-mix(in srgb, var(--tc, var(--primary)) 8%, #fff); }
.cs-sg-head span { margin-left: auto; font-weight: 400; font-size: .78rem; color: #6c757d; }
.cs-sg-row { display: flex; align-items: baseline; gap: 8px; padding: 5px 12px; font-size: .9rem; border-top: 1px solid #f1f3f5; }
.cs-sg-row .nm { flex: 1; min-width: 0; }
.cs-sg-row .nm small { white-space: nowrap; font-size: .72rem; }
.cs-sg-row b { min-width: 28px; text-align: right; color: #212529; }
.cs-sg-row.is-over b { color: var(--danger, #dc3545); }

/* กิจกรรมพร้อมกัน (teacher/timetable/activities.php) */
.ac-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.ac-chk { display: inline-flex; align-items: center; gap: 6px; margin: 0; cursor: pointer; }
.ac-chk > span {
    padding: 5px 12px; border-radius: 999px; border: 1.5px solid #dee2e6; background: #fff; font-size: .9rem; transition: all .15s;
}
.ac-chk > span small { color: #868e96; margin-left: 2px; }
.ac-chk > input { position: absolute; opacity: 0; pointer-events: none; }
.ac-chk > input:checked + span { background: var(--tile-orange); border-color: var(--tile-orange); color: #fff; }
.ac-chk > input:checked + span small { color: rgba(255, 255, 255, .85); }
.ac-chk > input:focus-visible + span { outline: 2px solid var(--tile-orange); outline-offset: 2px; }
.ac-grades { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.ac-grade { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius); background: #f8f9fa; }
.ac-grade.is-on { background: #fff4e6; }
.ac-grade select { flex: 1; min-width: 0; }

.ac-grid { font-size: .85rem; }
.ac-grid th, .ac-grid td { text-align: center; vertical-align: top; min-width: 80px; }
.ac-grid td:first-child { text-align: left; }
.ac-grid .is-break { background: #fff8e6 !important; color: #b07d10; }
.ac-tag {
    display: block; margin: 2px 0; padding: 3px 6px; border-radius: 8px; text-decoration: none; line-height: 1.25;
    background: var(--tile-orange); color: #fff; font-size: .78rem;
}
.ac-tag small { display: block; opacity: .9; }
.ac-tag:hover { color: #fff; filter: brightness(1.08); }

.ac-day-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-weight: 600; color: #212529; }
.ac-day-head i { color: var(--tile-orange); }
.ac-day-head span { margin-left: auto; font-size: .82rem; font-weight: 400; color: #6c757d; }
.sj-block { font-size: .72rem; font-weight: 500; color: var(--tile-violet); white-space: nowrap; }

/* จัดตารางอัตโนมัติ (generate.php) */
.gn-check > div { display: flex; gap: 8px; align-items: flex-start; padding: 8px 12px; border-radius: 10px; margin-bottom: 8px; font-size: .92rem; }
.gn-check > div > i { margin-top: 2px; }
.gn-ok   { background: #E8F6EE; color: #146C3F; }
.gn-warn { background: #FDECEC; color: #A61B1B; }
.gn-info { background: #EAF2FD; color: #0F4C92; }
.gn-check > .gn-rules { display: block; background: #F6F7F9; color: #495057; font-size: .86rem; }
.gn-rules ul { margin: 6px 0 0; padding-left: 18px; }
.gn-rules li { margin-bottom: 3px; }
.gn-result { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: .95rem; }
.gn-result i { color: var(--tc, #6c757d); }

/* ตารางรายห้อง (by_class.php) */
:where(.bc-cell, .bc-chip) { --tc: var(--tile-slate); }
.bc-sum { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: .95rem; }
.bc-sum i { margin-right: 2px; }
.bc-bar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
    position: sticky; top: 50px; z-index: 5;
    padding: 8px 14px; margin-bottom: 10px; border-radius: 12px;
    background: #EAF2FD; color: #0F4C92; font-size: .92rem;
}
.bc-bar-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.bc-wrap { overflow-x: auto; background: #fff; border-radius: 14px; box-shadow: 0 2px 10px rgba(0, 0, 0, .06); padding: 6px; }
.bc-table { width: 100%; min-width: 760px; table-layout: fixed; border-collapse: separate; border-spacing: 4px; }
.bc-table thead th { text-align: center; font-size: .82rem; font-weight: 600; color: #495057; padding: 4px 2px; }
.bc-table thead th small { display: block; font-weight: 400; color: #868e96; font-size: .72rem; }
.bc-day { width: 78px; text-align: center; font-weight: 600; font-size: .88rem; color: #212529; }
.bc-break-h { width: 26px; }
.bc-break { width: 26px; background: #F1F3F5; border-radius: 8px; text-align: center; vertical-align: middle; color: #868e96; font-size: .8rem; }
.bc-break span { writing-mode: vertical-rl; }
.bc-cell {
    position: relative; height: 76px; vertical-align: top; padding: 6px 7px; border-radius: 10px; cursor: pointer;
    font-size: .78rem; line-height: 1.25; overflow: hidden;
    background: #F6F7F9; background: color-mix(in srgb, var(--tc) 12%, #fff);
    border: 1.5px solid transparent; border-left: 4px solid var(--tc);
    transition: background .15s, border-color .15s;
}
.bc-cell:hover { background: #EEF0F3; background: color-mix(in srgb, var(--tc) 20%, #fff); }
.bc-cell.is-empty { background: #fff; border: 1.5px dashed #CED4DA; }
.bc-cell.is-empty:hover { border-color: var(--tile-navy); background: #F3F7FD; }
.bc-cell.is-sel { border-color: var(--tile-navy); box-shadow: 0 0 0 2px var(--tile-navy); }
.bc-cell.is-busy { background: #FDECEC; border-color: #E5534B; border-style: solid; cursor: not-allowed; }
.bc-cell.is-conflict { border-color: #E5534B; }
.bc-cell.is-locked { border-top-style: solid; }
.bc-icons { position: absolute; top: 4px; right: 5px; display: flex; gap: 3px; font-size: .72rem; color: var(--tc); }
.bc-code { font-weight: 600; color: var(--tc); padding-right: 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-name { color: #212529; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bc-teacher { color: #6c757d; font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* แยกเรียน 2 กลุ่มในช่องเดียว (ตารางสอน) — ครึ่งบน กลุ่มที่ 1 · ครึ่งล่าง กลุ่มที่ 2 · สีตามกลุ่มสาระของแต่ละวิชา */
.bc-cell.is-split { padding: 3px 4px; background: #fff; border-left-width: 1.5px; border-color: #DEE2E6; }
.bc-split { display: flex; flex-direction: column; gap: 3px; height: 100%; }
.bc-half { flex: 1; min-height: 0; padding: 2px 5px; border-radius: 6px; border-left: 3px solid var(--tc);
           background: #F6F7F9; background: color-mix(in srgb, var(--tc) 12%, #fff); font-size: .72rem; line-height: 1.2; overflow: hidden; }
.bc-half .bc-code { padding-right: 0; }
.bc-half .bc-name { -webkit-line-clamp: 1; }
.bc-half .bc-teacher { font-size: .68rem; }
.bc-plan { font-weight: 500; font-size: .66rem; color: #6c757d; }
.bc-cell.is-split .bc-icons { top: 2px; right: 3px; }
.bc-chip.is-pair { border-left-style: double; border-left-width: 6px; }
.bc-pair-tag { display: block; font-size: .7rem; color: #6c757d; }
.bc-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .82rem; color: #6c757d; }
.bc-left { display: flex; flex-wrap: wrap; gap: 8px; }
.bc-chip {
    text-align: left; font-size: .85rem; line-height: 1.3; padding: 6px 12px; border-radius: 10px; cursor: pointer; color: #212529;
    background: #F6F7F9; background: color-mix(in srgb, var(--tc) 12%, #fff);
    border: 1.5px solid transparent; border-left: 4px solid var(--tc);
}
.bc-chip b { color: var(--tc); font-weight: 600; }
.bc-chip small { display: block; color: #6c757d; font-size: .74rem; }
.bc-chip.is-sel { border-color: var(--tile-navy); box-shadow: 0 0 0 2px var(--tile-navy); }
.bc-grade-open {
    display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 3px; border-radius: 999px;
    background: #EAF2FD; background: color-mix(in srgb, var(--tile-navy) 10%, #fff);
}

/* ตารางรายครู (by_teacher.php) */
.bt-pick { display: flex; align-items: center; gap: 8px; max-width: 560px; }
.bt-pick .form-select { flex: 1; min-width: 0; }
.bt-day { margin-left: 8px; white-space: nowrap; }
.ct-check { width: 1.35em; height: 1.35em; margin: 0; cursor: pointer; vertical-align: middle; }   /* เปลี่ยนครูผู้สอน — ขนาดเดียวกับ .cl-check */
.bc-cell.bt-free { cursor: default; }
.bc-cell.is-empty.bt-free:hover { border-color: #CED4DA; background: #fff; }
.bc-cell.bt-free:not(.is-empty):hover { background: #F6F7F9; background: color-mix(in srgb, var(--tc) 12%, #fff); }
:where(.bt-code) { --tc: var(--tile-slate); }
.bt-code { color: var(--tc); font-weight: 600; }

/* สถานที่เรียน (ห้องพิเศษ) — บรรทัดในช่องตาราง / ใต้ชื่อวิชา */
.bc-loc { color: #C2410C; font-size: .7rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bt-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.bt-bar .bt-pick { flex: 1 1 320px; }
.bt-print { display: flex; flex-wrap: wrap; gap: 8px; }

/* ตรวจสอบคาบสอน (free.php) — ตารางเต็มหน้า + รายชื่อด้านล่าง */
.fr-cell {
    height: 64px; text-align: center; vertical-align: middle; cursor: pointer; border-radius: 10px;
    background: #F1F8F4; border: 1.5px solid transparent; transition: background .15s, border-color .15s;
}
.fr-cell b { display: block; font-size: 1.15rem; color: var(--tile-green); line-height: 1.1; }
.fr-cell small { color: #6c757d; font-size: .72rem; }
.fr-cell:hover, .fr-cell:focus-visible { border-color: var(--tile-green); outline: none; }
.fr-cell.is-sel { background: var(--tile-green); border-color: var(--tile-green); }
.fr-cell.is-sel b, .fr-cell.is-sel small { color: #fff; }
.fr-search { max-width: 320px; }
.fr-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
:where(.fr-list li) { --tc: var(--tile-slate); }
.fr-list li {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
    background: #fff; border: 1px solid #E9ECEF; box-shadow: 0 1px 4px rgba(0, 0, 0, .04);
}
.fr-list li[hidden] { display: none; }
.fr-list li.is-me { background: #FFF8E6; border-color: #FFE3A3; }
.fr-av {
    flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 1.05rem;
    color: var(--tc); background: #F1F3F5; background: color-mix(in srgb, var(--tc) 14%, #fff);
}
.fr-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.fr-name { font-weight: 500; color: #212529; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr-name small { color: #B7791F; font-weight: 400; }
.fr-meta { font-size: .78rem; color: var(--tc); }
.fr-day {
    flex: 0 0 auto; font-size: .74rem; white-space: nowrap; padding: 3px 9px; border-radius: 999px;
    color: #495057; background: #F1F3F5;
}
.fr-day.is-zero { color: #146C3F; background: #E8F6EE; }
.fr-list li.fr-none { grid-column: 1 / -1; justify-content: center; color: #6c757d; background: #F8F9FA; }
.fr-av.has-photo { background-size: cover; background-position: center top; background-color: #E9ECEF; box-shadow: 0 0 0 2px var(--tc); }

/* ==================================================================
 * 20) ระบบเช็คเวลาเรียน (teacher/attendance/)
 * ================================================================== */
/* เช็คชื่อวันนี้ (index.php) */
.ak-date { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ak-date .form-control { width: auto; max-width: 190px; }
.ak-todo { margin-left: auto; font-size: .92rem; padding: 5px 14px; border-radius: 999px; }
.ak-todo.is-todo { color: #9A5B00; background: #FFF4DE; }
.ak-todo.is-done { color: #146C3F; background: #E8F6EE; }
.ak-section { font-weight: 600; font-size: 1.05rem; color: #212529; margin-bottom: 10px; }
.ak-section i { color: var(--tile-teal); margin-right: 4px; }
.ak-empty { padding: 14px 16px; border-radius: 12px; background: #F8F9FA; color: #6c757d; }
:where(.ak-card) { --tc: var(--tile-teal); }
.ak-card {
    position: relative; display: flex; align-items: center; gap: 12px; height: 100%;
    padding: 14px 16px; border-radius: 14px; text-decoration: none; color: #212529;
    background: #fff; border: 1.5px solid #E9ECEF; border-left: 5px solid var(--tc);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .04); transition: transform .15s, box-shadow .15s;
}
.ak-card:hover { color: #212529; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, .08); }
.ak-card.is-done { background: #FAFDFB; }
.ak-card.is-now { border-color: var(--tc); box-shadow: 0 0 0 3px #FFE3A3; }
.ak-icon {
    flex: 0 0 52px; width: 52px; height: 52px; border-radius: 12px; font-size: 1.5rem;
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--tc); background: #F1F3F5; background: color-mix(in srgb, var(--tc) 13%, #fff);
}
.ak-period b { font-size: 1.35rem; line-height: 1; }
.ak-period small { font-size: .68rem; }
.ak-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ak-title { font-weight: 600; font-size: 1.02rem; }
.ak-sub { font-size: .82rem; color: #6c757d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ak-wait { font-size: .82rem; color: #B7791F; }
.ak-sum { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .82rem; }
.ak-sum > span { color: var(--att); }
.ak-go { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: .85rem; font-weight: 500; color: var(--tc); white-space: nowrap; }
.ak-now { font-size: .7rem; padding: 2px 8px; border-radius: 999px; background: #FFE3A3; color: #7A4B00; }

/* หน้าเช็คชื่อ (check.php) */
.ck-bar {
    position: sticky; top: 50px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    padding: 10px 12px; margin-bottom: 12px; border-radius: 12px; background: #fff; border: 1px solid #E9ECEF;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
}
.ck-total { font-weight: 600; margin-right: 4px; }
.ck-list { display: flex; flex-direction: column; gap: 6px; }
.ck-row {
    display: grid; grid-template-columns: 34px 40px 1fr auto; align-items: center; gap: 4px 10px;
    padding: 8px 12px; border-radius: 12px; background: #fff; border: 1px solid #E9ECEF;
}
.ck-row[data-status="absent"]   { background: #FDF1F1; border-color: #F3C7C7; }
.ck-row[data-status="late"]     { background: #FFF8EA; border-color: #FBE2B0; }
.ck-row[data-status="skip"]     { background: #FBEFF4; border-color: #EDC3D4; }
.ck-row[data-status="sick"],
.ck-row[data-status="business"] { background: #F4F1FB; border-color: #DCD1F2; }
.ck-no { text-align: center; font-weight: 600; color: #6c757d; }
.ck-name { font-weight: 500; min-width: 0; }
.ck-opts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.ck-opts label { margin: 0; }
.ck-opts .att-btn { min-width: 46px; padding: 5px 8px; font-size: .85rem; }
/* สถานะตรึงจากการเช็คตอนเช้า: ปุ่มกดไม่ได้ · tooltip อยู่ที่ .ck-lock (ลูกไม่รับเมาส์ ให้ .ck-lock รับแทน) */
.ck-lock { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px; cursor: not-allowed; border-radius: 8px; }
.ck-lock > .bi { color: #6c757d; font-size: .85rem; }
.ck-lock label, .ck-lock select { pointer-events: none; }
.ck-lock input:not(:checked) + .att-btn { opacity: .35; }
.ck-note-btn { border: 0; background: transparent; color: #ADB5BD; padding: 4px 6px; border-radius: 8px; }
.ck-note-btn:hover, .ck-note-btn.has-note { color: var(--tile-blue); }
.ck-note { grid-column: 3 / -1; }
/* จอเล็ก: สถานะเป็น dropdown แถวเดียว (จอใหญ่ = ปุ่ม 6 ปุ่ม) */
.ck-sel { display: none; width: auto; min-width: 96px; font-weight: 600; color: var(--att, #212529); border-color: var(--att, #CED4DA); }
@media (max-width: 767.98px) {
    .ck-row { grid-template-columns: 26px 34px 1fr auto; gap: 4px 8px; padding: 7px 10px; }
    .ck-opts { flex-wrap: nowrap; align-items: center; }
    .ck-opts label { display: none; }
    .ck-sel { display: block; }
    .ck-note { grid-column: 1 / -1; }
    .ck-bar .att-badge { padding: 2px 8px; font-size: .78rem; }
    .ak-todo { margin-left: 0; }
}

/* ตั้งค่าครูประจำชั้น (attendance/homeroom.php) — ภาคเรียนละ 1 ห้อง การ์ดคู่ */
.hr-now { margin-left: auto; font-size: .75rem; font-weight: 500; padding: 2px 10px; border-radius: 999px; background: #fff; color: var(--tc); }
.hr-term { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; background: #F1FAF7; border: 1px solid #CDEDE3; }
.hr-term b { font-size: 1.3rem; color: var(--tile-teal); }
.hr-term.is-empty { background: #FDF1F1; border-color: #F3C7C7; }
.hr-term.is-empty b { font-size: 1rem; color: #A61B1B; }
.hr-term-label { font-size: .85rem; color: #6c757d; }
.hr-term-label small { color: var(--tile-teal); }
.hr-box { display: flex; flex-direction: column; }
.hr-box .pf-box-body { flex: 1 1 auto; display: flex; flex-direction: column; }
.hr-box .hr-actions { margin-top: auto; }   /* ปุ่มชิดล่างเท่ากันทั้ง 2 การ์ด */

/* วงกลมสถานะการบันทึก (attendance/check.php) — กลางจอ ห้อยจาก navbar ครึ่งหนึ่ง สีเดียวกับ navbar (แบบรูกล้องหน้า)
 * วงกลม 120px · จุดศูนย์กลางที่ขอบล่าง navbar (top = 44 - 60) · ไอคอน + ข้อความโค้ง (SVG textPath) ดันลง 5px จากจุดกึ่งกลาง */
.ck-notch {
    position: fixed; top: -16px; left: 50%; z-index: 998;    /* ใต้ navbar (999) — navbar ทับครึ่งบน */
    width: 120px; height: 120px; margin-left: -60px; border-radius: 50%;
    background: var(--primary); color: #fff; pointer-events: none;
    box-shadow: 0 5px 10px rgba(0, 0, 0, .16);
    transition: transform .55s cubic-bezier(.34, 1.45, .64, 1);   /* เลื่อนลงแบบเด้งนิด ๆ */
}
.ck-notch.is-up   { transform: translateY(-80px); transition-timing-function: ease-in; transition-duration: .35s; }   /* ซ่อนใต้ navbar ทั้งวง */
.ck-notch.no-anim { transition: none !important; }
.ck-notch-icon {
    position: absolute; left: 0; right: 0; top: 68px;
    display: flex; justify-content: center; font-size: 1.55rem; line-height: 1;
}
.ck-notch-arc { position: absolute; top: 5px; left: 0; width: 100%; height: 100%; overflow: visible; }   /* ไม่ใช้ inset (แท็บเล็ตรุ่นเก่า) */
.ck-notch-arc text { fill: #fff; font-family: var(--font-main); font-size: 12.5px; font-weight: 500; letter-spacing: .3px; }
.ck-notch.is-new .ck-notch-icon, .ck-notch.is-dirty .ck-notch-icon { color: #FFD43B; }
.ck-notch.is-dirty { animation: ck-notch-pulse 1.6s ease-in-out infinite; }
.ck-notch.is-just .ck-notch-icon { animation: ck-notch-pop .5s ease-out .45s 2; }   /* เพิ่งบันทึก: ไอคอนเด้ง */
.ck-notch .spinner-border { width: 1.3rem; height: 1.3rem; border-width: .16em; }
@keyframes ck-notch-pulse { 0%, 100% { box-shadow: 0 5px 10px rgba(0, 0, 0, .16); } 50% { box-shadow: 0 5px 10px rgba(0, 0, 0, .16), 0 0 0 7px rgba(255, 212, 59, .45); } }
@keyframes ck-notch-pop { 0% { transform: scale(1); } 40% { transform: scale(1.1); } 100% { transform: scale(1); } }
/* เช็คชื่อรายคาบเรียน = ตารางสอนของฉัน (attendance/period.php) — แถววันที่เลือก = คลิกทั้งการ์ด / วันอื่นสีเทา / เช็คแล้ว = เขียวเข้มทั้งการ์ด */
.pr-table .bc-cell { height: auto; min-height: 84px; cursor: default; }
.pr-table .bc-cell:hover { background: #F6F7F9; background: color-mix(in srgb, var(--tc) 12%, #fff); }
.pr-table tr.pr-active .bc-day { color: var(--tile-teal); }
.pr-day-tag { display: block; font-size: .68rem; font-weight: 500; color: #fff; background: var(--tile-teal); border-radius: 999px; padding: 1px 6px; margin-top: 2px; }
.pr-room-big { display: block; font-size: 1rem; font-weight: 700; line-height: 1.2; color: #212529; }
.pr-cell.is-off { background: #F1F3F5 !important; border-left-color: #CED4DA; filter: grayscale(1); opacity: .6; }
.pr-cell.is-off .bc-name, .pr-cell.is-off .pr-room-big { color: #6c757d; }
.pr-cell.pr-act { padding: 0; height: 1px; }   /* height: 1px = ให้ .pr-card height: 100% ยืดเต็มช่อง (แถวยังสูงตามเนื้อหา) */
.pr-cell.is-now { box-shadow: 0 0 0 3px #FFE3A3; }
.pr-card {
    display: flex; flex-direction: column; gap: 1px; min-height: 84px; padding: 6px 7px;
    text-decoration: none; color: #212529; cursor: pointer; transition: background .15s;
}
.pr-card:only-child { height: 100%; }   /* หลายห้องในช่องเดียว = การ์ดเรียงต่อกัน ไม่ยืด */
.pr-card .bc-name { min-height: 2.5em; }   /* จอง 2 บรรทัด ให้รหัสวิชา/ห้องตรงกันทุกการ์ด */
.pr-card + .pr-card { border-top: 1px dashed rgba(0, 0, 0, .15); }
.pr-card:hover { color: #212529; background: rgba(255, 255, 255, .45); }
.pr-state { margin-top: auto; padding-top: 3px; font-size: .74rem; font-weight: 600; color: var(--tc); }
.pr-cell .pr-card.is-done { background: #146C3F; color: #fff; }
.pr-cell .pr-card.is-done .pr-room-big, .pr-cell .pr-card.is-done .bc-name,
.pr-cell .pr-card.is-done .bc-teacher, .pr-cell .pr-card.is-done .pr-state { color: #fff; }
.pr-cell .pr-card.is-done:hover { background: #0F5732; }
.pr-cell.pr-act:has(.pr-card.is-done) { border-left-color: #0F5732; }/* จอเล็ก: การ์ดคาบที่เช็คแล้ว = เขียวเข้มทั้งการ์ดเหมือนตาราง */
.pr-mobile .ak-card.is-done { background: #146C3F; border-color: #146C3F; color: #fff; }
.pr-mobile .ak-card.is-done .ak-sub, .pr-mobile .ak-card.is-done .ak-go,
.pr-mobile .ak-card.is-done .ak-sum > span { color: #fff; }
.pr-mobile .ak-card.is-done .ak-icon { color: #146C3F; background: #fff; }
/* ห้อง (สถานที่) บนการ์ดเช็คชื่อรายคาบ: แดง + ไอคอนหมุด เหมือนตารางสอน · การ์ดเช็คแล้ว (เขียวเข้ม) = ชมพูอ่อนให้อ่านออก */
.pr-card .bc-loc, .pr-mobile .ak-card .bc-loc { display: block; font-size: .8rem; font-weight: 600; }
.pr-cell .pr-card.is-done .bc-loc, .pr-mobile .ak-card.is-done .bc-loc { color: #FFD1C2; }

/* ภาพรวมวันนี้ (attendance/index.php) — การ์ดตัวเลข 5 ใบ + กราฟ 3 ชุด + ตารางรายห้องคอลัมน์คงที่ + รายชื่อแยกกลุ่ม */
@media (min-width: 1400px) { .ov-tile { flex: 1 0 0; } }
.ov-card { padding: 16px 18px; border-radius: 14px; background: #fff; border: 1px solid #E9ECEF; box-shadow: 0 2px 8px rgba(0, 0, 0, .04); }
.ov-card-title { font-weight: 600; color: #212529; margin-bottom: 12px; }
.ov-card-title small { font-weight: 400; color: #6c757d; margin-left: 6px; }
.ov-note { margin-top: 8px; font-size: .78rem; color: #6c757d; }
/* สีสถานะของกราฟ (สีเดียวกับป้ายสถานะ) */
.ov-seg-present  { --sc: var(--att-present); }
.ov-seg-sick     { --sc: var(--att-sick); }
.ov-seg-business { --sc: var(--att-business); }
.ov-seg-absent   { --sc: var(--att-absent); }
.ov-seg-wait     { --sc: #CED4DA; }
/* แท่ง 100% — ช่องว่าง 2px สีพื้นคั่นทุกส่วน, ปลายมน 4px */
.ov-stack { display: flex; gap: 2px; height: 24px; }
.ov-seg { min-width: 4px; background: var(--sc); cursor: default; }
.ov-seg:first-child { border-radius: 4px 0 0 4px; }
.ov-seg:last-child  { border-radius: 0 4px 4px 0; }
.ov-seg:only-child  { border-radius: 4px; }
.ov-legend { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .88rem; color: #495057; }
.ov-legend li { display: inline-flex; align-items: center; gap: 5px; }
.ov-legend .ov-key { width: 10px; height: 10px; border-radius: 3px; background: var(--sc); }
.ov-legend b { color: #212529; }
.ov-legend small { color: #868e96; }
/* ร้อยละรายชั้น — แท่งนอน 1 สี (teal) ต่ำกว่าเกณฑ์ = ส้ม */
.ov-hbars { display: flex; flex-direction: column; gap: 8px; }
.ov-hbar { display: grid; grid-template-columns: 40px 1fr 48px; align-items: center; gap: 8px; font-size: .85rem; }
.ov-hbar-label { font-weight: 600; color: #495057; }
.ov-hbar-track { height: 14px; border-radius: 0 4px 4px 0; background: #F1F3F5; overflow: hidden; }
.ov-hbar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--tile-teal); }
.ov-hbar-fill.is-low { background: #E8590C; }
.ov-hbar-val { text-align: right; color: #212529; font-variant-numeric: tabular-nums; }
/* เส้นแนวโน้ม — 2px, จุด r4 + วงสีพื้น 2px, กริด hairline */
.ov-line { width: 100%; height: auto; display: block; overflow: visible; }
.ov-grid { stroke: #E9ECEF; stroke-width: 1; }
.ov-grid-min { stroke: #E8590C; stroke-width: 1; stroke-dasharray: 4 3; opacity: .7; }
.ov-axis { font-size: 10px; fill: #868e96; font-family: var(--font-system); }
.ov-path { fill: none; stroke: var(--tile-teal); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ov-dot { fill: var(--tile-teal); stroke: #fff; stroke-width: 2; }
.ov-dot.is-sel { fill: #fff; stroke: var(--tile-teal); stroke-width: 3; }
.ov-hit { fill: transparent; cursor: default; }
/* tooltip */
.ov-tip { position: fixed; z-index: 1100; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: #212529; color: #fff; font-size: .82rem; box-shadow: 0 4px 12px rgba(0, 0, 0, .2); }
/* แถบความคืบหน้ารายคาบ */
.ov-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: .88rem; }
.ov-progress i { color: var(--tile-blue); }
.ov-bar { flex: 1 1 160px; height: 8px; border-radius: 999px; background: #E9ECEF; overflow: hidden; }
.ov-bar > div { height: 100%; border-radius: 999px; background: var(--tile-blue); }
/* ตารางรายห้อง — คอลัมน์คงที่ทุกชั้น */
.ov-table { table-layout: fixed; width: 100%; }
.ov-table col.c-room { width: 11%; }
.ov-table col.c-adv  { width: 20%; }
.ov-table col.c-n    { width: 9%; }
.ov-table col.c-pct  { width: 12%; }   /* ร้อยละเต็ม เช่น 100% / 93.3% */
.ov-table col.c-view { width: 12%; }   /* ปุ่มดู → morning_report.php */
.ov-table .ov-view { padding: 2px 10px; font-size: .8rem; white-space: nowrap; }
.ov-table td, .ov-table th { padding-left: 8px; padding-right: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-table td.ov-adv { white-space: normal; font-size: .82rem; line-height: 1.35; }   /* ครูประจำชั้น คนละบรรทัด */
.ov-table td.att-present, .ov-table td.att-absent, .ov-table td.att-sick, .ov-table td.att-business { color: var(--att); }
.ov-table tr.ov-wait td { background: #FFFBF2; }
.ov-wait-label { color: #B7791F; }
.ov-low { color: #E8590C; font-weight: 600; }
@media (max-width: 767.98px) {
    /* จอเล็ก: ไม่ใช้ display:none กับช่อง (คอลัมน์จะเลื่อนผิดตำแหน่ง col) → คอลัมน์ครูกว้าง 0 + ซ่อนเนื้อหา */
    .ov-table col.c-adv { width: 0; }
    .ov-table .ov-hide-sm { padding: 0 !important; border-left: 0; border-right: 0; }
    .ov-table .ov-adv-in { display: none; }   /* ซ่อนเนื้อหา (ครูหลายคน) ไม่ให้แถวสูงไม่เท่ากัน */
    .ov-table col.c-room { width: 15%; }
    .ov-table col.c-n    { width: 10%; }
    .ov-table col.c-pct  { width: 18%; }
    .ov-table col.c-view { width: 17%; }
    .ov-table .ov-view { padding: 2px 6px; }
    .ov-table td, .ov-table th { padding-left: 4px; padding-right: 4px; }
    .ov-table thead th { font-size: .8rem; }
}
/* รายชื่อไม่มาเรียน แยกกลุ่ม */
.ov-group { margin-bottom: 14px; border-radius: 12px; background: #fff; border: 1px solid #E9ECEF; border-left: 4px solid var(--att); overflow: hidden; }
.ov-group-head { display: flex; align-items: center; gap: 6px; padding: 8px 12px; font-weight: 600; color: var(--att); background: #F8F9FA; background: color-mix(in srgb, var(--att) 8%, #fff); }
.ov-count { margin-left: auto; font-size: .82rem; color: #495057; font-weight: 500; }
.ov-none { padding: 8px 12px; color: #ADB5BD; font-size: .85rem; }
.ov-list { list-style: none; margin: 0; padding: 0; font-family: var(--font-system); }
.ov-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; padding: 7px 12px; border-top: 1px solid #F1F3F5; }
.ov-room { flex: 0 0 82px; font-size: .82rem; font-weight: 600; color: #495057; }
.ov-who { flex: 1 1 auto; min-width: 0; }
.ov-who small { display: block; color: #6c757d; }
.ov-streak { font-size: .74rem; padding: 2px 8px; border-radius: 999px; color: #fff; background: var(--att-absent); }
/* นักเรียนกลุ่มวิกฤติ (attendance/crisis.php) — tab สถานะ + ตารางรายชื่อ */
.cr-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.cr-tab {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; text-decoration: none;
    font-weight: 500; color: var(--att); background: #fff; border: 1.5px solid var(--att);
}
.cr-tab:hover { color: var(--att); background: #F8F9FA; background: color-mix(in srgb, var(--att) 10%, #fff); }
.cr-tab.active { color: #fff; background: var(--att); }
.cr-badge { font-size: .78rem; padding: 0 8px; border-radius: 999px; background: #F1F3F5; color: #495057; }
.cr-tab.active .cr-badge { background: rgba(255, 255, 255, .25); color: #fff; }
.cr-table .cr-th-main { color: var(--att); }
.cr-table td.cr-main b { font-size: 1.15rem; color: var(--att); }
.cr-table td.cr-sub { color: var(--att); }
.cr-ok   { color: #146C3F; font-weight: 600; }
.cr-risk { color: #fff; background: var(--att-absent); padding: 1px 8px; border-radius: 999px; font-weight: 600; font-size: .85rem; }
/* กลุ่ม tab ตอนเช้า / รายคาบ + ตารางนับรายครั้ง (ไม่เข้าแถว · หนีเรียน · สายรายคาบ) */
.cr-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.cr-group-label { min-width: 84px; font-size: .85rem; font-weight: 600; color: #6C757D; }
.cr-subj { display: inline-block; margin: 1px 4px 1px 0; padding: 1px 8px; border-radius: 999px; font-size: .8rem; background: #F1F3F5; color: #343A40; }
.cr-subj b { color: var(--att-skip); font-weight: 600; }
.cr-ev-row { cursor: pointer; }
.cr-ev-detail > td { background: #FAFBFC; }
.cr-days { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.cr-day { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-left: 10px; border-left: 3px solid var(--att); }
.cr-day-date { min-width: 92px; font-weight: 600; font-size: .85rem; }
.cr-day-item { font-size: .8rem; padding: 1px 8px; border-radius: 999px; color: var(--att); background: #fff; border: 1px solid var(--att); }

/* ภาพรวมวันนี้: การ์ดปุ่ม เช็คชื่อตอนเช้า / รายคาบ (attendance/index.php) */
.ov-act {
    position: relative; display: flex; align-items: center; gap: 16px; height: 100%; padding: 18px 20px; overflow: hidden;
    border-radius: 18px; text-decoration: none; color: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .12); transition: transform .18s, box-shadow .18s;
}
.ov-act::after {   /* วงกลมตกแต่งมุมขวา */
    content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%;
    background: rgba(255, 255, 255, .12); pointer-events: none;
}
.ov-act:hover { color: #fff; transform: translateY(-3px); box-shadow: 0 14px 28px rgba(0, 0, 0, .18); }
.ov-act-morning { background: #1E9E8A; background: linear-gradient(135deg, #14A3A3 0%, #1E9E5A 100%); }
.ov-act-period  { background: #2D6FD5; background: linear-gradient(135deg, #2D8FD5 0%, #5B5BD6 100%); }
.ov-act-icon {
    position: relative; z-index: 1; flex: 0 0 60px; width: 60px; height: 60px; border-radius: 16px; font-size: 1.8rem;
    display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .2);
}
.ov-act-body { position: relative; z-index: 1; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ov-act-title { font-family: var(--font-main); font-size: 1.25rem; font-weight: 600; line-height: 1.2; }
.ov-act-sub { font-size: .9rem; opacity: .92; }
.ov-act-state { margin-top: 4px; font-size: .88rem; font-weight: 500; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.ov-act-bar { flex: 1 1 100px; max-width: 180px; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.ov-act-bar > span { display: block; height: 100%; border-radius: 999px; background: #fff; }
.ov-act-go {
    position: relative; z-index: 1; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; background: #fff; color: #212529; font-size: 1.1rem;
}
.ov-act-tt-room { background: #A0409E; background: linear-gradient(135deg, #7A3FD0 0%, #D1458F 100%); }   /* หน้าแรกตารางสอน */
.ov-act-tt-free { background: #D2691E; background: linear-gradient(135deg, #D98A12 0%, #D4501F 100%); }
.ov-act-hv-visit { background: #6F8A1C; background: linear-gradient(135deg, #4F8522 0%, #8A9316 100%); }   /* หน้าแรกเยี่ยมบ้าน */
.ov-act-hv-map   { background: #35598A; background: linear-gradient(135deg, #2B3A67 0%, #3F7CAC 100%); }
.ov-act-cl-reg   { background: #C2552D; background: linear-gradient(135deg, #E0702B 0%, #B83A3A 100%); }   /* หน้าแรกชุมนุม */
.ov-act-cl-print { background: #2F7F86; background: linear-gradient(135deg, #1F6F8B 0%, #3D9970 100%); }
.ov-act-cl-reg   .ov-act-go { color: #C2552D; }
.ov-act-cl-print .ov-act-go { color: #2F7F86; }
.ov-act-cl-attend { background: #6A4FB0; background: linear-gradient(135deg, #7B5CD6 0%, #4E5FC4 100%); }   /* เช็คเวลาเข้าเรียนชุมนุม */
.ov-act-cl-attend .ov-act-go { color: #6A4FB0; }
.ov-act-hv-visit .ov-act-go { color: #6F8A1C; }
.ov-act-hv-map   .ov-act-go { color: #35598A; }
.ov-act-tt-room .ov-act-go { color: #A0409E; }
.ov-act-tt-free .ov-act-go { color: #D2691E; }
/* แจ้งเตือนผ่าน app (attendance/telegram.php): กลุ่มระดับชั้น = ฟ้า Telegram · กิจการนักเรียน = แดง · ปุ่ม "เข้ากลุ่ม" เป็นแคปซูล */
.ov-act-tg       { background: #229ED9; background: linear-gradient(135deg, #2AABEE 0%, #1C7FC0 100%); }
.ov-act-tg-alert { background: #D6336C; background: linear-gradient(135deg, #F03E3E 0%, #C2255C 100%); }
.ov-act-tg-alert .ov-act-go { flex: 0 0 auto; width: auto; padding: 0 14px; border-radius: 999px; gap: 6px; font-size: .95rem; font-weight: 600; white-space: nowrap; }
.ov-act-tg .ov-act-go       { color: #1C7FC0; }
.ov-act-tg-alert .ov-act-go { color: #C2255C; }
.ov-act-tg-badge { display: inline-block; margin-left: 10px; position: relative; top: -3px; }   /* ป้าย "ห้องที่ปรึกษาของคุณ" ห่างชื่อกลุ่ม + ยกขึ้นเล็กน้อย */

/* หน้าแจ้งเตือนผ่าน Telegram (attendance/telegram.php) + ปุ่มสีฟ้า Telegram (.btn-tg — หน้าภาพรวมเช็คเวลาเรียน) */
.btn-tg { background: #229ED9; border: 0; color: #fff; font-weight: 500; }
.btn-tg:hover, .btn-tg:focus { background: #1C7FC0; color: #fff; }
.tg-install {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 20px; border-radius: 18px; color: #fff;
    background: #2B3A67; background: linear-gradient(135deg, #3B4A7A 0%, #232D4F 100%); box-shadow: 0 8px 20px rgba(35, 45, 79, .25);   /* แถบติดตั้งแอป = กรมท่า (ไม่ซ้ำไทล์ฟ้า) */
}
.tg-install-icon { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 50%; background: #2AABEE; display: inline-flex; align-items: center; justify-content: center; font-size: 1.7rem; }
.tg-install-body { flex: 1 1 320px; min-width: 0; }
.tg-install-title { font-family: var(--font-main); font-size: 1.1rem; font-weight: 600; margin-bottom: 6px; }
.tg-steps { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .88rem; }
.tg-steps b { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-right: 4px; border-radius: 50%; background: #2AABEE; color: #fff; font-size: .75rem; }
.tg-install-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.tg-install-btns .btn { color: #232D4F; font-weight: 500; }
.tg-sec { font-family: var(--font-main); font-weight: 600; font-size: 1.05rem; margin-bottom: 10px; }
.tg-sec span { font-family: var(--font-system); font-weight: 400; font-size: .85rem; color: var(--muted); margin-left: 6px; }
.tg-tile {   /* ไทล์สี (พื้นไล่สีตาม .tg-c1–8) ตัวหนังสือขาว */
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; padding: 22px 12px 14px; overflow: hidden;
    border-radius: 18px; text-decoration: none; color: #fff; background: #229ED9;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .12); transition: transform .18s, box-shadow .18s;
}
.tg-tile::after { content: ''; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255, 255, 255, .13); pointer-events: none; }
.tg-tile:hover { transform: translateY(-3px); box-shadow: 0 14px 26px rgba(0, 0, 0, .18); color: #fff; }
.tg-c1 { background: linear-gradient(135deg, #2AABEE 0%, #1C7FC0 100%); }
.tg-c2 { background: linear-gradient(135deg, #20C997 0%, #0B8F6A 100%); }
.tg-c3 { background: linear-gradient(135deg, #845EF7 0%, #5F3DC4 100%); }
.tg-c4 { background: linear-gradient(135deg, #F76707 0%, #C2410C 100%); }
.tg-c5 { background: linear-gradient(135deg, #E64980 0%, #B5174F 100%); }
.tg-c6 { background: linear-gradient(135deg, #15AABF 0%, #1864AB 100%); }
.tg-c7 { background: linear-gradient(135deg, #5C940D 0%, #2B8A3E 100%); }
.tg-c8 { background: linear-gradient(135deg, #E8590C 0%, #C92A2A 100%); }
.tg-tile.is-mine { padding-top: 32px; box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px #1E9E5A, 0 8px 18px rgba(0, 0, 0, .12); }   /* ห้องที่ปรึกษา = วงแหวนเขียว */
.tg-tile-mine { position: absolute; z-index: 1; top: 8px; left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 1px 10px; border-radius: 999px; background: #fff; color: #1E9E5A; font-size: .72rem; font-weight: 600; }
.tg-tile-icon { position: relative; z-index: 1; width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; color: #fff; background: rgba(255, 255, 255, .22); flex: 0 0 46px; }
.tg-tile-name { position: relative; z-index: 1; font-family: var(--font-main); font-size: 1.35rem; font-weight: 700; line-height: 1.1; }
.tg-tile-go { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 999px; background: #fff; color: #1C7FC0; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.tg-tile:hover .tg-tile-go { box-shadow: 0 3px 10px rgba(0, 0, 0, .15); }
.tg-wide {
    display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 18px; text-decoration: none; color: #fff;
    background: #D6336C; background: linear-gradient(135deg, #F03E3E 0%, #C2255C 100%); box-shadow: 0 8px 20px rgba(194, 37, 92, .22); transition: transform .18s;
}
.tg-wide:hover { color: #fff; transform: translateY(-3px); }
.tg-wide .tg-tile-icon { background: rgba(255, 255, 255, .2); }
.tg-wide-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.tg-wide-title { font-family: var(--font-main); font-size: 1.15rem; font-weight: 600; }
.tg-wide-sub { font-size: .85rem; opacity: .95; }
.tg-wide .tg-tile-go { background: #fff; color: #C2255C; }
@media (max-width: 575.98px) { .tg-wide { flex-wrap: wrap; } .tg-wide .tg-tile-go { margin-left: auto; } }
.ov-act-morning .ov-act-go { color: #1E9E5A; }
.ov-act-period  .ov-act-go { color: #2D6FD5; }

/* ภาพรวมวันนี้: การ์ดสรุป 5 ใบ แบบพื้นขาว (ไม่ให้ซ้ำกับการ์ดปุ่มเช็คชื่อที่ไล่สี) — สีสถานะเป็นเส้นบน + ไอคอน + ตัวเลข */
.ov-tile .si-stat {
    color: #212529; background: #fff; border: 1px solid #E9ECEF; border-top: 4px solid var(--tc);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
}
.ov-tile .si-stat::before { display: none; }
.ov-tile .si-stat:hover { box-shadow: 0 8px 18px rgba(0, 0, 0, .08); }
.ov-tile .si-stat-icon { background: #F1F3F5; background: color-mix(in srgb, var(--tc) 13%, #fff); color: var(--tc); box-shadow: none; }
.ov-tile .si-stat-label { color: #495057; }
.ov-tile .si-stat-num { color: var(--tc); }
.ov-tile .si-stat-num small { color: #6c757d; opacity: 1; }
.ov-tile .si-stat-sub { color: #6c757d; opacity: 1; }
.ov-tile .si-stat-deco { color: var(--tc); opacity: .07; }
/* จอเล็ก (2 ใบต่อแถว): จำนวนการ์ดเป็นเลขคี่ → การ์ดสุดท้ายขยายเต็มแถว */
@media (max-width: 991.98px) {
    .ov-tile:last-child:nth-child(odd) { flex: 0 0 100%; max-width: 100%; width: 100%; }
}

/* บันทึกเวลาแลกคาบ/สอนแทน (attendance/substitute.php) */
.ak-date .sb-teacher { width: auto; flex: 1 1 260px; max-width: 420px; }
.ak-card .sb-loc { display: block; font-size: .8rem; font-weight: 600; }
/* สอนแทน: ตาราง 1 แถว + กล่องเลือก สอนแทน / สลับคาบ */
.sb-table .bc-break { width: 26px; }
.pr-cell .pr-card.is-swap { background: #B7791F; }
.pr-cell .pr-card.is-swap:hover { background: #9A6512; }
.sb-modal { border-radius: 16px; }
.sb-opt {
    display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; margin-bottom: 10px; border-radius: 14px;
    text-decoration: none; color: #212529; border: 1.5px solid #E9ECEF; background: #fff;
}
.sb-opt > i { font-size: 1.6rem; line-height: 1; margin-top: 2px; }
.sb-opt b { display: block; font-family: var(--font-main); font-size: 1.05rem; }
.sb-opt small { display: block; color: #6c757d; }
.sb-opt-sub { border-color: #BFE6D3; background: #F1FAF5; }
.sb-opt-sub > i { color: #1E9E5A; }
.sb-opt-sub:hover { color: #212529; background: #E2F5EA; }
.sb-opt-swap { border-color: #FBE2B0; background: #FFFAEF; }
.sb-opt-swap > i { color: #B7791F; }

/* รายงานของฉัน (attendance/report*.php) — การ์ดเลือกรายงาน + รายวัน/รายคาบ + ตาราง */
.rp-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }   /* การ์ดเลือกรายงาน 3 คอลัมน์ */
@media (max-width: 991.98px) { .rp-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .rp-tabs { grid-template-columns: minmax(0, 1fr); } }
.rp-tab {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; text-decoration: none;
    color: #212529; background: #fff; border: 1.5px solid #E9ECEF; transition: border-color .15s, box-shadow .15s;
}
.rp-tab:hover { color: #212529; border-color: var(--tc); }
.rp-tab.active { border-color: var(--tc); box-shadow: 0 0 0 3px #F1F3F5; box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 18%, #fff); }
.rp-tab-icon {
    flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px; font-size: 1.3rem;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--tc); background: #F1F3F5; background: color-mix(in srgb, var(--tc) 13%, #fff);
}
.rp-tab.active .rp-tab-icon { color: #fff; background: var(--tc); }
.rp-tab-body { min-width: 0; display: flex; flex-direction: column; }
.rp-tab-body b { font-family: var(--font-main); font-weight: 600; }
.rp-tab-body small { color: #6c757d; font-size: .78rem; }
.ak-date .rp-room { width: auto; flex: 0 1 240px; }
.rp-head { font-size: 1.05rem; color: #495057; }
.rp-head b { color: #212529; }
.rp-day { display: flex; flex-direction: column; gap: 10px; }
.rp-slot { display: flex; gap: 14px; padding: 12px 14px; border-radius: 12px; background: #fff; border: 1px solid #E9ECEF; border-left: 4px solid var(--tile-teal); }
.rp-slot.is-wait { border-left-color: #FBC86B; background: #FFFCF4; }
.rp-slot-time { flex: 0 0 64px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; color: var(--tile-teal); line-height: 1.1; }
.rp-slot-time b { font-size: 1.5rem; font-family: var(--font-main); }
.rp-slot-time i { font-size: 1.4rem; }
.rp-slot-time small { font-size: .72rem; color: #6c757d; text-align: center; }
.rp-slot-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-family: var(--font-system); }
.rp-slot-title { font-weight: 600; color: #212529; }
.rp-code { color: var(--tile-indigo); }
.rp-tag { display: inline-block; font-size: .72rem; font-weight: 500; padding: 1px 8px; border-radius: 999px; background: #EEF2FF; color: #3B4CB8; margin-left: 4px; }
.rp-tag-swap { background: #FFF4DE; color: #9A5B00; }
.rp-meta { font-size: .82rem; color: #6c757d; }
.rp-counts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .88rem; }
.rp-counts > span[class^="att-"] { color: var(--att); }
.rp-names { font-size: .85rem; color: #212529; }
.rp-names-label { font-weight: 600; color: var(--att); margin-right: 4px; }
.rp-names small { color: #6c757d; }
.rp-note { margin-top: 2px; padding: 8px 10px; border-radius: 8px; background: #F8F9FA; font-size: .88rem; color: #212529; }
.rp-note i { color: var(--tile-blue); }
.rp-note-sm { margin-top: 3px; font-size: .8rem; color: #6c757d; }
.rp-sum { display: flex; flex-wrap: wrap; gap: 6px 20px; padding: 12px 16px; border-radius: 12px; background: #fff; border: 1px solid #E9ECEF; }
.rp-subj { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rp-subj-chip { font-size: .82rem; padding: 3px 10px; border-radius: 999px; background: #EEF2FF; color: #3B4CB8; }
.rp-dayhead { font-weight: 600; color: #212529; margin: 6px 0 6px; }
.rp-table td.att-present, .rp-table td.att-absent, .rp-table td.att-sick, .rp-table td.att-business, .rp-table td.att-late,
.rp-table span.att-present, .rp-table span.att-absent, .rp-table span.att-business { color: var(--att); font-weight: 600; }
.rp-state { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; }
.rp-state.is-done  { background: #E8F6EE; color: #146C3F; }
.rp-state.is-other { background: #EAF2FD; color: #0F4C92; }
.rp-state.is-wait  { background: #FDECEC; color: #A61B1B; }
.rp-state.is-sub   { background: #FFF4DE; color: #9A5B00; }
@media (max-width: 767.98px) {
    .rp-slot { gap: 10px; padding: 10px; }
    .rp-slot-time { flex-basis: 46px; }
}
/* เส้นคั่นการ์ดเลือกรายงาน / เนื้อหารายงาน */
.rp-divider { margin: 0 0 18px; border: 0; border-top: 2px dashed #DEE2E6; opacity: 1; }
/* รายงานการสอนรายวัน: การ์ด 3 คอลัมน์ (รายวิชา·ยอด | รายชื่อนักเรียน | รายละเอียดการสอน) แสดงทุกคาบ */
.rp-cols-head, .rp-slot3 { display: grid; grid-template-columns: 64px minmax(0, 1.1fr) minmax(0, 1.3fr) minmax(0, 1.2fr); gap: 4px 16px; }
.rp-cols-head { padding: 0 14px 2px 18px; font-size: .8rem; font-weight: 600; color: #6c757d; }
.rp-slot3 > div { min-width: 0; }
.rp-slot3 .rp-c1, .rp-slot3 .rp-c2, .rp-slot3 .rp-c3 { font-family: var(--font-system); display: flex; flex-direction: column; gap: 4px; }
.rp-slot3 .rp-c2, .rp-slot3 .rp-c3 { padding-left: 14px; border-left: 1px dashed #DEE2E6; }
.rp-slot3 .rp-note { margin: 0; }
.rp-empty-cell { color: #ADB5BD; font-size: .85rem; }
.rp-slot3.is-done .rp-empty-cell { color: #146C3F; }
.rp-wait-text { color: #9A5B00; }
.rp-slot.is-none { border-left-color: #DEE2E6; background: #F8F9FA; }
.rp-slot.is-none .rp-slot-time { color: #ADB5BD; }
@media (max-width: 991.98px) {
    .rp-slot3 { grid-template-columns: 52px minmax(0, 1fr); }
    .rp-slot3 .rp-c2, .rp-slot3 .rp-c3 { grid-column: 2; padding-left: 0; border-left: 0; }
    .rp-slot3 .rp-c3 .rp-empty-cell, .rp-slot3 .rp-c2 .rp-empty-cell { display: none; }
}

/* สถิติการมาเรียนรายวัน (ผู้ดูแล: attendance/report_stats.php) — แยกเพศ */
.st-gender { position: relative; display: flex; gap: 12px; margin-top: 6px; font-size: .85rem; font-weight: 600; }
.st-gender .m { color: var(--tile-blue); }
.st-gender .f { color: var(--tile-pink); }
.sx-table { font-size: .88rem; }
.sx-table th, .sx-table td { padding-left: 6px; padding-right: 6px; white-space: nowrap; }
.sx-table .sx-grp { border-left: 1px solid #DEE2E6; }
.sx-table tr.sx-sub td { background: #F1F3F5; font-weight: 600; }
.sx-table tr.sx-total td { background: #E7EAF6; font-weight: 700; border-top: 2px solid #ADB5BD; }

/* รายงานการมาเรียนรายคน (ผู้ดูแล: attendance/report_person.php) — นักเรียน × วันเรียน */
.pp-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .85rem; }
.pp-legend > span { color: var(--att); }
.pp-sym { display: inline-block; min-width: 18px; text-align: center; }
.pp-table { font-size: .85rem; }
.pp-table th, .pp-table td { padding: 5px 4px; white-space: nowrap; }
.pp-table .pp-name { padding-left: 8px; min-width: 170px; position: sticky; left: 0; background: #fff; z-index: 1; }
.pp-table thead .pp-name { background: inherit; }
.pp-table .pp-day { min-width: 26px; font-weight: 600; }
.pp-table .pp-sum { min-width: 44px; }
.pp-table td.pp-cell { font-weight: 700; color: var(--att, #ADB5BD); }
.pp-table td.pp-cell.att-present { color: #1E9E5A; font-weight: 400; }
.pp-table td.pp-cell.att-absent { background: #FDECEC; }
.pp-table td.pp-cell.att-sick, .pp-table td.pp-cell.att-business { background: #F4F1FB; }
.pp-table td.pp-cell.att-late { background: #FFF8EA; }

/* รายงานการมาเรียนรายคน (ผู้ดูแล: attendance/report_student.php) — นักเรียน 1 คน รายวัน */
.sp-pick { height: 100%; padding: 12px 14px; border-radius: 12px; background: #fff; border: 1px solid #E9ECEF; display: flex; flex-direction: column; gap: 6px; }
.sp-pick .sp-room { flex: 0 0 140px; width: auto; }
.sp-pick .sp-stu { flex: 1 1 200px; width: auto; }
.sp-pick .btn { flex: 0 0 auto; white-space: nowrap; }   /* ปุ่มค้นหาบรรทัดเดียว */
.sp-pick input[type="search"] { min-width: 0; }
.sp-found { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-chip { padding: 5px 12px; border-radius: 999px; text-decoration: none; color: #212529; background: #fff; border: 1px solid #DEE2E6; font-family: var(--font-system); }
.sp-chip small { color: #6c757d; }
.sp-chip:hover, .sp-chip.active { color: #fff; background: var(--tile-pink); border-color: var(--tile-pink); }
.sp-chip:hover small, .sp-chip.active small { color: #fff; }
.sp-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.sp-name { font-size: 1.25rem; font-weight: 600; color: #212529; }
.sp-sum { height: 100%; padding: 12px 16px; border-radius: 12px; background: #fff; border: 1px solid #E9ECEF; display: flex; flex-direction: column; gap: 6px; }
.sp-sum-title { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.sp-sum-title small { font-weight: 400; color: #6c757d; }
.sp-table td { vertical-align: top; }
.sp-period { display: inline-block; margin: 0 4px 4px 0; padding: 2px 9px; border-radius: 999px; font-size: .8rem; color: var(--att); background: #F8F9FA; background: color-mix(in srgb, var(--att) 10%, #fff); }
.sp-period.att-present { color: #495057; background: #F1F3F5; }
.gs-num { max-width: 220px; }   /* ตั้งค่าระบบเช็คเวลาเรียน: ช่องตัวเลข */

/* ==================================================================
 * 21) ฝั่งนักเรียน (student/) — ระบบงานไม่มี sidebar
 * ================================================================== */
/* ตารางเรียน (student/timetable.php) — เน้นวันนี้ / คาบปัจจุบัน (grid_view.php: $gv_today / $gv_now) */
.bc-table tr.gv-today .bc-day { color: var(--tile-teal); }
.bc-table tr.gv-today .bc-cell:not(.is-empty) { box-shadow: inset 0 0 0 1px #9ED8CC; }
.bc-table .bc-cell.is-now { box-shadow: 0 0 0 3px #FFE3A3 !important; }
/* จอเล็ก: แท็บวัน + การ์ดคาบ */
.sv-days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.sv-day {
    display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 12px;
    border: 1.5px solid #DEE2E6; background: #fff; font-family: var(--font-main); font-weight: 600; color: #495057;
}
.sv-day small { font-size: .65rem; font-weight: 500; color: var(--tile-teal); }
.sv-day.active { color: #fff; background: var(--tile-blue); border-color: var(--tile-blue); }
.sv-day.active small { color: #fff; }
.sv-list { display: flex; flex-direction: column; gap: 8px; }
.sv-card { cursor: default; }
.sv-card:hover { transform: none; }
.sv-teacher { font-size: .82rem; color: #495057; }
.sv-break { text-align: center; font-size: .78rem; color: #868e96; padding: 2px 0; border-top: 1px dashed #DEE2E6; border-bottom: 1px dashed #DEE2E6; }

/* ==================================================================
 * 22) ตารางสอน: คาบที่ห้ามจัด (tt_blocked — ตั้งที่หน้าเวลาเรียน)
 * ================================================================== */
/* ช่องในตาราง (grid_view / แก้ไขรายห้อง) */
.bc-off {
    height: 76px; border-radius: 10px; text-align: center; vertical-align: middle;
    color: #adb5bd; font-size: .75rem; cursor: not-allowed;
    background: repeating-linear-gradient(135deg, #F1F3F5 0, #F1F3F5 6px, #E9ECEF 6px, #E9ECEF 12px);
}
.pr-table .bc-off { height: auto; min-height: 84px; }
/* แก้ไขตารางรายห้อง: ช่องว่างที่ห้ามจัด — ยังคลิกวางเองได้ (จัดอัตโนมัติไม่วาง) */
.bc-cell.is-empty.is-offslot { background: repeating-linear-gradient(135deg, #fff 0, #fff 6px, #F1F3F5 6px, #F1F3F5 12px); }
/* ตารางคาบเรียนพร้อมกัน */
.ac-grid .is-off { background: repeating-linear-gradient(135deg, #F8F9FA 0, #F8F9FA 6px, #E9ECEF 6px, #E9ECEF 12px) !important; }
/* หน้าเวลาเรียน: ตารางเลือกช่องห้ามจัด */
.pb-wrap { position: relative; max-width: 100%; overflow-x: auto; }   /* relative: กัน checkbox ที่ซ่อน (absolute) หลุดนอกกรอบเลื่อน → หน้ากว้างเกินจอ */
.pb-table { width: 100%; border-collapse: separate; border-spacing: 4px; }
.pb-table th { font-size: .85rem; font-weight: 500; text-align: center; white-space: nowrap; }
.pb-table th small { display: block; font-size: .72rem; font-weight: 300; color: #868e96; }
.pb-table tbody th { text-align: left; padding-right: 6px; }
.pb-table td { padding: 0; min-width: 78px; }
.pb-cell { position: relative; display: block; margin: 0; cursor: pointer; user-select: none; }
.pb-cell input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
@media (max-width: 575.98px) {
    .pb-table td { min-width: 62px; }
    .pb-cell span { height: 36px; font-size: .72rem; }
    .pb-cell span i { display: none; }
}
.pb-cell span {
    display: flex; align-items: center; justify-content: center; gap: 4px; height: 40px; border-radius: 8px;
    font-size: .78rem; transition: background .15s, color .15s;
}
.pb-on  { background: #EBFBEE; color: #2B8A3E; border: 1.5px solid #B2F2BB; }
.pb-off { display: none !important; color: #868e96; border: 1.5px dashed #ADB5BD;
          background: repeating-linear-gradient(135deg, #F1F3F5 0, #F1F3F5 6px, #E9ECEF 6px, #E9ECEF 12px); }
.pb-cell input:checked ~ .pb-on  { display: none; }
.pb-cell input:checked ~ .pb-off { display: flex !important; }
.pb-cell:hover .pb-on { background: #D3F9D8; }
.pb-cell input:focus-visible ~ span { outline: 2px solid var(--primary); outline-offset: 1px; }

/* ==================================================================
 * 23) ตารางสอน: คาบของครู (ไม่มีนักเรียน — teacher/timetable/meetings.php)
 * ================================================================== */
/* ช่องในตารางครู (grid_view) */
.bc-cell.is-meet { --tc: #868E96; background: #F1F3F5; border-left-style: dashed; cursor: default; }
.bc-cell.is-meet .bc-code { color: #868E96; font-weight: 500; }
/* ฟอร์มเลือกครู แยกกลุ่มสาระ */
.mt-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.mt-group { border: 1.5px solid #DEE2E6; border-radius: 12px; padding: 8px 10px; background: #fff; }
.mt-group.is-on { border-color: var(--tc); background: #F8F9FA; background: color-mix(in srgb, var(--tc) 6%, #fff); }
.mt-group-head { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; padding-bottom: 6px; border-bottom: 1px dashed #DEE2E6; cursor: pointer; font-weight: 500; }
.mt-group-head span { color: var(--tc); }
.mt-group-head small { margin-left: auto; color: #868e96; font-weight: 300; }
.mt-names { display: flex; flex-direction: column; gap: 2px; }
.mt-name { display: flex; align-items: center; gap: 6px; margin: 0; font-size: .88rem; cursor: pointer; }
.mt-group input[type=checkbox] { accent-color: var(--tc); width: 16px; height: 16px; }
.mt-list { font-size: .85rem; }

/* ==================================================================
 * 24) เช็คเวลาเรียน: แจ้งประกาศ (notices.php → กรอบคำพูดใน check.php)
 * ================================================================== */
/* กรอบคำพูด (หางชี้ไปที่รูปโทรโข่งด้านขวา) — พื้นสีอย่างเดียว ไม่มีเส้นขอบ / เงา */
.nt-bubble-row { display: flex; align-items: center; gap: 22px; margin-bottom: 16px; }
.nt-bubble {
    position: relative; flex: 1 1 auto; min-width: 0; padding: 14px 20px;
    background: #FFF3BF; background: var(--nt-bg, #FFF3BF); border-radius: 20px;
}
.nt-bubble::after {   /* หาง (สามเหลี่ยมสีเดียวกับพื้น) */
    content: ""; position: absolute; top: 50%; right: -18px; margin-top: -12px; width: 0; height: 0;
    border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent #FFF3BF;
    border-left-color: var(--nt-bg, #FFF3BF);
}
.nt-bubble-head { font-family: 'Kanit', sans-serif; font-weight: 500; font-size: .9rem; color: #E67700; color: var(--nt-fg, #E67700); margin-bottom: 4px; }
/* หลายประกาศ = สีพื้นไม่ซ้ำกัน (วนตามลำดับ nt-c1 … nt-c6) */
.nt-c1 { --nt-bg: #FFF3BF; --nt-fg: #E67700; }   /* เหลือง */
.nt-c2 { --nt-bg: #D0EBFF; --nt-fg: #1864AB; }   /* ฟ้า */
.nt-c3 { --nt-bg: #D3F9D8; --nt-fg: #2B8A3E; }   /* เขียว */
.nt-c4 { --nt-bg: #FFDEEB; --nt-fg: #C2255C; }   /* ชมพู */
.nt-c5 { --nt-bg: #E5DBFF; --nt-fg: #5F3DC4; }   /* ม่วง */
.nt-c6 { --nt-bg: #FFE8CC; --nt-fg: #D9480F; }   /* ส้ม */
.nt-bubble-text { font-size: 1rem; line-height: 1.6; color: #343a40; word-break: break-word; }
.nt-bubble-img  { flex: 0 0 110px; width: 110px; height: 110px; object-fit: contain; }
@media (max-width: 575.98px) {   /* จอเล็ก: ตัดรูป + หาง */
    .nt-bubble-img { display: none; }
    .nt-bubble::after { display: none; }
    .nt-bubble { padding: 12px 14px; border-radius: 16px; }
}
/* หน้าแจ้งประกาศ: เลือกห้องแยกระดับชั้น */
.nt-grades { display: flex; flex-direction: column; gap: 8px; }
.nt-grade { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border: 1.5px solid #DEE2E6; border-radius: 12px; }
.nt-grade-head { display: inline-flex; align-items: center; gap: 6px; margin: 0; min-width: 70px; font-weight: 500; cursor: pointer; }
.nt-rooms { display: flex; flex-wrap: wrap; gap: 6px; }
.nt-room { margin: 0; cursor: pointer; }
.nt-room input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.nt-room span { display: inline-block; padding: 4px 12px; border-radius: 999px; border: 1.5px solid #CED4DA; font-size: .85rem; background: #fff; }
.nt-room input:checked + span { background: #FFF4E6; border-color: #FD7E14; color: #D9480F; font-weight: 500; }
.nt-room input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; }
.nt-room { position: relative; }
.nt-msg { white-space: normal; }
.nt-expired .nt-msg, .nt-expired td.small { text-decoration: line-through; }   /* หมดอายุ: ขีดฆ่า (หายจากรายการหลังสิ้นสุด 2 วัน) */

/* ==================================================================
 * 25) ตารางสอน: ตรวจสอบคาบสอน (free.php) — ตารางของฉัน + ตารางเรียนนักเรียน (ครูว่างทุกช่อง)
 * ================================================================== */
.fs-section { font-family: 'Kanit', sans-serif; font-weight: 500; font-size: 1.05rem; margin-bottom: 10px; color: #212529; }
.fs-section > small, .fs-section small { font-weight: 300; font-size: .85rem; color: #6c757d; }
.fs-room { width: auto; min-width: 110px; }
.fs-table .bc-cell { height: auto; min-height: 96px; vertical-align: top; }
.fs-table .bc-cell.is-empty { cursor: pointer; }
.fs-table .bc-cell.is-empty .fs-free { margin-top: 0; border-top: 0; }   /* ช่องที่ไม่มีเรียน: เหลือแค่จำนวนครูว่าง */
.fs-free {
    margin-top: 5px; padding-top: 4px; border-top: 1px dashed #CED4DA;
    font-size: .74rem; color: #146C3F; white-space: nowrap;
}
.fs-free b { font-size: .85rem; }
.fs-free.is-zero { color: #C92A2A; }
.fs-cell:focus-visible { outline: none; }
.fs-cell.is-sel { border-color: var(--tile-green); box-shadow: 0 0 0 2px var(--tile-green); }
.fs-cell.is-sel .fs-free { color: #fff; background: var(--tile-green); border-top-color: transparent; border-radius: 6px; padding: 2px 4px; }

/* ==================================================================
 * 26) รับสมัครนักเรียน (apply/) — หน้าสาธารณะ ใช้กล่อง .pf-box / การ์ด .mp-tile ร่วมกับส่วนอื่น
 * ================================================================== */
/* การ์ดรอบการสมัคร (index.php) */
.ap-rounds { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 991.98px) { .ap-rounds { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .ap-rounds { grid-template-columns: minmax(0, 1fr); } }   /* มือถือ: แถวละ 1 การ์ด */
.ap-rounds .mp-label { gap: 4px; }
/* ไทม์ไลน์สถานะใบสมัคร (view.php · ap_timeline_html) — วงกลมต่อด้วยเส้น */
.ap-tl { list-style: none; margin: 0; padding: 0; }
.ap-tl li { position: relative; display: flex; gap: 12px; padding-bottom: 16px; }
.ap-tl li:last-child { padding-bottom: 0; }
.ap-tl li:not(:last-child)::before {   /* เส้นเชื่อมไปขั้นถัดไป */
    content: ""; position: absolute; left: 17px; top: 38px; bottom: 2px; width: 3px; border-radius: 2px; background: #dee2e6;
}
.ap-tl li.is-done:not(:last-child)::before { background: #198754; }
.ap-tl-dot {
    flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 17px;
    background: #f1f3f5; color: #adb5bd; border: 3px solid #dee2e6;
}
.ap-tl-body { display: flex; flex-direction: column; padding-top: 6px; line-height: 1.35; }
.ap-tl-body b { font-weight: 600; color: #6c757d; }
.ap-tl-body small { color: #868e96; font-size: .82rem; }
.ap-tl-tag { display: inline-block; width: fit-content; margin: 2px 0; padding: 0 8px; border-radius: 999px; font-size: .72rem; color: #fff; background: #0d6efd; }
.ap-tl li.is-done .ap-tl-dot { background: #198754; border-color: #198754; color: #fff; }
.ap-tl li.is-done .ap-tl-body b { color: var(--text); }
.ap-tl li.is-now .ap-tl-dot { background: #fff; border-color: #0d6efd; color: #0d6efd; box-shadow: 0 0 0 5px rgba(13, 110, 253, .15); }
.ap-tl li.is-now .ap-tl-body b { color: #0d6efd; }
.ap-tl li.is-now.is-warn .ap-tl-dot { border-color: #f59f00; color: #f59f00; box-shadow: 0 0 0 5px rgba(245, 159, 0, .18); }
.ap-tl li.is-now.is-warn .ap-tl-body b { color: #e67700; }
.ap-tl li.is-now.is-warn .ap-tl-tag { background: #f59f00; }
.ap-tl li.is-cancel .ap-tl-dot { background: #868e96; border-color: #868e96; color: #fff; }
.ap-tl li.is-off { opacity: .45; }

/* การ์ด "สมัครแล้ว?": ไอคอนพื้นหลังมุมขวาล่าง โผล่ครึ่งเดียว */
.ap-check-box { position: relative; overflow: hidden; }
.ap-check-bg {   /* อยู่เหนือพื้นขาวของ .pf-box-body แต่จางและกดทะลุได้ */
    position: absolute; right: -24px; bottom: -36px; z-index: 1; pointer-events: none; transform: rotate(-12deg);
    font-size: 150px; line-height: 1; color: var(--tc); opacity: .12;
}
/* เงื่อนไขรอบ (นักเรียนเดิม) วางบนรูป — กรอบขาวใต้รูปจึงสูงเท่ากันทุกการ์ด */
.ap-art-tag {
    position: absolute; z-index: 2; left: 0; right: 0; bottom: 0;
    padding: 18px 8px 6px; text-align: center; line-height: 1.35;
    font-size: .78rem; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
    background: linear-gradient(transparent, rgba(0, 0, 0, .65));
}
.ap-rounds .mp-label b { font-size: 1.3rem; }
@media (max-width: 991.98px) { .ap-rounds .mp-label b { font-size: 1.15rem; } }
.ap-period { font-size: .8rem; color: #495057; }
.ap-note   { font-size: .8rem; color: #6c757d; line-height: 1.5; text-align: left; margin-top: 4px; }
.mp-tile.ap-closed { cursor: not-allowed; filter: grayscale(.7); opacity: .75; }
.mp-tile.ap-closed:hover { transform: none; box-shadow: 0 4px 12px rgba(0, 0, 0, .05); }
.ap-steps { margin: 0; padding-left: 1.3rem; line-height: 1.75; }
.ap-steps li + li { margin-top: 6px; }
/* การ์ดต้อนรับเมื่อมอบตัวเรียบร้อย (apply/view.php · status 5) */
.ap-welcome {
    position: relative; overflow: hidden; display: flex; align-items: center; gap: 20px;
    padding: 22px 26px; border-radius: 22px; color: #fff;
    background: linear-gradient(120deg, #13795B 0%, #1FA67A 45%, #2BA3C9 100%);
    box-shadow: 0 14px 34px rgba(19, 121, 91, .28);
}
.ap-welcome::before, .ap-welcome::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .12); pointer-events: none; }
.ap-welcome::before { width: 220px; height: 220px; right: -60px; top: -90px; }
.ap-welcome::after  { width: 140px; height: 140px; right: 120px; bottom: -80px; }
.ap-welcome-ico { flex-shrink: 0; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-size: 2.8rem; background: rgba(255, 255, 255, .2); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .35); }
.ap-welcome-body { position: relative; z-index: 1; min-width: 0; }
.ap-welcome-k { font-size: .95rem; font-weight: 300; letter-spacing: .3px; opacity: .95; }
.ap-welcome-name { font-size: clamp(1.3rem, 3vw, 1.8rem); font-weight: 600; line-height: 1.25; }
.ap-welcome-info { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.ap-welcome-info span { padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .2); font-size: .92rem; }
.ap-welcome-info b { font-weight: 600; }
.ap-welcome-msg { font-size: 1.05rem; font-weight: 500; }
.ap-welcome-msg small { font-weight: 300; opacity: .92; }
@media (max-width: 575.98px) {
    .ap-welcome { flex-direction: column; text-align: center; padding: 20px 16px; }
    .ap-welcome-info { justify-content: center; }
}
/* กรอบเอกสาร วันสมัคร / วันมอบตัว — กรอบที่ยังไม่ถึง/พ้นช่วงแล้ว = จาง (ap_doc_phase) */
.pf-box.ap-dim { opacity: .45; filter: grayscale(.6); transition: opacity .2s; }
.pf-box.ap-dim:hover { opacity: .8; }
.ap-doc-cols { column-gap: 2rem; }
@media (min-width: 768px) { .ap-doc-cols { columns: 2; } .ap-doc-cols li { break-inside: avoid; } }

/* ฟอร์มใบสมัคร (form.php) */
.ap-date { display: grid; grid-template-columns: 1fr 1.6fr 1.2fr; gap: 8px; }
.ap-seg  { display: flex; flex-wrap: wrap; gap: 6px; }
.ap-seg label {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    padding: 6px 14px; border-radius: 999px; border: 1.5px solid #dee2e6; background: #fff; font-size: .92rem;
    border-color: color-mix(in srgb, var(--tc, var(--primary)) 25%, #dee2e6);
}
.ap-seg input { accent-color: var(--tc, var(--primary)); }
.ap-seg label:has(input:checked) { border-color: var(--tc, var(--primary)); background: color-mix(in srgb, var(--tc, var(--primary)) 10%, #fff); font-weight: 500; }
.ap-sub { font-weight: 600; color: #343a40; margin-bottom: 8px; }
.ap-checks { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.ap-checks .form-check { margin: 0; }

/* ผลการสมัคร (view.php) */
.ap-seat   { font-size: 3.2rem; font-weight: 700; line-height: 1.1; letter-spacing: 3px; color: #198754; }   /* view.php เลขที่นั่งสอบ */
.ap-seat-k { font-size: .85rem; color: #6c757d; }
.ap-seat-room { margin-top: 6px; line-height: 1.6; }
/* กำหนดการสอบ (apply/exam_info.php · ap_exam_html) */
.ap-exam-tbl { width: 100%; margin-bottom: 14px; border-collapse: collapse; font-size: .92rem; }
.ap-exam-tbl th { padding: 6px 10px; font-weight: 500; color: #fff; background: var(--tc); }
.ap-exam-tbl td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.ap-exam-tbl .c { text-align: center; }
.ap-exam-tbl tr.is-me td { background: #ebfbee; font-weight: 600; }
.ap-exam-me { margin-left: 6px; padding: 0 8px; border-radius: 999px; font-size: .72rem; color: #fff; background: #198754; }
.ap-exam-note { padding: 8px 12px; border-radius: 10px; background: #fff9db; font-size: .9rem; }
.ap-fee { margin: 0 0 12px; }
.ap-fee img { display: block; max-width: 100%; height: auto; margin: 0 auto; border: 1px solid var(--border); border-radius: 8px; }
.ap-fee figcaption { margin-top: 4px; text-align: center; font-size: .85rem; color: #6c757d; }
/* ตั้งค่ารายละเอียดการสอบ (teacher/admission/exam.php) */
.adm-exam-sub { margin-bottom: 6px; font-weight: 500; }
.adm-exam-rows { width: 100%; border-collapse: separate; border-spacing: 0 4px; }
.adm-exam-rows th { padding: 0 4px; font-size: .8rem; font-weight: 400; color: #6c757d; }
.adm-exam-rows td { padding: 0 4px; }
.adm-exam-gen { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .85rem; color: #495057; }
.adm-exam-gen input { width: 70px; }
.adm-fee-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.adm-fee { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.adm-fee img { display: block; width: 100%; height: 160px; object-fit: cover; object-position: top; background: #f1f3f5; }
.ap-ref { font-size: 2rem; font-weight: 700; letter-spacing: 2px; color: var(--tc); color: color-mix(in srgb, var(--tc) 85%, #000); }
.ap-plan-list { padding-left: 1.3rem; line-height: 1.8; }
@media (max-width: 576px) {
    .ap-date { grid-template-columns: 1fr 1.5fr 1.2fr; gap: 6px; }
    .ap-ref  { font-size: 1.6rem; }
}
/* ==================================================================
 * 27) เครื่องมือครอบตัด/หมุนรูป (config/image_editor.js — ใช้ได้ทุกหน้า)
 * ================================================================== */
body.ie-open { overflow: hidden; }
.ie-modal {
    position: fixed; inset: 0; z-index: 2000; padding: 16px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(15, 23, 42, .72);
}
.ie-modal[hidden] { display: none; }
.ie-dialog {
    width: 100%; max-width: 720px; max-height: 100%;
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--surface); border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
    font-family: var(--font-main);
}
.ie-head  { padding: 12px 18px; font-weight: 600; color: #fff; background: var(--primary); }
.ie-stage { flex: 1 1 auto; min-height: 260px; height: 60vh; background: #1f2937; }
.ie-stage img { display: block; max-width: 100%; }
.ie-hint  { padding: 6px 14px; font-size: .8rem; color: var(--muted); text-align: center; border-bottom: 1px solid var(--line-soft); }
.ie-tools { display: flex; justify-content: center; gap: 6px; padding: 10px; flex-wrap: wrap; }
.ie-btn {
    display: inline-flex; flex-direction: column; align-items: center; gap: 2px; min-width: 76px;
    padding: 6px 10px; border: 1px solid var(--border); border-radius: 12px; background: #fff; color: #343a40; font-size: .78rem;
}
.ie-btn i { font-size: 1.25rem; color: var(--primary); }
.ie-btn:hover { background: var(--primary-light); }
.ie-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
@media (max-width: 576px) {
    .ie-modal  { padding: 0; }
    .ie-dialog { border-radius: 0; height: 100%; }
    .ie-stage  { height: auto; }
    .ie-btn    { min-width: 64px; }
    .ie-foot .btn { flex: 1; }
}
/* ใบสมัครแบบทีละขั้น (apply/form.php) */
.ap-stepper { list-style: none; margin: 0 0 18px; padding: 0; display: flex; gap: 6px; counter-reset: none; }
.ap-stepper li { flex: 1; min-width: 0; }
.ap-stepper button {
    width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px;
    border: 1.5px solid #dee2e6; border-radius: 14px; background: #fff; color: #6c757d; font-family: var(--font-main); text-align: left;
}
.ap-step-no {
    flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-weight: 600; background: #f1f3f5; color: #495057;
}
.ap-step-name { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-stepper button.done   { border-color: var(--tile-green); color: var(--tile-green); }
.ap-stepper button.done .ap-step-no { background: var(--tile-green); color: #fff; }
.ap-stepper button.active { border-color: var(--primary); color: var(--primary); font-weight: 600; box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }
.ap-stepper button.active .ap-step-no { background: var(--primary); color: #fff; }
.ap-stepper button.has-error { border-color: var(--danger); }
.ap-stepper button.has-error .ap-step-no { background: var(--danger); color: #fff; }
.ap-nav { align-items: center; }
.ap-nav-count { color: var(--muted); font-size: .9rem; }
[data-req-group].is-missing { outline: 2px solid var(--danger); outline-offset: 3px; border-radius: 10px; }
@media (max-width: 768px) {
    .ap-step-name { display: none; }
    .ap-stepper button { justify-content: center; padding: 6px; }
    .ap-stepper button.active .ap-step-name { display: inline; }
    .ap-stepper li:has(button.active) { flex: 3; }
}

/* หลักฐานแนบ (ขั้น 5) */
.ap-doc-group + .ap-doc-group { margin-top: 18px; }
.ap-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.ap-doc {
    display: grid; grid-template-columns: 64px minmax(0, 1fr); grid-template-areas: "thumb info" "thumb act";
    gap: 6px 12px; align-items: center; padding: 10px 12px;
    border: 1.5px dashed #ced4da; border-radius: 14px; background: #fff;
}
.ap-doc.is-done    { border-style: solid; border-color: var(--tile-green); background: #f4fbf6; }
.ap-doc.is-missing { border-color: var(--danger); background: #fff5f5; }
.ap-doc-thumb {
    grid-area: thumb; width: 64px; height: 64px; border-radius: 10px; overflow: hidden;
    display: flex; align-items: center; justify-content: center; background: #f1f3f5; color: #adb5bd; font-size: 1.8rem;
}
.ap-doc-thumb.is-photo { height: 80px; }
.ap-doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ap-doc.is-done .ap-doc-thumb { color: var(--danger); }
.ap-doc-info { grid-area: info; min-width: 0; }
.ap-doc-name { font-weight: 500; line-height: 1.35; }
.ap-doc-need { display: inline-block; margin-right: 6px; padding: 0 8px; border-radius: 999px; font-size: .72rem; background: var(--danger-bg); color: var(--danger-text); }
.ap-doc-need.is-opt { background: var(--neutral-bg); color: var(--neutral-text); }
.ap-doc-state { font-size: .8rem; color: #868e96; }
.ap-doc.is-done .ap-doc-state { color: var(--tile-green); }
.ap-doc-act { grid-area: act; display: flex; flex-wrap: wrap; gap: 6px; }
.ap-doc-act .btn { padding: 2px 12px; }

/* หลักฐานที่แนบ (view.php) */
.ap-doc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ap-doc-item { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: inherit; font-size: .82rem; background: #fff; }
.ap-doc-item:hover { border-color: var(--primary); }
.ap-doc-item .ap-doc-thumb { width: 100%; height: 100px; }
.ap-doc-item.is-missing { border-style: dashed; color: var(--danger); }
/* ตารางสอน: แถบ "กำลังจัดตารางล่วงหน้า" (ภาคเรียนที่จัด ≠ ภาคเรียนปัจจุบัน · layout_top) */
.tt-plan-bar { background: #fff4e5; border: 1px solid #ffd8a8; color: #8a4b00; border-radius: 12px; }
.tt-plan-bar a { color: #b35c00; font-weight: 600; }

/* เช็คชื่อตอนเช้า ทุกห้อง (attendance/morning_all.php — ผู้ดูแล) */
.ma-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ma-sum-all { font-weight: 600; margin-right: 6px; }
.ma-table tr.ma-grade td { background: #f1f3f5; font-weight: 700; color: #495057; padding-top: 6px; padding-bottom: 6px; }
.ma-table tr.ma-todo td:first-child { color: var(--danger, #dc3545); }

/* หน้าแรกระบบรับนักเรียน (teacher/admission/index.php) */
.ov-act-adm-list   { background: #6B3FA0; background: linear-gradient(135deg, #5B3CC4 0%, #A23FA8 100%); }
.ov-act-adm-enroll { background: #1F7F5C; background: linear-gradient(135deg, #17795E 0%, #4C9A2A 100%); }
.ov-act-adm-report { background: #B5651D; background: linear-gradient(135deg, #C9801A 0%, #B5472A 100%); }
.ov-act-adm-list   .ov-act-go { color: #6B3FA0; }
.ov-act-adm-enroll .ov-act-go { color: #1F7F5C; }
.ov-act-adm-report .ov-act-go { color: #B5651D; }
/* review.php หลักฐาน: แถวละ 5 ใบ (แท็บเล็ต 3 · มือถือ 2) การ์ดสูงเท่ากัน — ชื่อ 2 บรรทัด ปุ่มชิดล่าง */
.adm-docs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 991.98px) { .adm-docs { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .adm-docs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.adm-doc {
    display: flex; flex-direction: column; overflow: hidden; color: inherit; background: var(--surface);
    border: 2px solid var(--border); border-radius: 12px; transition: border-color .15s;
}
.adm-doc > a { position: relative; display: block; height: 0; padding-top: 75%; overflow: hidden; background: #F1F3F5; }   /* กรอบรูป 4:3 ตายตัว ไม่ยืดตามรูป */
.adm-doc > a > img, .adm-doc > a > .pdf { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.adm-doc img { display: block; object-fit: cover; }
.adm-doc .pdf { display: flex; align-items: center; justify-content: center; font-size: 2.4rem; color: var(--danger); }
.adm-doc-name {
    flex: 1; padding: 6px 10px; font-size: .82rem; line-height: 1.35; min-height: calc(2 * 1.35em + 12px);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* แตะ ผ่าน / ไม่ผ่าน หลักฐานรายชิ้น */
.adm-doc.is-pass { border-color: #198754; }
.adm-doc.is-fail { border-color: #dc3545; }
.adm-doc.is-busy { opacity: .55; pointer-events: none; }
.adm-doc-chk { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--border); }
.adm-doc-chk button {
    border: 0; background: #fff; padding: 9px 4px; font-size: .85rem; color: #6c757d; font-family: inherit;
}
.adm-doc-chk button + button { border-left: 1px solid var(--border); }
.adm-doc-chk button.ok:hover { color: #198754; background: #f1faf4; }
.adm-doc-chk button.no:hover { color: #dc3545; background: #fff5f5; }
.adm-doc.is-pass .adm-doc-chk button.ok { background: #198754; color: #fff; }
.adm-doc.is-fail .adm-doc-chk button.no { background: #dc3545; color: #fff; }
.adm-chk-sum .is-pass { color: #198754; font-weight: 600; }
.adm-chk-sum .is-fail { color: #dc3545; font-weight: 600; }
.adm-fail-list { padding: 8px 12px; border-radius: 10px; background: #fff5f5; color: #b02a37; font-size: .88rem; }
.adm-fail-list span { display: inline; padding: 0; font-size: inherit; }
.adm-open-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.adm-tab-btn {   /* ปุ่มหมวดข้อมูล: สีเดียวกับการ์ด (t-สี) */
    border: 0; border-radius: 999px; padding: 6px 16px; color: #fff; font-family: inherit;
    background: var(--tc); background: linear-gradient(135deg, var(--tc), color-mix(in srgb, var(--tc) 72%, #fff));
}
.adm-tab-btn:hover { filter: brightness(1.06); box-shadow: 0 4px 12px color-mix(in srgb, var(--tc) 35%, transparent); }
/* modal ตรวจใบสมัคร (teacher/admission/review.php เท่านั้น) */
.adm-hr  { margin: 4px 0; border-top: 1px dashed #ced4da; opacity: 1; }   /* เส้นคั่นกลุ่ม */
.adm-sub { margin-bottom: -6px; }   /* หัวข้อย่อย — สีและน้ำหนักเหมือนป้ายช่องกรอก */
.adm-tabs { flex-wrap: nowrap; overflow-x: auto; gap: 4px; }
.adm-tabs .nav-link { white-space: nowrap; border-radius: 999px; color: var(--tc); }
.adm-tabs .nav-link.active { color: #fff; background: var(--tc); }
/* ครูอัปโหลดหลักฐานแทน */
.adm-enroll-pv img { display: block; max-width: 100%; max-height: 220px; border-radius: 8px; border: 1px solid var(--border); }   /* enroll.php ตัวอย่าง ปพ. ที่เลือก */
.adm-doc-up { display: grid; grid-template-columns: 1fr 1fr; }
.adm-doc-up label {
    display: block; margin: 0; padding: 7px 4px; border-top: 1px solid var(--border); text-align: center;
    font-size: .8rem; color: #0d6efd; cursor: pointer; background: #f8f9fa;
}
.adm-doc-up label.cam { color: #198754; border-right: 1px solid var(--border); }
.adm-doc-up label:hover { background: #e7f1ff; }
.adm-doc-up label.cam:hover { background: #ebfbee; }
.adm-doc-up.is-busy, .adm-doc-add.is-busy { opacity: .5; pointer-events: none; }
.adm-doc-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 10px; }
.adm-doc-add .form-select { width: auto; max-width: 100%; }
/* ตารางระบบรับนักเรียน: สีตาม t-สี ของแต่ละหน้า (ไม่ใช้สีธีมหลัก) */
.adm-wrap { border-color: color-mix(in srgb, var(--tc) 25%, #e9ecef); }
.adm-wrap table.cl-tbl thead th { background: var(--tc); background: linear-gradient(135deg, var(--tc), color-mix(in srgb, var(--tc) 72%, #fff)); }
.adm-wrap table.cl-tbl tbody tr:nth-child(even) { background: color-mix(in srgb, var(--tc) 4%, #fff); }
.adm-wrap table.cl-tbl.hover tbody tr:hover { background: color-mix(in srgb, var(--tc) 10%, #fff); }

/* ปุ่มหัวหน้ารายงาน (teacher/admission/report.php) — จอเล็ก: เต็มความกว้าง เรียงลงมา */
@media (max-width: 575.98px) {
    .adm-head-acts { width: 100%; }
    .adm-head-acts > * { flex: 1 1 100%; }
    .adm-head-acts .btn { white-space: normal !important; }
}

/* รายงานมอบตัว (teacher/admission/enroll_report.php) — การ์ดสรุปไล่สี · การ์ดห้อง → แตะแสดงรายชื่อ */
.er-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
@media (max-width: 991.98px) { .er-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 479.98px) { .er-sum { grid-template-columns: minmax(0, 1fr); } }
.er-card { position: relative; overflow: hidden; border-radius: 18px; padding: 16px 18px; color: #fff; box-shadow: 0 10px 24px rgba(30, 30, 60, .12); }
.er-card::after { content: ''; position: absolute; right: -30px; bottom: -40px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.er-ico { position: absolute; right: 16px; top: 14px; font-size: 1.9rem; opacity: .35; }
.er-k { font-size: .9rem; opacity: .95; }
.er-v { font-size: 2.2rem; font-weight: 700; line-height: 1.15; }
.er-v small { font-size: .9rem; font-weight: 400; opacity: .9; }
.er-s { font-size: .82rem; opacity: .92; margin-top: 2px; position: relative; z-index: 1; }
.er-s a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.er-c1 { background: linear-gradient(135deg, #5B3CC4, #A23FA8); }
.er-c2 { background: linear-gradient(135deg, #17795E, #4C9A2A); }
.er-c3 { background: linear-gradient(135deg, #E08A12, #D4562A); }
.er-c4 { background: linear-gradient(135deg, #1F6FB5, #2BA3C9); }
.er-grades { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.er-gchip { padding: 5px 14px; border-radius: 999px; background: #fff; border: 1.5px solid #E1E5EC; color: #495057; text-decoration: none; font-size: .9rem; }
.er-gchip:hover { border-color: #5B3CC4; color: #5B3CC4; }
.er-gchip b { color: #5B3CC4; }

.er-grade { margin-bottom: 26px; scroll-margin-top: 80px; }
.er-grade-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 1.15rem; font-weight: 600; margin-bottom: 10px; color: #3b3f5c; }
.er-grade-head > .bi { color: #5B3CC4; }
.er-grade-head span { font-size: .88rem; font-weight: 400; color: var(--muted); }
.er-rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.er-room {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; cursor: pointer;
    padding: 12px 14px; border-radius: 14px; border: 1.5px solid #E1E5EC; background: #fff; font: inherit; color: inherit;
    transition: transform .12s, box-shadow .12s, border-color .12s;
}
.er-room:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(30, 30, 60, .1); border-color: #B9A6EA; }
.er-room[aria-expanded="true"] { border-color: #5B3CC4; background: linear-gradient(135deg, #F4F0FF, #fff); box-shadow: 0 8px 18px rgba(91, 60, 196, .18); }
.er-room.is-none { border-style: dashed; }
.er-room-name { font-weight: 600; font-size: 1.05rem; color: #3b3f5c; }
.er-room-n { font-size: 1.6rem; font-weight: 700; line-height: 1.1; color: #5B3CC4; }
.er-room-n small { font-size: .8rem; font-weight: 400; color: var(--muted); }
.er-room-bar { width: 100%; height: 6px; border-radius: 3px; background: #F7B6CF; overflow: hidden; }   /* ชมพู = หญิง · ฟ้า = ชาย */
.er-room-bar i { display: block; height: 100%; background: #6FA8E8; }
.er-room-sub { font-size: .78rem; color: var(--muted); }
.er-list { margin-top: 12px; animation: er-in .2s ease-out; }
.er-list-head { padding: 10px 14px; font-weight: 600; color: #17795E; }
@keyframes er-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
