/* =====================================================================
   CMU OPEN HOUSE ONSITE 2026 — Theme
   โทนม่วง มช. : sidebar ซ้าย + การ์ดขาว พื้นหลังม่วงอ่อน ไอคอนพาสเทล
   ===================================================================== */

:root {
    --v-50:   #F7F5FE;
    --v-100:  #F0ECFF;
    --v-200:  #DED4FF;
    --v-300:  #BDA9FB;
    --v-500:  #7C5CFF;   /* primary */
    --v-600:  #6A46F0;
    --v-700:  #5733D6;
    --v-900:  #3A2192;

    --ink:    #2E2A45;
    --muted:  #837DA0;
    --line:   #EDEAF8;
    --white:  #FFFFFF;

    --ok:     #16A34A;
    --ok-bg:  #E7F7EC;
    --warn:   #C2820B;
    --warn-bg:#FFF6DE;
    --danger: #E23D6E;
    --danger-bg:#FFE7EF;

    --r-xl: 26px;
    --r-lg: 20px;
    --r-md: 14px;
    --r-sm: 10px;

    --sh-sm: 0 2px 8px rgba(58, 33, 146, .05);
    --sh-md: 0 10px 26px rgba(58, 33, 146, .08);
    --sh-lg: 0 22px 50px rgba(58, 33, 146, .14);

    --sidebar-w: 262px;

    /* Bootstrap overrides */
    --bs-primary: #7C5CFF;
    --bs-primary-rgb: 124, 92, 255;
    --bs-body-color: #2E2A45;
    --bs-body-font-family: 'IBM Plex Sans Thai', 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-border-radius: var(--r-md);
    --bs-link-color: #7C5CFF;
    --bs-link-hover-color: #5733D6;
}

/* ---------------- base ---------------- */
body {
    font-family: var(--bs-body-font-family);
    color: var(--ink);
    background: var(--v-50);
    min-height: 100vh;
    letter-spacing: .1px;
}
a { text-decoration: none; }
h1, h2, h3, h4, h5 { font-weight: 700; }

.text-muted-soft { color: var(--muted) !important; }
.text-purple      { color: var(--v-600) !important; }
.bg-purple-soft   { background: var(--v-100) !important; }
.text-ok          { color: var(--ok) !important; }

/* =====================================================================
   App shell (หน้าที่ล็อกอินแล้ว)
   ===================================================================== */
.app-body { background: var(--v-50); }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--white);
    border-right: 1px solid var(--line);
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow-y: auto;
    z-index: 1040;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 6px 12px;
}

/* โลโก้มหาวิทยาลัย */
.brand-logo { height: 38px; width: auto; display: block; }
.sidebar-brand .brand-logo { height: 44px; }
.navbar-cmu .brand-logo { height: 34px; }
.brand-divider {
    width: 1px; height: 30px;
    background: var(--line);
    display: inline-block;
    margin: 0 .2rem;
}
.brand-logo-chip {
    background: #fff;
    border-radius: 12px;
    padding: 8px 12px;
    display: inline-grid; place-items: center;
    flex: 0 0 auto;
}
.brand-logo-chip img { height: 28px; width: auto; display: block; }

