/* ===== GarageOne: Super App UI (ต้นแบบจาก school-superapp-ui) =====
   สีหลักทั้งหมดมาจากตัวแปร --sb-primary* ซึ่ง layout ใส่ให้ตามสีที่ตั้งไว้ (App\Support\Theme) */
:root {
    --sb-primary: #F26522;
    --sb-primary-rgb: 242, 101, 34;
    --sb-primary-600: #d9530f;
    --sb-primary-700: #b0430c;
    --sb-primary-50: #fef3ed;
    --sb-primary-100: #fde6da;
    --sb-primary-200: #fbccb5;
    --sb-grad-from: #ff9a4d;
    --sb-grad-to: #ef5b1c;
    --sb-bg: #f4f5f7;
    --sb-card: #ffffff;
    --sb-border: #eceef2;
    --sb-text: #1f2937;
    --sb-muted: #6b7280;
    --sb-rail-w: 84px;
    --sb-radius: 16px;
    --sb-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .04);
    --sb-shadow-lg: 0 10px 30px rgba(16, 24, 40, .10);
    --bs-body-font-family: 'Sarabun', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-body-color: var(--sb-text);
    --bs-border-color: var(--sb-border);
    --bs-purple-rgb: 124, 58, 237;
}

html, body { background: var(--sb-bg); }
body { font-size: 15px; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.btn:hover, .nav-link:hover, .card:hover, .dropdown-item:hover { text-decoration: none; }

/* ----- Bootstrap reskin ----- */
.btn { border-radius: 12px; font-weight: 500; }
.btn-sm { border-radius: 10px; }
.btn-lg { border-radius: 14px; }
.btn-primary {
    --bs-btn-bg: var(--sb-primary); --bs-btn-border-color: var(--sb-primary);
    --bs-btn-hover-bg: var(--sb-primary-600); --bs-btn-hover-border-color: var(--sb-primary-600);
    --bs-btn-active-bg: var(--sb-primary-700); --bs-btn-active-border-color: var(--sb-primary-700);
    --bs-btn-disabled-bg: var(--sb-primary); --bs-btn-disabled-border-color: var(--sb-primary);
    --bs-btn-focus-shadow-rgb: var(--sb-primary-rgb);
    box-shadow: 0 4px 12px rgba(var(--sb-primary-rgb), .25);
}
.btn-outline-primary {
    --bs-btn-color: var(--sb-primary); --bs-btn-border-color: var(--sb-primary);
    --bs-btn-hover-bg: var(--sb-primary); --bs-btn-hover-border-color: var(--sb-primary);
    --bs-btn-active-bg: var(--sb-primary); --bs-btn-active-border-color: var(--sb-primary);
    --bs-btn-focus-shadow-rgb: var(--sb-primary-rgb);
}
.btn-check:checked + .btn-outline-primary { background: var(--sb-primary); border-color: var(--sb-primary); }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--sb-border); --bs-btn-hover-bg: #f7f8fa; }
.btn-soft { background: var(--sb-primary-50); color: var(--sb-primary-700); border: 0; }
.btn-soft:hover { background: var(--sb-primary-100); color: var(--sb-primary-700); }
.text-primary { color: var(--sb-primary) !important; }
.bg-primary { background-color: var(--sb-primary) !important; }
.border-primary { border-color: var(--sb-primary) !important; }
.nav-pills { --bs-nav-pills-link-active-bg: var(--sb-primary); }
.nav-pills .nav-link { border-radius: 999px; color: var(--sb-muted); font-weight: 500; padding: .45rem 1rem; }
.nav-pills .nav-link:not(.active):hover { background: #fff; color: var(--sb-text); }
.form-control, .form-select { border-radius: 12px; border-color: #dfe2e8; }
.form-control-sm, .form-select-sm { border-radius: 9px; }
.form-control:focus, .form-select:focus { border-color: var(--sb-primary-200); box-shadow: 0 0 0 .2rem rgba(var(--sb-primary-rgb), .15); }
.form-check-input:checked { background-color: var(--sb-primary); border-color: var(--sb-primary); }
.form-check-input:focus { border-color: var(--sb-primary-200); box-shadow: 0 0 0 .2rem rgba(var(--sb-primary-rgb), .15); }
.form-label { font-weight: 500; font-size: .9rem; margin-bottom: .3rem; color: #374151; }
.input-group-text { border-radius: 12px; border-color: #dfe2e8; }
.badge { font-weight: 500; }
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .7rem .8rem; border-color: #f0f1f4; }
.table thead th { font-weight: 600; font-size: .82rem; color: var(--sb-muted); background: #fafbfc; border-bottom-width: 1px; white-space: nowrap; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--sb-primary-50); }
.page-link { color: var(--sb-primary-600); border-radius: 10px !important; margin: 0 2px; border: 0; }
.active > .page-link { background: var(--sb-primary); }
.dropdown-menu { border: 0; border-radius: 14px; box-shadow: var(--sb-shadow-lg); padding: .4rem; }
.dropdown-item { border-radius: 9px; padding: .5rem .75rem; }
.modal-content { border: 0; border-radius: 20px; }
.modal-header { border-bottom-color: var(--sb-border); }
.modal-footer { border-top-color: var(--sb-border); }
.alert { border: 0; border-radius: 14px; }
.flash-toast-stack .alert:last-child { margin-bottom: 0; }
@media (max-width: 991.98px) {
    .flash-toast-stack {
        position: fixed;
        z-index: 1060;
        left: max(12px, env(safe-area-inset-left));
        right: max(12px, env(safe-area-inset-right));
        bottom: calc(12px + env(safe-area-inset-bottom));
        width: min(420px, calc(100% - 24px));
        margin-inline: auto;
        max-height: 45vh;
        overflow-y: auto;
        filter: drop-shadow(0 8px 18px rgba(16, 24, 40, .2));
    }
    .sb-content .flash-toast-stack { bottom: calc(82px + env(safe-area-inset-bottom)); }
    .flash-toast-stack .alert { margin-bottom: .5rem; }
}
.list-group-item { border-color: #f0f1f4; }

.min-w-0 { min-width: 0 !important; }
.list-link { transition: background .12s; }
.list-link:hover { background: rgba(var(--sb-primary-rgb), .06); }
.list-link:last-child { border-bottom: 0 !important; }
.bg-purple { background-color: #7c3aed !important; color: #fff; }
.bg-purple-subtle { background-color: #f3eefe !important; }
.text-purple-emphasis { color: #5b21b6 !important; }
.border-purple-subtle { border-color: #ddd0fb !important; }

/* ----- แถบไอคอนซ้าย (Navigation rail) ----- */
.sb-rail {
    position: fixed; inset: 0 auto 0 0; width: var(--sb-rail-w); z-index: 1040;
    background: #fff; border-right: 1px solid var(--sb-border);
    display: flex; flex-direction: column; align-items: center;
}
.sb-rail .rail-brand { padding: 14px 0 8px; }
.sb-rail .rail-scroll { flex: 1; overflow-y: auto; width: 100%; padding: 4px 8px; scrollbar-width: none; }
.sb-rail .rail-scroll::-webkit-scrollbar { display: none; }
.rail-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 14px;
    color: #6b7280; font-size: 10.5px; line-height: 1.2; text-align: center; position: relative; margin-bottom: 2px;
}
.rail-item .ri { width: 44px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; transition: background .15s, color .15s; }
.rail-item:hover { color: var(--sb-text); text-decoration: none; }
.rail-item:hover .ri { background: #f4f5f7; }
.rail-item.active { color: var(--sb-primary-700); font-weight: 600; }
.rail-item.active .ri { background: var(--sb-primary-50); color: var(--sb-primary); }
.rail-item .rb { position: absolute; top: 2px; right: 10px; background: #ef4444; color: #fff; border-radius: 999px; font-size: 10px; min-width: 17px; height: 17px; line-height: 17px; padding: 0 4px; font-weight: 600; }
.sb-rail .rail-bottom { width: 100%; padding: 6px 8px 12px; border-top: 1px solid var(--sb-border); }

.sb-logo {
    width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-size: 1.35rem; overflow: hidden;
    background: linear-gradient(135deg, var(--sb-grad-from), var(--sb-grad-to)); box-shadow: 0 6px 14px rgba(var(--sb-primary-rgb), .3);
}
.sb-logo img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.sb-brand-logo { width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, var(--sb-grad-from), var(--sb-grad-to)); display: grid; place-items: center; color: #fff; overflow: hidden; }
.sb-brand-logo img { width: 100%; height: 100%; object-fit: cover; background: #fff; }

.sb-main { margin-left: var(--sb-rail-w); min-height: 100vh; display: flex; flex-direction: column; }
.sb-topbar {
    position: sticky; top: 0; z-index: 1030; height: 62px; background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px); border-bottom: 1px solid var(--sb-border);
    display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem;
}
.sb-topbar .school { font-weight: 700; line-height: 1.15; }
.sb-topbar .school small { display: block; font-weight: 400; color: var(--sb-muted); font-size: .75rem; }
.sb-search-btn {
    display: flex; align-items: center; gap: .6rem; background: #f4f5f7; border: 1px solid transparent; color: #9ca3af;
    border-radius: 999px; padding: .42rem 1rem; min-width: 260px; text-align: left; font-size: .9rem;
}
.sb-search-btn:hover { border-color: var(--sb-border); background: #fff; }
.sb-search-btn kbd { margin-left: auto; background: #fff; color: var(--sb-muted); border: 1px solid var(--sb-border); font-size: .7rem; padding: .05rem .4rem; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #4b5563; font-size: 1.2rem; position: relative; background: transparent; border: 0; }
.icon-btn:hover { background: #f4f5f7; color: var(--sb-text); }
.icon-btn .dot { position: absolute; top: 0; right: -7px; background: #ef4444; color: #fff; font-size: 9.5px; border-radius: 999px; min-width: 16px; height: 16px; line-height: 16px; padding: 0 3px; font-weight: 600; border: 2px solid #fff; box-sizing: content-box; }
/* เต็มความกว้างจอเสมอ (เคยจำกัด 1480px ทำให้จอกว้างเหลือแถบว่างทางขวา) */
.sb-content { padding: 1.4rem 1.6rem; flex: 1; width: 100%; min-width: 0; }

.sb-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--sb-primary-100); color: var(--sb-primary-700); display: inline-grid; place-items: center; font-weight: 700; flex-shrink: 0; overflow: hidden; }
.sb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sb-avatar.lg { width: 84px; height: 84px; font-size: 2rem; }
.sb-avatar.xl { width: 64px; height: 64px; font-size: 1.6rem; }
.sb-avatar.sm { width: 30px; height: 30px; font-size: .82rem; }
.sb-avatar.xs { width: 26px; height: 26px; font-size: .72rem; }
.avatar-stack { display: flex; }
.avatar-stack .sb-avatar { border: 2px solid #fff; margin-left: -8px; }
.avatar-stack .sb-avatar:first-child { margin-left: 0; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-bottom: 1.2rem; }
.page-head h1 { font-size: 1.55rem; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.page-head .sub { color: var(--sb-muted); font-size: .9rem; }
.page-head .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.school-dashboard-hero {
    position: relative; min-height: 270px; margin-bottom: 1.2rem; padding: 2rem 2.2rem;
    align-items: center; overflow: hidden; border-radius: 24px; color: #fff;
    background: radial-gradient(circle at 86% 15%, rgba(var(--sb-primary-rgb), .4), transparent 38%), linear-gradient(120deg, #263451, #493b69 58%, #75446a);
    box-shadow: var(--sb-shadow-lg);
}
.school-dashboard-hero::before, .login-hero::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background-image: radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1px);
    background-size: 24px 24px; mask-image: linear-gradient(90deg, #000, transparent 85%);
}
.school-dashboard-hero-copy { position: relative; z-index: 2; max-width: 52%; }
.school-hero-eyebrow { display: inline-block; color: #ffc7a8; font-size: .7rem; font-weight: 700; letter-spacing: .12em; }
.school-dashboard-hero h1 { font-size: clamp(1.9rem, 3vw, 2.6rem); line-height: 1.2; font-weight: 700; margin: .6rem 0 .35rem; }
.school-dashboard-hero p { color: rgba(255, 255, 255, .82); margin-bottom: 1.2rem; }
.school-dashboard-hero .btn { font-weight: 700; padding: .55rem 1rem; }
.school-dashboard-hero-art { position: absolute; z-index: 1; width: min(54%, 600px); height: auto; right: -2%; bottom: -24%; pointer-events: none; filter: drop-shadow(0 16px 18px rgba(13, 16, 35, .24)); }
.section-hero {
    position: relative; min-height: 200px; display: flex; align-items: center; overflow: hidden;
    padding: 1.6rem 2rem; margin-bottom: 1.2rem; border-radius: 22px; color: #fff;
    background: radial-gradient(circle at 84% 20%, rgba(var(--sb-primary-rgb), .36), transparent 42%), linear-gradient(120deg, #263451, #493b69 62%, #75446a);
    box-shadow: var(--sb-shadow-lg);
}
.section-hero::before { content: ''; position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(rgba(255, 255, 255, .14) 1px, transparent 1px); background-size: 23px 23px; mask-image: linear-gradient(90deg, #000, transparent 88%); }
.section-hero-copy { position: relative; z-index: 2; max-width: 62%; }
.section-hero-eyebrow { color: #ffc7a8; font-size: .68rem; font-weight: 700; letter-spacing: .13em; }
.section-hero h1 { margin: .45rem 0 .35rem; color: #fff; font-size: clamp(1.75rem, 2.6vw, 2.35rem); font-weight: 700; line-height: 1.2; }
.section-hero p { margin: 0; color: rgba(255, 255, 255, .82); font-size: .94rem; }
.section-hero-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.section-hero-actions .btn { font-weight: 600; }
.section-hero-art { position: absolute; z-index: 1; right: -2%; bottom: -15%; width: min(48%, 480px); height: auto; pointer-events: none; filter: drop-shadow(0 14px 20px rgba(12, 16, 35, .2)); }

.card { border: 0; border-radius: var(--sb-radius); box-shadow: var(--sb-shadow); background: var(--sb-card); }
.card-header { background: transparent; border-bottom: 1px solid #f0f1f4; padding: .9rem 1.1rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.card-header .ms-auto { font-weight: 400; }
.card-body { padding: 1.1rem; }
.card-footer { border-top-color: #f0f1f4; }
.card > .table-responsive > .table tr:last-child td { border-bottom: 0; }
a.card:hover { box-shadow: var(--sb-shadow-lg); }
.card-title-sm { font-weight: 700; font-size: .98rem; margin-bottom: .75rem; display: flex; align-items: center; gap: .5rem; }

/* stat tiles */
.stat { display: flex; gap: .9rem; align-items: center; padding: 1rem 1.1rem; }
.stat-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--sb-muted); font-size: .84rem; }
.tint-primary { background: var(--sb-primary-50); color: var(--sb-primary); }
.tint-success { background: #ecfdf5; color: #059669; }
.tint-warning { background: #fffbeb; color: #d97706; }
.tint-danger { background: #fef2f2; color: #dc2626; }
.tint-info { background: #ecfeff; color: #0891b2; }
.tint-purple { background: #f5f3ff; color: #7c3aed; }
.tint-blue { background: #eff6ff; color: #2563eb; }
.tint-teal { background: #f0fdfa; color: #0d9488; }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--sb-muted); }
.empty > i:first-child { width: 64px; height: 64px; display: grid; place-items: center; margin: 0 auto .8rem; border-radius: 20px; background: var(--sb-primary-50); color: var(--sb-primary); font-size: 2rem; }

/* ----- ไอคอนแบบ Super app ----- */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 1.1rem .5rem; }
.app-tile { display: flex; flex-direction: column; align-items: center; gap: .45rem; color: var(--sb-text); font-size: .82rem; text-align: center; line-height: 1.25; position: relative; }
.app-tile:hover { text-decoration: none; color: var(--sb-text); }
.app-tile:hover .app-ico { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(var(--sb-primary-rgb), .3); }
.app-ico {
    width: 56px; height: 56px; border-radius: 17px; display: grid; place-items: center; color: #fff; font-size: 1.5rem;
    background: linear-gradient(145deg, var(--sb-grad-from), var(--sb-grad-to)); box-shadow: 0 6px 14px rgba(var(--sb-primary-rgb), .25);
    transition: transform .15s, box-shadow .15s; position: relative;
}
.app-ico.ico-teal { background: linear-gradient(145deg, #2dd4bf, #0d9488); box-shadow: 0 6px 14px rgba(13, 148, 136, .25); }
.app-ico.ico-blue { background: linear-gradient(145deg, #60a5fa, #2563eb); box-shadow: 0 6px 14px rgba(37, 99, 235, .25); }
.app-ico.ico-slate { background: linear-gradient(145deg, #94a3b8, #475569); box-shadow: 0 6px 14px rgba(71, 85, 105, .2); }
.app-ico .ab { position: absolute; top: -6px; right: -6px; background: #ef4444; color: #fff; border: 2px solid #fff; border-radius: 999px; font-size: 11px; min-width: 21px; height: 21px; line-height: 17px; font-weight: 700; }
.menu-group .card-title-sm { padding-bottom: .75rem; margin-bottom: 1rem; border-bottom: 1px solid var(--sb-border); font-size: 1rem; }
.menu-group .app-tile { padding: .65rem .35rem; border-radius: 14px; transition: background .15s; }
.menu-group .app-tile:hover { background: var(--sb-primary-50); }
.announcement-card { border: 1px solid transparent; transition: border-color .15s, box-shadow .15s, transform .15s; }
.announcement-card:hover { border-color: var(--sb-primary-200); transform: translateY(-2px); }
.m-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem .25rem; }
.m-grid .app-ico { width: 52px; height: 52px; border-radius: 16px; font-size: 1.35rem; }

.chip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.chip { display: flex; align-items: center; gap: .6rem; background: #fff; border-radius: 14px; padding: .7rem .8rem; box-shadow: var(--sb-shadow); color: var(--sb-text); font-weight: 500; font-size: .9rem; }
.chip:hover { color: var(--sb-text); text-decoration: none; box-shadow: var(--sb-shadow-lg); }
.chip i { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-size: 1rem; flex-shrink: 0; }

.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .75rem; }
.quick-action { display: flex; flex-direction: column; align-items: center; gap: .45rem; padding: 1rem .5rem; border-radius: 14px; background: #fff; border: 1px solid var(--sb-border); color: var(--sb-text); font-size: .9rem; text-align: center; }
.quick-action i { font-size: 1.6rem; }
.quick-action:hover { border-color: var(--sb-primary-200); color: var(--sb-text); text-decoration: none; }

/* ----- แดชบอร์ด 3 คอลัมน์ ----- */
.dash { display: grid; gap: 1.1rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; }
@media (min-width: 992px) {
    .dash { grid-template-columns: 290px minmax(0, 1fr); }
    .dash-right { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
    /* ปักคอลัมน์ซ้าย-ขวาไว้ใต้แถบบนขณะเลื่อนฟีดตรงกลาง แทนที่จะเลื่อนหายไปเร็วกว่าฟีด
       ตั้งใจไม่บังคับความสูง/ไม่ตัดเนื้อหาด้วย overflow: เคยลองแล้วพบว่ามันซ่อนการ์ดท้าย ๆ
       (การเงิน/ความประพฤติ/ทางลัด) ไว้หลังเส้นขอบที่มองไม่เห็น ต้องเลื่อนในกรอบแคบ ๆ ถึงจะเจอ
       ซึ่งเข้าใจผิดว่าเนื้อหาหายไปได้ง่ายกว่าการปล่อยให้สูงตามเนื้อหาจริงแล้วเลื่อนไปกับหน้าเว็บตามปกติ */
    .dash-left { position: sticky; top: calc(62px + 1rem); align-self: start; }
}
@media (min-width: 1280px) {
    .dash { grid-template-columns: 290px minmax(0, 1fr) 320px; }
    .dash-right { grid-column: auto; display: flex; position: sticky; top: calc(62px + 1rem); align-self: start; }
}
/* จอกว้าง (Full HD ขึ้นไป): ขยายคอลัมน์ข้างตามจอ ไม่ให้ฟีดตรงกลางยืดยาวเกินไปคนเดียว */
@media (min-width: 1600px) {
    .dash { grid-template-columns: minmax(300px, 20%) minmax(0, 1fr) minmax(340px, 24%); }
}

.profile-card { text-align: left; }
.profile-card .who { display: flex; gap: .8rem; align-items: center; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: 1rem; }
.mini-stats > div { border: 1px solid var(--sb-border); border-radius: 12px; text-align: center; padding: .45rem .25rem; }
.mini-stats b { display: block; font-size: 1.1rem; }
.mini-stats span { font-size: .75rem; color: var(--sb-muted); }
.time-pills { display: grid; grid-template-columns: 1fr auto 1fr; gap: .4rem; align-items: center; margin-top: .75rem; }
.time-pill { background: #f7f8fa; border-radius: 12px; padding: .5rem; text-align: center; font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; justify-content: center; gap: .4rem; }
.time-pill i { color: #fff; background: var(--sb-primary); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; }
.time-pill.out i { background: #3b82f6; }
.time-pill.empty-t { color: #c0c4cc; }

.slot-list { display: flex; flex-direction: column; gap: .4rem; }
.slot-bar { border-radius: 10px; padding: .45rem .7rem; font-size: .86rem; border-left: 4px solid var(--sb-primary); background: var(--sb-primary-50); display: flex; gap: .6rem; align-items: center; }
.slot-bar .t { font-weight: 600; color: var(--sb-muted); width: 44px; flex-shrink: 0; font-size: .8rem; }
.slot-bar.now { background: var(--sb-primary); color: #fff; border-left-color: var(--sb-primary-700); }
.slot-bar.now .t { color: #fff; }
.slot-bar.blue { background: #eff6ff; border-left-color: #3b82f6; }
.slot-bar.gray { background: #f7f8fa; border-left-color: #d1d5db; color: var(--sb-muted); }

.team-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .45rem 0; font-size: .9rem; }

.highlight-card > div { flex: 1; min-width: 0; }
.highlight-card { display: flex; flex-direction: row; gap: .8rem; align-items: flex-start; padding: 1rem; color: var(--sb-text); }
.highlight-card:hover { color: var(--sb-text); }
.highlight-card .hi { width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0; display: grid; place-items: center; color: #fff; font-size: 1.25rem; background: linear-gradient(145deg, var(--sb-grad-from), var(--sb-grad-to)); }

.ring { position: relative; display: inline-grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-bg { stroke: #eef0f3; }
.ring .ring-fg { stroke: var(--ring-color, var(--sb-primary)); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring .ring-label { position: absolute; text-align: center; line-height: 1.1; }
.ring .ring-label b { display: block; font-size: 1.15rem; }
.ring .ring-label span { font-size: .72rem; color: var(--sb-muted); }

/* ----- ฟีดข่าว ----- */
.composer { display: flex; gap: .75rem; align-items: center; }
.composer .fake-input { flex: 1; background: #f4f5f7; border-radius: 999px; padding: .6rem 1rem; color: #9ca3af; cursor: pointer; }
.composer .fake-input:hover { background: #eef0f3; }
.feed-post { padding: 1rem 1.1rem; border-bottom: 1px solid #f0f1f4; }
.feed-post:last-child { border-bottom: 0; }
.fp-head { display: flex; gap: .7rem; align-items: flex-start; }
.fp-head .meta { flex: 1; min-width: 0; font-size: .92rem; }
.fp-head .meta b { font-weight: 600; }
.fp-head .meta .when { color: var(--sb-muted); font-size: .8rem; }
.fp-body { margin: .7rem 0 0 calc(38px + .7rem); }
.fp-text { white-space: pre-line; font-size: .95rem; }
.fp-image { border-radius: 14px; overflow: hidden; background: #f4f5f7; margin-top: .6rem; }
.fp-image img { width: 100%; max-height: 420px; object-fit: cover; display: block; }
.fp-award {
    position: relative; display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 1.1rem; align-items: center;
    min-height: 205px; margin-top: .6rem; border-radius: 18px; padding: 1rem 1.6rem; overflow: hidden;
    background: radial-gradient(circle at 10% 30%, #fff1e8, transparent 37%), linear-gradient(115deg, #fff9f5, #fff4fa 72%, #f9f5ff); border: 1px solid #f6dbe7;
}
.fp-award.gold { background: radial-gradient(circle at 10% 30%, #fff2d8, transparent 37%), linear-gradient(115deg, #fffaf1, #fff6ee 72%, #fff5f9); border-color: #f9e1bb; }
.fp-award-art { position: relative; z-index: 1; width: 170px; height: 170px; }
.fp-award-art > img { width: 100%; height: 100%; object-fit: contain; display: block; }
.fp-award-art .who { position: absolute; bottom: 7px; right: 5px; width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; font-size: .9rem; box-shadow: 0 4px 10px rgba(24, 26, 43, .14); }
.fp-award-copy { position: relative; z-index: 1; min-width: 0; }
.fp-award-eyebrow { display: inline-block; margin-bottom: .45rem; color: #9b4d72; font-size: .76rem; font-weight: 700; letter-spacing: .02em; }
.fp-award .title { font-weight: 700; color: #582c55; font-size: 1.12rem; line-height: 1.4; }
.fp-award .desc { font-size: .9rem; color: #5c6471; margin-top: .3rem; white-space: pre-line; }
.fp-ann { margin-top: .6rem; border-radius: 14px; background: #f7f8fa; padding: .8rem 1rem; display: block; color: var(--sb-text); border-left: 4px solid var(--sb-primary); }
.fp-ann:hover { color: var(--sb-text); text-decoration: none; background: var(--sb-primary-50); }
.fp-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin: .7rem 0 0 calc(38px + .7rem); align-items: center; }
.react-btn { border: 1px solid var(--sb-border); background: #fff; border-radius: 999px; padding: .3rem .7rem; font-size: .82rem; line-height: 1.4; display: inline-flex; align-items: center; gap: .35rem; color: #4b5563; transition: background .15s, border-color .15s, transform .15s; }
.react-btn i { font-size: .98rem; }
.react-like i { color: #387bd1; }
.react-love i { color: #e85b7e; }
.react-applause i { color: #e1a33b; }
.react-celebrate i { color: #8e60d8; }
.react-btn:hover { background: #f7f8fa; border-color: #d8d9e5; transform: translateY(-1px); }
.react-btn:focus-visible { outline: 2px solid var(--sb-primary); outline-offset: 2px; }
.react-btn.mine { background: var(--sb-primary-50); border-color: var(--sb-primary-200); color: var(--sb-primary-700); font-weight: 600; }
.react-btn .n:empty { display: none; }
.feed-tag { display: inline-block; font-size: .72rem; border-radius: 6px; padding: .05rem .4rem; background: #f4f5f7; color: var(--sb-muted); }
@media (max-width: 767.98px) {
    .section-hero { min-height: 180px; padding: 1.25rem 1.4rem; }
    .section-hero-copy { max-width: 100%; }
    .section-hero p { max-width: 75%; }
    .section-hero-art { width: 270px; right: -70px; bottom: -15px; opacity: .42; }
    .fp-award { grid-template-columns: 1fr; gap: 0; padding: 1.1rem; text-align: center; }
    .fp-award-art { width: 142px; height: 142px; margin: 0 auto; }
    .fp-award .title { font-size: 1rem; }
}
@media (max-width: 420px) {
    .react-label { display: none; }
    .fp-body, .fp-actions { margin-left: 0; }
}

/* ----- มือถือ: หัวแอปไล่สี + การ์ดซ้อน ----- */
.m-hero {
    background: linear-gradient(160deg, var(--sb-grad-from), var(--sb-grad-to)); color: #fff;
    margin: -1rem -.9rem 0; padding: 1rem 1.1rem 5.2rem; border-radius: 0 0 26px 26px; position: relative; overflow: hidden;
}
.m-hero::after { content: ''; position: absolute; width: 240px; height: 240px; border-radius: 50%; background: rgba(255, 255, 255, .08); right: -80px; top: -90px; }
.m-hero .top { display: flex; align-items: center; gap: .5rem; position: relative; z-index: 1; }
.m-hero .top .icon-btn { color: #fff; }
.m-hero .top .icon-btn:hover { background: rgba(255, 255, 255, .15); }
.m-hero .top .icon-btn .dot { border-color: var(--sb-grad-to); }
.m-hero .hello { font-size: 1.45rem; font-weight: 700; margin-top: .9rem; position: relative; z-index: 1; }
.m-hero .hello small { display: block; font-size: .85rem; font-weight: 400; opacity: .85; }
.m-hero-art { position: absolute; z-index: 0; width: 235px; height: auto; right: -30px; bottom: -31px; opacity: .55; pointer-events: none; }
@media (min-width: 992px) { .m-hero { margin: 0; border-radius: 22px; } }
.m-float { margin-top: -4.2rem; position: relative; z-index: 2; border-radius: 20px; box-shadow: var(--sb-shadow-lg); }
.m-section { margin-top: 1.2rem; }
.m-section-title { display: flex; align-items: center; justify-content: space-between; font-weight: 700; margin-bottom: .7rem; }
.m-section-title a { font-weight: 500; font-size: .88rem; }
.hscroll { display: flex; gap: .75rem; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex: 0 0 88%; }

/* ----- เช็คชื่อ ----- */
.att-toolbar { position: sticky; top: 62px; z-index: 20; background: var(--sb-bg); padding: .5rem 0 .75rem; }
.att-summary { display: flex; flex-wrap: wrap; gap: .5rem; }
.att-summary .pill { padding: .3rem .75rem; border-radius: 999px; font-size: .86rem; font-weight: 600; }
.att-list { display: grid; gap: .5rem; }
.att-row { display: flex; align-items: center; gap: .8rem; background: #fff; border-radius: 14px; padding: .6rem .8rem; box-shadow: var(--sb-shadow); border: 1.5px solid transparent; transition: border-color .15s, background .15s; }
.att-row.focus { border-color: var(--sb-primary-200); box-shadow: 0 0 0 3px rgba(var(--sb-primary-rgb), .1); }
.att-row .num { width: 2rem; text-align: center; color: var(--sb-muted); font-weight: 600; }
.att-row .who { flex: 1; min-width: 0; }
.att-row .who .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-row .who .meta { font-size: .8rem; color: var(--sb-muted); }
.att-choices { display: flex; gap: .3rem; }
.att-choices input { display: none; }
.att-choices label {
    cursor: pointer; user-select: none; min-width: 52px; text-align: center; padding: .45rem .5rem; border-radius: 11px;
    border: 1.5px solid var(--sb-border); font-size: .88rem; font-weight: 600; color: var(--sb-muted); background: #fff; transition: all .12s;
}
.att-choices label:hover { border-color: #cfd3dc; }
.att-choices input:checked + label.c-present { background: #10b981; border-color: #10b981; color: #fff; }
.att-choices input:checked + label.c-late { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.att-choices input:checked + label.c-absent { background: #ef4444; border-color: #ef4444; color: #fff; }
.att-choices input:checked + label.c-leave { background: #06b6d4; border-color: #06b6d4; color: #fff; }
.att-choices input:checked + label.c-sick { background: #8b5cf6; border-color: #8b5cf6; color: #fff; }
.att-row[data-status="absent"] { background: #fff7f7; }
.att-row[data-status="late"] { background: #fffcf2; }
.att-save-bar { position: sticky; bottom: 0; z-index: 25; background: linear-gradient(to top, var(--sb-bg) 70%, transparent); padding: 1rem 0 .5rem; }

.att-grid { font-size: .82rem; }
.att-grid th, .att-grid td { padding: .3rem .25rem !important; text-align: center; white-space: nowrap; }
.att-grid td.name, .att-grid th.name { text-align: left; position: sticky; left: 0; background: #fff; z-index: 1; min-width: 170px; }
.att-cell { display: inline-block; width: 22px; height: 22px; line-height: 22px; border-radius: 7px; font-weight: 600; font-size: .75rem; }
.att-cell.s-present { background: #d1fae5; color: #047857; }
.att-cell.s-late { background: #fef3c7; color: #b45309; }
.att-cell.s-absent { background: #fee2e2; color: #b91c1c; }
.att-cell.s-leave { background: #cffafe; color: #0e7490; }
.att-cell.s-sick { background: #ede9fe; color: #6d28d9; }

/* ----- ตารางคะแนน ----- */
.gradebook { font-size: .9rem; }
.gradebook th, .gradebook td { vertical-align: middle; }
.gradebook .sticky-col { position: sticky; left: 0; background: #fff; z-index: 2; }
.gradebook thead .sticky-col { background: #fafbfc; z-index: 3; }
.gradebook input.score { width: 68px; text-align: center; border: 1px solid transparent; background: #f4f5f7; border-radius: 9px; padding: .3rem .2rem; font-variant-numeric: tabular-nums; }
.gradebook input.score:focus { outline: none; background: #fff; border-color: var(--sb-primary); box-shadow: 0 0 0 3px rgba(var(--sb-primary-rgb), .15); }
.gradebook input.score.invalid { background: #fee2e2; border-color: #f87171; }
.gradebook input.score.saved { background: #ecfdf5; }
.gradebook td.total { font-weight: 700; font-variant-numeric: tabular-nums; }
.grade-badge { display: inline-block; min-width: 38px; padding: .2rem .4rem; border-radius: 9px; font-weight: 700; text-align: center; }
.save-state { font-size: .85rem; color: var(--sb-muted); }

/* ----- ตารางสอน ----- */
.tt { table-layout: fixed; min-width: 780px; }
.tt th, .tt td { text-align: center; vertical-align: middle; height: 74px; border: 1px solid #f0f1f4 !important; }
.tt th.day { width: 92px; background: #fafbfc; }
.tt .slot { border-radius: 10px; padding: .35rem; font-size: .82rem; line-height: 1.25; height: 100%; display: flex; flex-direction: column; justify-content: center; }
.tt .slot b { font-size: .86rem; }
.tt .slot small { color: var(--sb-muted); }

/* ----- ผู้ปกครอง ----- */
.child-card { border-radius: 20px; overflow: hidden; }
.child-card .head { background: linear-gradient(135deg, var(--sb-grad-from), var(--sb-grad-to)); color: #fff; padding: 1.2rem; display: flex; gap: 1rem; align-items: center; }
.child-card .head .sb-avatar { background: rgba(255, 255, 255, .22); color: #fff; width: 58px; height: 58px; font-size: 1.5rem; }
.today-status { border-radius: 14px; padding: .8rem 1rem; display: flex; align-items: center; gap: .75rem; font-weight: 600; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: .75rem; color: var(--sb-muted); padding: .25rem 0; }
.cal .d { aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; font-size: .85rem; background: #f7f8fa; position: relative; }
.cal .d.weekend { background: transparent; color: #cbd5e1; }
.cal .d.today { outline: 2px solid var(--sb-primary); }
.cal .d.s-present { background: #d1fae5; color: #047857; font-weight: 600; }
.cal .d.s-late { background: #fef3c7; color: #b45309; font-weight: 600; }
.cal .d.s-absent { background: #fee2e2; color: #b91c1c; font-weight: 600; }
.cal .d.s-leave { background: #cffafe; color: #0e7490; font-weight: 600; }
.cal .d.s-sick { background: #ede9fe; color: #6d28d9; font-weight: 600; }
.behavior-meter { height: 10px; border-radius: 999px; background: #eef0f3; overflow: hidden; }
.behavior-meter > span { display: block; height: 100%; border-radius: 999px; }
.child-switch { display: flex; gap: .5rem; overflow-x: auto; }
.child-switch a { display: flex; align-items: center; gap: .4rem; padding: .3rem .8rem .3rem .3rem; border-radius: 999px; background: #fff; box-shadow: var(--sb-shadow); color: var(--sb-text); white-space: nowrap; font-weight: 500; }
.child-switch a.active { background: var(--sb-primary); color: #fff; }
.child-switch a.active .sb-avatar { background: rgba(255, 255, 255, .25); color: #fff; }

/* ----- แจ้งเตือน ----- */
.noti { display: flex; gap: .8rem; padding: .85rem 1rem; border-bottom: 1px solid #f0f1f4; color: var(--sb-text); align-items: flex-start; }
.noti:hover { background: #fafbfc; color: var(--sb-text); text-decoration: none; }
.noti.unread { background: var(--sb-primary-50); }
.noti .ni { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; font-size: 1.1rem; }
.noti .when { font-size: .78rem; color: var(--sb-muted); white-space: nowrap; }

/* ----- ค้นหา ----- */
#searchModal .modal-content { border-radius: 18px; overflow: hidden; }
#searchModal .search-input { border: 0; font-size: 1.1rem; padding: 1rem 1.1rem; box-shadow: none; }
#searchResults a { display: flex; gap: .75rem; align-items: center; padding: .65rem 1.1rem; color: var(--sb-text); border-top: 1px solid #f0f1f4; }
#searchResults a:hover, #searchResults a.active { background: var(--sb-primary-50); text-decoration: none; }
#searchResults .t { font-size: .72rem; color: var(--sb-muted); background: #f4f5f7; border-radius: 6px; padding: .1rem .45rem; }

/* ----- ธีมสี (หน้าตั้งค่า) ----- */
.swatches { display: flex; flex-wrap: wrap; gap: .5rem; }
.swatch { width: 38px; height: 38px; border-radius: 12px; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--sb-border); cursor: pointer; padding: 0; }
.swatch.active { box-shadow: 0 0 0 2px var(--sb-text); }

/* ----- Login ----- */
.login-wrap { width: min(1180px, calc(100% - 48px)); min-height: max(680px, calc(100vh - 80px)); margin: 40px auto; display: grid; grid-template-columns: 1.1fr 1fr; overflow: hidden; border-radius: 32px; box-shadow: 0 28px 70px rgba(39, 33, 70, .16); }
.login-hero { background: radial-gradient(circle at 80% 72%, rgba(var(--sb-primary-rgb), .55), transparent 38%), linear-gradient(145deg, #273450, #533b6c 68%, #75446a); color: #fff; padding: 2.5rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-hero::after { content: ''; position: absolute; width: 400px; height: 400px; border-radius: 50%; background: rgba(255, 255, 255, .06); right: -140px; bottom: -120px; }
.login-hero-brand, .login-hero-copy, .login-hero-footer { position: relative; z-index: 2; }
.login-hero-copy { position: absolute; top: 135px; left: 2.5rem; max-width: 510px; }
.login-hero-copy h2 { font-size: clamp(2rem, 3.1vw, 2.7rem); line-height: 1.18; }
.login-hero-copy p { max-width: 360px; color: rgba(255, 255, 255, .8); }
.login-hero-art { position: absolute; z-index: 1; width: min(100%, 570px); height: auto; right: -8%; bottom: 0; pointer-events: none; filter: drop-shadow(0 18px 22px rgba(15, 13, 31, .2)); }
.login-hero-footer { display: flex; flex-wrap: wrap; max-width: 310px; gap: .4rem .8rem; font-size: .74rem; color: rgba(255, 255, 255, .9); }
.login-hero-footer i { color: #ffc2a4; margin-right: .2rem; }
.login-form { display: grid; place-items: center; padding: 2rem; background: #fff; }
.login-form .inner { width: 100%; max-width: 380px; }

/* ----- แถบเมนูล่าง (มือถือ) ----- */
.sb-bottom-nav { display: none; }
@media (max-width: 991.98px) {
    .sb-rail { display: none; }
    .sb-main { margin-left: 0; }
    .sb-topbar { padding: 0 .9rem; height: 58px; }
    .sb-search-btn { min-width: 0; flex: 1; }
    .sb-search-btn kbd, .sb-search-btn span { display: none; }
    .sb-search-btn { flex: 0 0 auto; width: 40px; height: 40px; padding: 0; justify-content: center; background: transparent; font-size: 1.15rem; color: #4b5563; }
    body.has-hero .sb-topbar { display: none; }
    .sb-content { padding: 1rem .9rem 6rem; }
    .sb-bottom-nav {
        display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; background: #fff;
        box-shadow: 0 -4px 20px rgba(16, 24, 40, .06); padding-bottom: env(safe-area-inset-bottom); border-radius: 20px 20px 0 0;
    }
    .sb-bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: .55rem 0 .5rem; font-size: .7rem; color: #9ca3af; position: relative; }
    .sb-bottom-nav a:hover { text-decoration: none; }
    .sb-bottom-nav i { font-size: 1.35rem; }
    .sb-bottom-nav .active { color: var(--sb-primary); font-weight: 600; }
    .sb-bottom-nav .center { gap: 4px; }
    .sb-bottom-nav .center i { width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; color: #fff; margin-top: -24px; flex-shrink: 0; background: linear-gradient(145deg, var(--sb-grad-from), var(--sb-grad-to)); box-shadow: 0 8px 18px rgba(var(--sb-primary-rgb), .4); }
    .sb-bottom-nav .dot { position: absolute; top: 3px; left: 54%; background: #ef4444; color: #fff; font-size: .62rem; border-radius: 999px; padding: 0 .35rem; font-weight: 700; }
    .att-save-bar { bottom: 64px; }
    .att-toolbar { top: 58px; }
    .login-wrap { width: 100%; min-height: 100vh; margin: 0; grid-template-columns: 1fr; grid-template-rows: 210px 1fr; border-radius: 0; box-shadow: none; }
    .login-hero { padding: 1.3rem 1.5rem; }
    .login-hero-brand { gap: .6rem !important; }
    .login-hero-brand .sb-brand-logo { width: 36px !important; height: 36px !important; font-size: 1.1rem !important; }
    .login-hero-brand .fs-5 { font-size: 1rem !important; }
    .login-hero-brand .small, .login-hero-footer, .login-hero-copy p, .login-hero-copy .school-hero-eyebrow { display: none; }
    .login-hero-copy { position: relative; top: auto; left: auto; align-self: auto; margin: 0; max-width: 58%; }
    .login-hero-copy h2 { font-size: 1.35rem; line-height: 1.3; margin-bottom: 0 !important; }
    .login-hero-art { width: 280px; right: -38px; bottom: -40px; }
    .login-form { padding: 2rem 1.25rem; }
    .mobile-login-brand { display: none; }
    .page-head h1 { font-size: 1.25rem; }
    .fp-body, .fp-actions { margin-left: 0; }
}
@media (max-width: 575.98px) {
    .att-row { flex-wrap: wrap; }
    .att-row .who { flex-basis: calc(100% - 3rem); }
    .att-choices { width: 100%; }
    .att-choices label { flex: 1; min-width: 0; padding: .55rem .2rem; }
    .stat-value { font-size: 1.3rem; }
}

/* ----- พิมพ์ ----- */
.print-only { display: none; }
@media print {
    .sb-rail, .sb-topbar, .sb-bottom-nav, .no-print, .alert { display: none !important; }
    .sb-main { margin: 0; }
    .sb-content { padding: 0; max-width: none; }
    .card { box-shadow: none; }
    .print-only { display: block; }
    body { background: #fff; font-size: 13px; }
    @page { size: A4; margin: 12mm; }
}

/* ---------------- ตรวจข้อสอบ (ScanGrade) ---------------- */
.key-grid { columns: 180px; column-gap: 1.25rem; outline: none; }
.kg-row { display: flex; align-items: center; gap: .3rem; padding: .18rem .35rem; border-radius: 10px; break-inside: avoid; cursor: pointer; }
.kg-row.cur { background: rgba(var(--sb-primary-rgb), .1); box-shadow: inset 0 0 0 1.5px rgba(var(--sb-primary-rgb), .45); }
.kg-row.empty .kg-no { color: #d97706; }
.kg-gap { height: .45rem; break-inside: avoid; }
.kg-no { width: 1.9rem; text-align: right; font-weight: 700; font-size: .85rem; color: var(--sb-muted); margin-right: .15rem; }
.kb { width: 1.85rem; height: 1.85rem; border-radius: 50%; border: 1.5px solid #cbd0d8; background: #fff; font-size: .8rem; color: #8a93a2; padding: 0; line-height: 1; }
.kb:hover { border-color: var(--sb-primary); color: var(--sb-primary); }
.kb.on { background: var(--sb-primary); border-color: var(--sb-primary); color: #fff; font-weight: 700; }
.kg-x { border: 0; background: none; color: #c3c8d0; padding: 0 .15rem; font-size: .85rem; }
.kg-row.canc .kb { opacity: .3; }
.kg-row.canc .kg-no { text-decoration: line-through; }
.kg-row.canc .kg-x { color: #dc2626; }
.key-footer { position: sticky; bottom: 0; z-index: 2; border-top: 1px solid var(--sb-border); }
@media (max-width: 991.98px) { .key-footer { bottom: 70px; } }

.r-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; }
.r-grid span { border-radius: 8px; background: #f1f3f6; text-align: center; font-size: .66rem; color: #6b7280; padding: 2px 0; line-height: 1.15; }
.r-grid span b { display: block; font-size: .9rem; color: #111827; }
.r-grid span.y { background: #dcfce7; } .r-grid span.y b { color: #15803d; }
.r-grid span.n { background: #fee2e2; } .r-grid span.n b { color: #b91c1c; }
.r-grid span.m { background: #fef3c7; } .r-grid span.m b { color: #b45309; }
.r-grid span.c { background: #e5e7eb; text-decoration: line-through; }
.r-grid.sm { grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); }

.sg-toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: #111827; color: #fff; padding: .6rem 1rem; border-radius: 12px; font-size: .92rem; max-width: 92vw; opacity: 0; pointer-events: none; transition: .2s; z-index: 2000; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.sg-toast.show { opacity: 1; transform: translate(-50%, 0); }
.sg-toast.bad { background: #b91c1c; }

.sheet-preview { background: #eef0f3; padding: 1rem; display: flex; justify-content: center; overflow: auto; max-height: 78vh; }
.sheet-preview svg { width: 100%; max-width: 560px; height: auto; box-shadow: 0 4px 20px rgba(0,0,0,.12); background: #fff; }
#printArea { display: none; }
@media print {
    @page { size: A4; margin: 0; }
    body.printing-omr > *:not(#printArea) { display: none !important; }
    body.printing-omr #printArea { display: block !important; }
    #printArea .omr-page { width: 210mm; height: 297mm; page-break-after: always; break-after: page; overflow: hidden; }
    #printArea .omr-page:last-child { page-break-after: auto; break-after: auto; }
    #printArea svg { width: 210mm; height: 297mm; display: block; }
}

.review-sheet { position: relative; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--sb-shadow); }
.review-sheet img, .review-sheet svg { width: 100%; display: block; height: auto; }
.review-sheet > svg { position: absolute; inset: 0; height: 100%; }
.review-sheet .ov { cursor: pointer; }
.legend-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; vertical-align: -1px; }
.evana-table tr.item-first > td { border-top: 2px solid #e5e7eb; }
.evana-table td { font-variant-numeric: tabular-nums; }

/* ---------------- ตั้งค่าฟอร์มรับสมัคร ---------------- */
.q-card { border: 1px solid var(--sb-border); border-radius: 14px; padding: .85rem; margin-bottom: .75rem; background: #fff; }
.q-card:focus-within { border-color: var(--sb-primary-200); box-shadow: 0 0 0 .2rem rgba(var(--sb-primary-rgb), .08); }
.q-no { width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--sb-primary-50); color: var(--sb-primary-700); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.builder-preview { position: sticky; top: calc(62px + 1rem); max-height: calc(100vh - 62px - 2rem); overflow: auto; }
.builder-savebar { position: sticky; bottom: 1rem; z-index: 5; margin-top: 1rem; }
@media (max-width: 991.98px) { .builder-savebar { bottom: 80px; } .builder-preview { position: static; max-height: none; } }

/* ---------------- สมัครเรียนแบบหลายขั้นตอน ---------------- */
.apply-steps { list-style: none; padding: .6rem; margin: 0; display: flex; gap: .3rem; overflow-x: auto; background: #fff; border-radius: 16px; box-shadow: var(--sb-shadow); scrollbar-width: none; }
.apply-steps::-webkit-scrollbar { display: none; }
.apply-steps li { flex: 1 0 auto; }
.apply-steps a { display: flex; align-items: center; gap: .4rem; padding: .35rem .6rem; border-radius: 12px; color: var(--sb-muted); font-size: .85rem; white-space: nowrap; text-decoration: none; }
.apply-steps .n { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; background: #eef0f3; font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.apply-steps li.done .n { background: #dcfce7; color: #15803d; }
.apply-steps li.cur a { background: var(--sb-primary-50); color: var(--sb-primary-700); font-weight: 600; }
.apply-steps li.cur .n { background: var(--sb-primary); color: #fff; }
@media (max-width: 575.98px) { .apply-steps li:not(.cur) .t { display: none; } }