.side-nav { display: grid; gap: 6px; }
.side-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: .78rem 1rem;
    border-radius: var(--r-md);
    color: var(--ink);
    font-weight: 600;
    font-size: .95rem;
    transition: background .15s ease, color .15s ease;
}
.side-nav a i { font-size: 1.1rem; color: var(--muted); }
.side-nav a:hover { background: var(--v-50); color: var(--v-600); }
.side-nav a:hover i { color: var(--v-500); }
.side-nav a.active {
    background: linear-gradient(135deg, var(--v-500), var(--v-600));
    color: #fff;
    box-shadow: 0 8px 18px rgba(124, 92, 255, .28);
}
.side-nav a.active i { color: #fff; }

/* ปุ่มออกจากระบบ : เว้นระยะห่างจากเมนูด้านบน + มีเส้นคั่น */
.side-logout {
    margin-top: 1.6rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--line);
}
.side-logout-link {
    display: flex; align-items: center; gap: 12px;
    padding: .78rem 1rem;
    border-radius: var(--r-md);
    color: #D8365E;
    font-weight: 600;
    font-size: .95rem;
    background: #FFF3F6;
    transition: background .15s ease, color .15s ease;
}
.side-logout-link:hover { background: #FFE4EC; color: #B92B4F; }
.side-logout-link i { font-size: 1.1rem; }

.side-help {
    background: var(--v-50);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 16px;
    font-size: .82rem;
    color: var(--muted);
}
.side-help .side-help-title { color: var(--v-600); font-weight: 700; display: flex; align-items: center; gap: .5rem; }

.side-banner {
    margin-top: auto;
    border-radius: var(--r-lg);
    overflow: hidden;
    background: linear-gradient(160deg, var(--v-500) 0%, var(--v-900) 100%);
    color: #fff;
    padding: 20px 16px;
    text-align: center;
    box-shadow: var(--sh-md);
}
.side-banner .b-logo { font-size: 1.5rem; font-weight: 800; letter-spacing: 1px; }
.side-banner .b-title { font-size: 1.02rem; font-weight: 700; line-height: 1.25; margin: .4rem 0 .6rem; }
.side-banner .b-meta { font-size: .78rem; opacity: .88; }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 1030;
    background: rgba(255,255,255,.92);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
    padding: .85rem 1.8rem;
    display: flex; align-items: center; gap: 1rem;
}
.topbar .topbar-title { font-weight: 800; color: var(--v-700); line-height: 1.15; font-size: 1rem; }
.topbar .topbar-title span { display: block; font-size: .8rem; color: var(--muted); font-weight: 600; }

.icon-btn {
    width: 42px; height: 42px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--v-50); color: var(--v-600);
    border: 1px solid var(--line);
    position: relative;
}
.icon-btn:hover { background: var(--v-100); color: var(--v-700); }
.icon-btn .dot {
    position: absolute; top: 9px; right: 10px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--danger); border: 2px solid #fff;
}

.user-chip { display: flex; align-items: center; gap: .7rem; color: var(--ink); }
.user-chip .u-name { font-weight: 700; font-size: .92rem; line-height: 1.2; }
.user-chip .u-sub  { font-size: .76rem; color: var(--muted); }

.avatar-circle {
    width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--v-100); color: var(--v-600);
    font-weight: 700; font-size: 1rem;
    flex: 0 0 auto;
}

.app-content { padding: 1.6rem 1.8rem 2.4rem; flex: 1 0 auto; }

.panel {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-sm);
    padding: 1.6rem;
}

.app-note {
    background: var(--white);
    border-top: 1px solid var(--line);
    padding: .9rem 1.8rem;
    font-size: .85rem;
    color: var(--muted);
    text-align: center;
}

/* ---------------- navbar (หน้าสาธารณะ) ---------------- */
.navbar-cmu {
    background: rgba(255,255,255,.92);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
    padding: .6rem 0;
}
.navbar-cmu .navbar-brand { display: flex; align-items: center; gap: .65rem; font-weight: 800; color: var(--v-700); }
.navbar-cmu .brand-text span { font-size: 1rem; }
.navbar-cmu .brand-text small { display: block; font-size: .68rem; font-weight: 600; color: var(--muted); }
.navbar-cmu .nav-link { font-weight: 600; color: var(--ink); border-radius: 999px; padding: .45rem 1rem !important; }
.navbar-cmu .nav-link:hover { color: var(--v-600); background: var(--v-50); }
.navbar-cmu .nav-link.active { color: var(--v-700); background: var(--v-100); }

/* ---------------- buttons ---------------- */
.btn { border-radius: var(--r-md); font-weight: 600; padding: .62rem 1.3rem; transition: all .16s ease; }
.btn-lg { padding: .85rem 1.8rem; border-radius: var(--r-md); }
.btn-sm { padding: .4rem .95rem; font-size: .86rem; border-radius: var(--r-sm); }

.btn-primary {
    background: linear-gradient(135deg, var(--v-500) 0%, var(--v-600) 100%);
    border: none;
    box-shadow: 0 6px 16px rgba(124, 92, 255, .26);
}
.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, var(--v-600) 0%, var(--v-700) 100%);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(124, 92, 255, .32);
}
.btn-primary:disabled, .btn-primary.disabled { background: var(--v-200); box-shadow: none; }

.btn-outline-primary { color: var(--v-600); border: 1.5px solid var(--v-200); background: #fff; }
.btn-outline-primary:hover { background: var(--v-500); border-color: var(--v-500); color: #fff; }

.btn-light-purple { background: var(--v-100); color: var(--v-700); border: none; }
.btn-light-purple:hover { background: var(--v-200); color: var(--v-700); }

.btn-white { background: #fff; color: var(--v-600); border: none; box-shadow: var(--sh-sm); }
.btn-white:hover { background: #fff; color: var(--v-700); transform: translateY(-1px); }

.btn-muted { background: #F1F0F6; color: #A9A5BC; border: none; cursor: not-allowed; }

/* ---------------- hero (หน้าแรก/login) ---------------- */
.hero {
    position: relative; overflow: hidden;
    border-radius: var(--r-xl);
    background: linear-gradient(135deg, var(--v-900) 0%, var(--v-600) 55%, #9A7BFF 100%);
    color: #fff;
    padding: clamp(2rem, 5vw, 3.4rem);
    box-shadow: var(--sh-lg);
}
.hero::before, .hero::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,.09); }
.hero::before { width: 420px; height: 420px; top: -160px; right: -110px; }
.hero::after  { width: 260px; height: 260px; bottom: -140px; left: -80px; background: rgba(255,255,255,.06); }
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.7rem); line-height: 1.22; }
.hero p { color: rgba(255,255,255,.9); }
.badge-pill-glass {
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.28);
    color: #fff; border-radius: 999px;
    padding: .4rem 1rem; font-weight: 600; font-size: .84rem;
    display: inline-flex; align-items: center; gap: .45rem;
}

/* กล่องชวนใช้ ThaID บนหน้าสร้างบัญชี : โลโก้ + ข้อความ + ปุ่ม อยู่แถวเดียวบนจอกว้าง
   จอมือถือปุ่มลงมาเต็มความกว้างใต้ข้อความ กดง่าย ไม่ลอยค้างอยู่ขวามือ */
.thaid-hint {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .6rem 1rem;
    padding: 1rem 1.15rem;
    background: var(--bs-white, #fff);
    border: 1.5px solid rgba(27,79,156,.22);
    border-radius: var(--r-lg);
}
.thaid-hint-logo { border-radius: 10px; object-fit: contain; }
.thaid-hint-btn { white-space: nowrap; }
.thaid-hint-note {
    grid-column: 1 / -1;
    display: flex; align-items: flex-start; gap: .55rem;
    padding-top: .7rem; margin-top: .1rem;
    border-top: 1px dashed rgba(0,0,0,.12);
    color: var(--muted); text-decoration: none; line-height: 1.55;
}
.thaid-hint-note:hover .text-purple { text-decoration: underline; }
.thaid-hint-note-icon { font-size: 1.15rem; line-height: 1.2; color: var(--v-500); }
#register_form { scroll-margin-top: 90px; }   /* เลื่อนลงมาแล้วหัวฟอร์มไม่ถูกแถบเมนูด้านบนบัง */
@media (max-width: 575.98px) {
    .thaid-hint { grid-template-columns: auto 1fr; }
    .thaid-hint-btn { grid-column: 1 / -1; width: 100%; }
}

/* แถบพับ "ตั้ง/เปลี่ยนรหัสผ่าน" ในหน้าโปรไฟล์ : ให้ดูเป็นตัวเลือกรอง ไม่แย่งความสนใจจากฟอร์มหลัก */
.pw-toggle {
    background: transparent; border: 0; color: inherit;
    border-radius: inherit;
}
.pw-toggle:hover { background: rgba(0,0,0,.03); }
.pw-chevron { transition: transform .2s ease; }
.pw-toggle:not(.collapsed) .pw-chevron { transform: rotate(180deg); }

/* กรอบรวมทางเข้าระบบ : แยกชุด "สร้างบัญชี / เข้าสู่ระบบ" ออกจากข้อความอื่นใน hero */
.entry-panel {
    padding: 1.1rem 1.15rem 1rem;
    border-radius: var(--r-lg);
    background: rgba(0,0,0,.14);
    border: 1px solid rgba(255,255,255,.18);
}
.entry-head {
    display: flex; align-items: center; gap: .55rem;
    margin-bottom: .85rem;
    font-weight: 800; font-size: 1rem;
}
.entry-step {
    display: inline-grid; place-items: center;
    width: 1.6rem; height: 1.6rem; border-radius: 50%;
    background: #fff; color: var(--v-700);
    font-size: .82rem; font-weight: 800;
}
.entry-login {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem;
    margin-top: 1rem; padding-top: .9rem;
    border-top: 1px dashed rgba(255,255,255,.3);
    font-size: .9rem; color: rgba(255,255,255,.9);
}

/* ---------------- ทางเข้าระบบ (หน้าแรก) ----------------
   เดิมเป็นปุ่มสองปุ่มที่หน้าตาเท่ากัน ผู้ใช้จึงไม่รู้ว่าตัวเองควรกดอันไหน
   เปลี่ยนเป็นการ์ดที่บอก "ใครควรใช้ทางนี้" ไว้ใต้หัวข้อของแต่ละทาง */
.choice {
    position: relative;   /* ให้ป้าย "แนะนำ" เกาะมุมการ์ดใบนี้ได้ */
    display: flex; flex-direction: column; height: 100%;
    padding: 1.15rem 1.25rem;
    border-radius: var(--r-lg);
    background: rgba(255,255,255,.12);
    border: 1.5px solid rgba(255,255,255,.32);
    color: #fff; text-decoration: none;
    transition: background .16s ease, transform .16s ease, border-color .16s ease;
}
.choice:hover, .choice:focus {
    background: rgba(255,255,255,.2); border-color: #fff;
    color: #fff; transform: translateY(-2px); text-decoration: none;
}
/* การ์ดใบนี้พื้นขาว ตัวอักษรต้องเป็นสีม่วงเสมอ ทั้งตอนปกติ ชี้เมาส์ กด และหลังกด
   (ใช้สีที่มีนิยามจริงเท่านั้น — ถ้าอ้าง var ที่ไม่มีอยู่ color จะตกไปรับค่าจาก .hero
   ซึ่งเป็นสีขาว กลายเป็นตัวอักษรขาวบนพื้นขาว มองไม่เห็นทั้งใบ) */
.choice-primary { background: #fff; border-color: #fff; color: var(--v-700); }
.choice-primary:hover,
.choice-primary:focus,
.choice-primary:active,
.choice-primary:visited { background: #fff; color: var(--v-900); }

.choice-title {
    display: flex; align-items: center; gap: .5rem;
    font-size: 1.05rem; font-weight: 800; line-height: 1.35;
}
/* ลิงก์/ปุ่มนำทางที่ปิดไว้ช่วงก่อนเปิดระบบ (config.php : nav_href()) */
a[aria-disabled="true"] { pointer-events: none; cursor: not-allowed; opacity: .5; }

/* กล่องแจ้ง "ยังไม่เปิดสร้างบัญชี" แทนที่ปุ่มเลือกวิธีสร้างบัญชี (index.php) */
.register-soon {
    display: flex; align-items: center; gap: .9rem;
    padding: 1rem 1.15rem;
    border-radius: var(--r-lg);
    background: #fff; color: var(--v-700);
    line-height: 1.55;
}
.register-soon img { flex-shrink: 0; object-fit: contain; }

.choice-sub { margin-top: .4rem; font-size: .86rem; line-height: 1.55; opacity: .82; }
.choice-go { margin-top: auto; padding-top: .7rem; font-size: .86rem; font-weight: 700; }

/* ป้าย "แนะนำ" แปะมุมขวาบนของการ์ด — รูปแบบเดียวกับ .method-flag ในหน้าเข้าสู่ระบบ
   มุมขวาบนต้องโค้งเท่ากับ .choice (--r-lg) ไม่งั้นป้ายจะโผล่พ้นมุมการ์ดออกมา */
.choice-tag {
    position: absolute; top: -1px; right: -1px;
    background: var(--v-500); color: #fff;
    font-size: .72rem; font-weight: 800; letter-spacing: .02em;
    padding: .25rem .8rem;
    border-radius: 0 var(--r-lg) 0 12px;
}
.choice:not(.choice-primary) .choice-tag { background: rgba(255,255,255,.22); color: #fff; }

/* กันหัวข้อวิ่งไปชนป้ายที่มุม (ป้ายลอยอยู่นอก flow จึงไม่ดันข้อความให้เอง) */
.choice-primary .choice-title { padding-right: 4rem; }

/* ---------------- ช่องเลือกแบบพิมพ์ค้นหาได้ (assets/js/searchable-select.js) ----------------
   ใช้กับช่องเลือกโรงเรียน ซึ่งบางจังหวัดมีเกือบ 400 แห่ง เลื่อนหาอย่างเดียวไม่ไหว */
.ss-wrap { position: relative; }
.ss-native { display: none !important; }

/* ต้องดูออกตั้งแต่แรกเห็นว่า "พิมพ์ได้" ไม่ใช่ dropdown ธรรมดา
   จึงใส่แว่นขยายไว้ซ้าย และลูกศรลงไว้ขวา (ยังบอกว่ากดแล้วมีรายการให้เลือก) */
.ss-input {
    padding-left: 2.25rem;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23837DA0'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23837DA0'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat;
    background-position: left .8rem center, right .8rem center;
    background-size: 15px 15px, 13px 13px;
    cursor: text;
}
.ss-input:focus { background-image: none; padding-left: .9rem; }   /* เริ่มพิมพ์แล้วเอาไอคอนออก ไม่ให้บังข้อความ */

.ss-menu {
    position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px);
    max-height: 260px; overflow-y: auto;
    background: #fff;
    border: 1px solid var(--line); border-radius: var(--r-md);
    box-shadow: var(--sh-md);
    padding: .3rem;
}
.ss-item {
    padding: .5rem .7rem; border-radius: 10px;
    font-size: .93rem; line-height: 1.45; cursor: pointer;
}
.ss-item:hover, .ss-item.is-active { background: var(--v-50); color: var(--v-700); }
.ss-item.is-selected { font-weight: 700; color: var(--v-700); }
.ss-empty { padding: .6rem .7rem; color: var(--muted); font-size: .9rem; }

/* ---------------- หน้าเข้าสู่ระบบ : แยกการ์ดตามวิธีเข้าระบบ ----------------
   เดิมทุกวิธีอยู่ในการ์ดใบเดียวคั่นด้วยเส้น ผู้ใช้จึงไม่รู้ว่าอันไหนคู่กับอันไหน
   แยกเป็นการ์ดละวิธี + บอกไว้ที่หัวการ์ดว่า "วิธีนี้สำหรับใคร" */
.method { position: relative; }
.method + .method { margin-top: 1rem; }

.method-top { display: flex; gap: .85rem; align-items: flex-start; }
.method-no {
    flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%;
    background: var(--v-100); color: var(--v-700);
    font-weight: 800; font-size: .95rem;
    display: grid; place-items: center;
}
.method-title { font-weight: 800; font-size: 1.02rem; line-height: 1.35; }
.method-who { font-size: .86rem; color: var(--muted); margin-top: .15rem; line-height: 1.55; }

/* วิธีที่แนะนำ — เน้นด้วยขอบม่วงและป้ายมุมขวา ไม่ใช้สีพื้นทั้งใบ จะได้ไม่แย่งความสนใจจากปุ่ม */
.method-recommended { border-color: var(--v-300); }
/* มุมขวาบนต้องโค้งเท่ากับ .card-soft (--r-xl) ไม่งั้นป้ายจะโผล่พ้นมุมการ์ด */
.method-flag {
    position: absolute; top: -1px; right: -1px;
    background: var(--v-500); color: #fff;
    font-size: .72rem; font-weight: 800; letter-spacing: .02em;
    padding: .25rem .8rem;
    border-radius: 0 var(--r-xl) 0 12px;
}

/* ---------------- cards ---------------- */
.card { border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-sm); background: #fff; }
.card-soft { border-radius: var(--r-xl); border: 1px solid var(--line); box-shadow: var(--sh-md); }
.card-hover { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--sh-md); border-color: var(--v-200); }

/* ---------------- icon tiles (พาสเทล) ---------------- */
.icon-tile {
    width: 46px; height: 46px; border-radius: 14px;
    display: grid; place-items: center;
    background: var(--v-100); color: var(--v-600);
    font-size: 1.2rem; flex: 0 0 auto;
}
.icon-tile-lg { width: 62px; height: 62px; border-radius: 18px; font-size: 1.6rem; }

.tile-round {
    width: 72px; height: 72px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 1.75rem; margin: 0 auto;
}
.tile-violet { background: #F0EBFF; color: #7C5CFF; }
.tile-green  { background: #E8F7EC; color: #2E9E5B; }
.tile-blue   { background: #E7F1FE; color: #2B7FD4; }
.tile-orange { background: #FFF0E2; color: #EE8A24; }
.tile-pink   { background: #FDE9F3; color: #DE4F94; }
.tile-yellow { background: #FFF6DA; color: #D3A006; }
.tile-teal   { background: #E3F6F4; color: #199A90; }
.tile-red    { background: #FFEAEA; color: #DB4B4B; }
.tile-indigo { background: #EAECFD; color: #4E5BD8; }
.tile-lime   { background: #F0F7E0; color: #6E9B1E; }

/* ---------------- faculty card ---------------- */
.fc-card {
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: var(--r-lg);
    padding: 1.35rem 1.1rem 1.1rem;
    height: 100%;
    display: flex; flex-direction: column;
    text-align: center;
    position: relative;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.fc-card:hover { transform: translateY(-3px); box-shadow: var(--sh-md); border-color: var(--v-200); }
.fc-card.is-selected { border-color: var(--v-500); box-shadow: 0 10px 26px rgba(124, 92, 255, .18); }
.fc-card.is-full { background: #FBFAFD; }
.fc-card.is-full:hover { transform: none; box-shadow: none; border-color: var(--line); }
.fc-card.is-locked, .fc-card.is-locked .btn-muted { cursor: pointer; }

.fc-name { font-weight: 700; margin-top: .85rem; line-height: 1.35; }
.fc-total { font-size: .85rem; color: var(--muted); margin-top: .15rem; }
.fc-left { font-size: .88rem; font-weight: 600; color: var(--ok); margin-top: .35rem; display: flex; align-items: center; justify-content: center; gap: .35rem; }
.fc-left.full { color: var(--danger); }
.fc-actions { margin-top: auto; padding-top: 1rem; }

.fc-flag {
    position: absolute; top: 12px; right: 14px;
    font-size: 1.05rem; color: #F5B700;
}
.fc-tag {
    position: absolute; top: 12px; right: 12px;
    background: var(--danger-bg); color: var(--danger);
    border-radius: 999px; padding: .2rem .6rem;
    font-size: .72rem; font-weight: 700;
}
.fc-tag-ok { background: var(--ok-bg); color: var(--ok); }

/* ---------------- day picker ---------------- */
.day-picker {
    background: var(--v-50);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 1.1rem 1.2rem;
}
.day-pill {
    display: flex; align-items: center; gap: .85rem;
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: var(--r-md);
    padding: .85rem 1.15rem;
    color: var(--ink);
    min-width: 330px;
    transition: all .16s ease;
}
.day-pill .dp-icon {
    width: 40px; height: 40px; border-radius: 12px;
    display: grid; place-items: center;
    background: var(--v-100); color: var(--v-600);
    font-size: 1.1rem; flex: 0 0 auto;
}
.day-pill .dp-title { font-weight: 700; line-height: 1.2; }
.day-pill .dp-sub { font-size: .8rem; color: var(--muted); }
.day-pill:hover { border-color: var(--v-300); color: var(--ink); }
.day-pill.active {
    background: linear-gradient(135deg, var(--v-500), var(--v-600));
    border-color: transparent; color: #fff;
    box-shadow: 0 10px 22px rgba(124, 92, 255, .28);
}
.day-pill.active .dp-icon { background: rgba(255,255,255,.2); color: #fff; }
.day-pill.active .dp-sub { color: rgba(255,255,255,.85); }
.day-pill.is-closed { opacity: .6; }

.info-pill {
    display: flex; align-items: center; gap: .85rem;
    background: #fff; border: 1px solid var(--line);
    border-radius: var(--r-md); padding: .8rem 1.1rem;
}
.info-pill .ip-icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: grid; place-items: center;
    background: var(--v-100); color: var(--v-600); font-size: 1.15rem;
    flex: 0 0 auto;
}

/* ---------------- status card (มุมขวาบน) ---------------- */
.status-card {
    display: flex; align-items: center; gap: .9rem;
    background: var(--v-100);
    border-radius: var(--r-lg);
    padding: .9rem 1.15rem;
}
.status-card .sc-icon {
    width: 44px; height: 44px; border-radius: 13px;
    display: grid; place-items: center;
    background: #fff; color: var(--v-600); font-size: 1.2rem;
    flex: 0 0 auto;
}
.status-card .sc-title { font-weight: 700; color: var(--v-700); }
.status-card .sc-sub { font-size: .82rem; color: var(--muted); }
.status-card.is-done { background: var(--ok-bg); }
.status-card.is-done .sc-icon { color: var(--ok); }
.status-card.is-done .sc-title { color: var(--ok); }

/* รอยืนยันสิทธิ์ : ยังมีเวลา = เหลือง | ใกล้หมดเขต/เลยกำหนด = แดง */
.status-card.is-waiting { background: var(--warn-bg); }
.status-card.is-waiting .sc-icon { color: var(--warn); }
.status-card.is-waiting .sc-title { color: var(--warn); }

.status-card.is-pending { background: var(--danger-bg); }
.status-card.is-pending .sc-icon { color: var(--danger); }
.status-card.is-pending .sc-title { color: var(--danger); }

.text-warn { color: var(--warn) !important; }

/* กล่องเตือน "ไม่ยืนยันสิทธิ์ = สละสิทธิ์" */
.forfeit-warn {
    display: flex; align-items: flex-start; gap: .8rem;
    background: var(--warn-bg);
    border-left: 4px solid var(--warn);
    border-radius: var(--r-md);
    padding: .95rem 1.1rem;
    color: #7A5406;
    line-height: 1.5;
}
.forfeit-warn i { font-size: 1.25rem; color: var(--warn); line-height: 1.35; flex: 0 0 auto; }
.forfeit-warn .small { opacity: .85; }

.forfeit-warn.is-danger {
    background: var(--danger-bg);
    border-left-color: var(--danger);
    color: #8E1F41;
}
.forfeit-warn.is-danger i { color: var(--danger); }

/* ---------------- chips / filter ---------------- */
.chip {
    border: 1.5px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 999px;
    padding: .45rem 1.1rem;
    font-weight: 600; font-size: .88rem;
    transition: all .15s ease;
}
.chip:hover { border-color: var(--v-300); color: var(--v-600); }
.chip.active {
    background: linear-gradient(135deg, var(--v-500), var(--v-600));
    border-color: transparent; color: #fff;
    box-shadow: 0 6px 16px rgba(124, 92, 255, .26);
}

.badge-soft { border-radius: 999px; padding: .3rem .8rem; font-weight: 600; font-size: .78rem; display: inline-flex; align-items: center; gap: .35rem; }
.badge-soft-purple { background: var(--v-100); color: var(--v-700); }
.badge-soft-green  { background: var(--ok-bg); color: var(--ok); }
.badge-soft-amber  { background: var(--warn-bg); color: var(--warn); }
.badge-soft-red    { background: var(--danger-bg); color: var(--danger); }
.badge-soft-grey   { background: #F1F0F6; color: #8A85A3; }

/* ---------------- forms ---------------- */
.form-label { font-weight: 600; font-size: .92rem; margin-bottom: .35rem; }
.form-control, .form-select {
    border-radius: var(--r-md);
    border: 1.5px solid var(--line);
    padding: .7rem .95rem;
    font-size: .95rem;
    background: #fff;
}
.form-control:focus, .form-select:focus {
    border-color: var(--v-300);
    box-shadow: 0 0 0 .22rem rgba(124, 92, 255, .13);
}
.form-control::placeholder { color: #B3AECB; }
.input-group-text {
    background: var(--v-50); border: 1.5px solid var(--line); border-right: 0;
    border-radius: var(--r-md) 0 0 var(--r-md); color: var(--v-600);
}
.form-check-input:checked { background-color: var(--v-500); border-color: var(--v-500); }
.form-check-input:focus { box-shadow: 0 0 0 .22rem rgba(124, 92, 255, .13); border-color: var(--v-300); }

.search-input .form-control { border-left: 0; padding-left: 0; }
.search-input .input-group-text { border-right: 0; border-left: 1.5px solid var(--line); }

/* ---------------- ThaID ---------------- */
.btn-thaid {
    background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-md);
    padding: .85rem 1.2rem; width: 100%;
    display: flex; align-items: center; justify-content: center; gap: .7rem;
    font-weight: 700; color: var(--ink); box-shadow: var(--sh-sm);
    transition: all .16s ease;
}
/* ใช้กับทั้ง <button> และ <a> (ปุ่ม ThaID เป็นลิงก์ไปโมดูล ../thaid/) */
.btn-thaid, .btn-thaid:hover, .btn-thaid:focus { text-decoration: none; }
.btn-thaid:hover { border-color: var(--v-300); transform: translateY(-1px); box-shadow: var(--sh-md); color: var(--ink); }
.btn-thaid .thaid-logo {
    width: 30px; height: 30px; border-radius: 8px;
    object-fit: contain; flex-shrink: 0;
}
.divider-text { display: flex; align-items: center; gap: 1rem; color: var(--muted); font-size: .85rem; margin: 1.3rem 0; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------------- stepper ---------------- */
.stepper { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.stepper .step { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .88rem; font-weight: 600; }
.stepper .step .num {
    width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center;
    background: #EDEBF6; color: var(--muted); font-size: .78rem; font-weight: 700;
}
.stepper .step.active { color: var(--v-700); }
.stepper .step.active .num { background: var(--v-500); color: #fff; }
.stepper .step.done .num { background: var(--ok); color: #fff; }
.stepper .sep { color: var(--line); }

/* ---------------- misc ---------------- */
.page-title { font-size: clamp(1.35rem, 2.6vw, 1.85rem); font-weight: 800; }
.breadcrumb-back { font-weight: 600; color: var(--muted); font-size: .9rem; }
.breadcrumb-back:hover { color: var(--v-600); }

.seat-bar { height: 8px; border-radius: 999px; background: var(--v-100); overflow: hidden; }
.seat-bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--v-300), var(--v-500)); transition: width .4s ease; }
.seat-bar.warn > span { background: linear-gradient(90deg, #FFD166, #EFA00B); }
.seat-bar.full > span { background: linear-gradient(90deg, #F3A0B4, #E23D6E); }

.meta-line { font-size: .84rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.faculty-en { font-size: .78rem; color: var(--muted); }

.ticket { border-radius: var(--r-md); border: 1.5px dashed var(--v-300); background: linear-gradient(135deg, var(--v-50), #fff); }
.ticket-code { font-family: 'JetBrains Mono', ui-monospace, 'Courier New', monospace; font-size: 1.25rem; font-weight: 700; letter-spacing: 1.5px; color: var(--v-700); }

.alert { border: none; border-radius: var(--r-md); font-weight: 500; }
.alert-success { background: var(--ok-bg); color: #146B3A; }
.alert-danger  { background: var(--danger-bg); color: #B22651; }
.alert-warning { background: var(--warn-bg); color: #8C5D06; }
.alert-info    { background: var(--v-100); color: var(--v-700); }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state i { font-size: 3rem; color: var(--v-300); }

.footer-cmu { background: var(--v-900); color: rgba(255,255,255,.78); padding: 2.4rem 0 1.6rem; margin-top: 3.5rem; }
.footer-cmu a { color: rgba(255,255,255,.82); }
.footer-cmu a:hover { color: #fff; }
.footer-cmu .footer-title { color: #fff; font-weight: 700; }

.modal-content { border-radius: var(--r-xl); }

/* ---------------- responsive ---------------- */
@media (max-width: 1199.98px) {
    :root { --sidebar-w: 232px; }
}
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: var(--sh-lg);
        width: 268px;
    }
    .sidebar.show { transform: none; }
    .app-main { margin-left: 0; }
    .sidebar-backdrop {
        position: fixed; inset: 0; background: rgba(46, 42, 69, .42);
        z-index: 1035; opacity: 0; pointer-events: none; transition: opacity .2s ease;
    }
    .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
    .topbar { padding: .75rem 1rem; }
    .app-content { padding: 1.2rem 1rem 2rem; }
    .app-note { padding: .9rem 1rem; }
}
@media (max-width: 575.98px) {
    .day-pill { min-width: 100%; }
    .panel { padding: 1.1rem; border-radius: var(--r-lg); }
}

/* ---------- checkin.php : แท็บเจ้าหน้าที่ + ตารางภาพรวม ---------- */
.staff-tabs .nav-link { color: var(--v-700); font-weight: 600; border-radius: 999px; }
.staff-tabs .nav-link.active { background: var(--v-500); color: #fff; }
.dash-table th, .dash-table td { white-space: nowrap; }
.dash-table .day-head { border-bottom: 2px solid var(--v-200); }
.dash-table .day-start { border-left: 1px solid var(--v-100); }
.dash-table tfoot td { border-top: 2px solid var(--v-200); }
