/* ===== ระบบบริหารโรงเรียน — Super App 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; }
/* ---------------- แจ้งเตือนแบบป๊อปอัป (partials/flash) ---------------- */
.sb-toasts { position: fixed; z-index: 1080; top: 76px; right: 20px; width: min(380px, calc(100vw - 24px)); display: flex; flex-direction: column; gap: .6rem; pointer-events: none; }
.sb-toast {
    pointer-events: auto; position: relative; overflow: hidden; display: flex; align-items: flex-start; gap: .75rem;
    background: var(--sb-card); color: var(--sb-text); border: 1px solid var(--sb-border); border-radius: 16px; padding: .85rem .9rem .95rem;
    box-shadow: 0 18px 40px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .06);
    opacity: 0; transform: translateX(24px) scale(.97); transition: opacity .25s ease, transform .3s cubic-bezier(.2, .9, .3, 1.2);
    --tone: #16a34a; --tone-bg: #dcfce7;
}
.sb-toast.show { opacity: 1; transform: none; }
.sb-toast.hide { opacity: 0; transform: translateX(24px) scale(.97); }
.sb-toast.warning { --tone: #d97706; --tone-bg: #fef3c7; }
.sb-toast.danger { --tone: #dc2626; --tone-bg: #fee2e2; }
.sb-toast .ic { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; color: var(--tone); background: var(--tone-bg); }
.sb-toast .tx { flex: 1; min-width: 0; font-size: .9rem; line-height: 1.45; overflow-wrap: anywhere; }
.sb-toast .tx b { display: block; font-size: .95rem; }
.sb-toast .tx ul { margin: .15rem 0 0; padding-left: 1.1rem; max-height: 40vh; overflow-y: auto; }
.sb-toast .x { flex: none; border: 0; background: transparent; color: var(--sb-muted); width: 28px; height: 28px; border-radius: 8px; line-height: 1; }
.sb-toast .x:hover { background: rgba(16, 24, 40, .06); color: var(--sb-text); }
.sb-toast .bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--tone); transform-origin: left; animation: sb-toast-bar linear forwards; animation-duration: var(--life, 5s); }
.sb-toast:hover .bar { animation-play-state: paused; }
@keyframes sb-toast-bar { to { transform: scaleX(0); } }
@media (max-width: 991.98px) {
    /* จอเล็ก: ลอยเหนือแถบเมนูล่าง */
    .sb-toasts { top: auto; right: 12px; left: 12px; width: auto; max-width: 420px; margin-inline: auto; bottom: calc(86px + env(safe-area-inset-bottom)); flex-direction: column-reverse; }
    .sb-toast, .sb-toast.hide { transform: translateY(16px) scale(.97); }
    .sb-toast.show { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .sb-toast { transition: opacity .2s; transform: none !important; } }
.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-demo-bar { position: sticky; top: 0; z-index: 1035; display: flex; align-items: center; gap: .5rem; height: 32px; padding: 0 1rem; background: #fef3c7; color: #78350f; font-size: .82rem; border-bottom: 1px solid #fde68a; }
.sb-demo-bar .txt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-demo-bar button { border: 0; background: #fff; color: #78350f; border-radius: 999px; padding: .05rem .7rem; font-size: .78rem; font-weight: 600; white-space: nowrap; box-shadow: inset 0 0 0 1px #fcd34d; }
.sb-demo-bar + .sb-topbar { top: 32px; }
@media (max-width: 575.98px) { .sb-demo-bar { padding: 0 .7rem; } .sb-demo-bar .more { display: none; } }

.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%; }
/* การ์ดบุตรหลาน: เรียงให้เห็นครบทุกใบทุกขนาดจอ (ไม่พอก็ขึ้นแถวใหม่) แทนการปัดซ้าย-ขวาที่ดูเหมือนแสดงไม่หมด */
.hscroll-fit { flex-wrap: wrap; overflow: visible; }
.hscroll-fit > * { flex: 1 1 260px; min-width: 0; }

/* ----- เช็คชื่อ ----- */
.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, .sb-toasts { 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: 14mm 12mm 12mm; }
    /* เอกสาร ปพ.: หนึ่งการ์ด = หนึ่งหน้ากระดาษ */
    .doc-page { border: 0; margin-top: 0 !important; break-after: page; }
    .doc-page:last-of-type { break-after: auto; }
    .doc-page .card-body { padding: 0 !important; }
    .doc-page .table { margin-bottom: .4rem !important; }
    .doc-page .table > :not(caption) > * > * { padding: .12rem .4rem; line-height: 1.35; }
    .doc-page .mt-4, .doc-page .mt-5 { margin-top: .9rem !important; }
    .doc-page .mb-3, .doc-page .mb-4 { margin-bottom: .5rem !important; }
}

/* ---------------- ตรวจข้อสอบ (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 {
    /* ขอบ 0 ของกระดาษคำตอบใส่ตอนสั่งพิมพ์ใน scangrade/sheet.js เท่านั้น — ใส่ @page ตรงนี้จะทับขอบกระดาษของทุกหน้า */
    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; } }

/* ---------------- รูปรายการ (วัสดุ / ห้อง / รถ) ---------------- */
.media-thumb { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; flex-shrink: 0; background: var(--sb-primary-50); color: var(--sb-primary); display: grid; place-items: center; font-size: 1.4rem; overflow: hidden; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-thumb.lg { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 16px; font-size: 3rem; }
.photo-drop { position: relative; border: 2px dashed #d7dbe2; border-radius: 16px; aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden; background: #fafbfc; cursor: pointer; transition: border-color .15s; }
.photo-drop:hover { border-color: var(--sb-primary-200); }
.photo-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-drop .hint { text-align: center; color: var(--sb-muted); font-size: .85rem; padding: 1rem; }
.photo-drop .hint i { font-size: 2.2rem; display: block; color: var(--sb-primary); margin-bottom: .3rem; }
.photo-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tag-list { display: flex; flex-wrap: wrap; gap: .3rem; }
.tag-list span { background: #f1f3f6; border-radius: 999px; padding: .1rem .6rem; font-size: .76rem; color: #4b5563; }

/* การ์ดแคตตาล็อก (เลือกห้อง/รถ · เลือกวัสดุ) */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; }
.pick-card { position: relative; background: #fff; border-radius: 16px; box-shadow: var(--sb-shadow); overflow: hidden; display: flex; flex-direction: column; border: 2px solid transparent; transition: border-color .15s, box-shadow .15s, transform .15s; }
.pick-card:hover { box-shadow: var(--sb-shadow-lg); transform: translateY(-1px); }
.pick-card .pc-img { aspect-ratio: 4 / 3; background: var(--sb-primary-50); color: var(--sb-primary); display: grid; place-items: center; font-size: 2.6rem; overflow: hidden; }
.pick-card .pc-img img { width: 100%; height: 100%; object-fit: cover; }
.pick-card .pc-body { padding: .65rem .8rem .8rem; display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.pick-card .pc-title { font-weight: 600; line-height: 1.3; }
.pick-card .pc-meta { font-size: .8rem; color: var(--sb-muted); }
.pick-card.selected, .pick-card:has(input:checked) { border-color: var(--sb-primary); box-shadow: 0 0 0 .2rem rgba(var(--sb-primary-rgb), .15); }
.pick-card.disabled { opacity: .55; }
.pick-card .pc-badge { position: absolute; top: .5rem; left: .5rem; }
.pick-card label.stretched { position: absolute; inset: 0; cursor: pointer; }
.side-sticky { position: sticky; top: 84px; }
@media (max-width: 991.98px) { .side-sticky { position: static; } }
.qty-stepper { display: inline-flex; align-items: center; border: 1px solid #dfe3ea; border-radius: 10px; overflow: hidden; }
.qty-stepper button { border: 0; background: #f6f7f9; width: 30px; height: 32px; }
.qty-stepper input { width: 52px; border: 0; text-align: center; height: 32px; -moz-appearance: textfield; }
.qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.day-slots {
    position: relative; background-color: #f1f3f6; border-radius: 10px; padding: 4px 0; overflow: hidden;
    /* เส้นแบ่งทุก 3 ชั่วโมง ตรงกับป้ายเวลาด้านล่าง (06–21 = 5 ช่อง) */
    background-image: linear-gradient(to right, rgba(15, 23, 42, .09) 1px, transparent 1px); background-size: 20% 100%;
}
.day-slots .ds-lane { position: relative; height: 24px; }
.day-slots .ds-lane + .ds-lane { margin-top: 4px; }
.day-slots .ds {
    position: absolute; top: 0; bottom: 0; border-radius: 6px; font-size: .7rem; line-height: 20px; padding: 0 .35rem;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    background: rgba(220, 38, 38, .2); border-left: 3px solid #dc2626; color: #991b1b;
}
.day-slots .ds.pending { background: rgba(217, 119, 6, .2); border-left-color: #d97706; color: #92400e; }
.day-slots .ds.mine { background: rgba(124, 58, 237, .18); border-left-color: #7c3aed; color: #5b21b6; }
/* ช่วงที่กำลังเลือก: กรอบเส้นประ แถวล่าง · ชนกับที่จองไว้ = แดงลายทาง */
.day-slots .ds.pick { background: rgba(37, 99, 235, .1); border: 2px dashed #2563eb; line-height: 18px; color: #1e40af; font-weight: 600; }
.day-slots .ds.pick.clash { background: repeating-linear-gradient(45deg, rgba(220, 38, 38, .2) 0 6px, rgba(220, 38, 38, .06) 6px 12px); border-color: #dc2626; color: #991b1b; }
.ds-legend { display: flex; flex-wrap: wrap; gap: .25rem .8rem; font-size: .72rem; color: var(--bs-secondary-color); margin-top: .35rem; }
.ds-legend i { display: inline-block; width: 12px; height: 10px; border-radius: 3px; margin-right: .25rem; vertical-align: -1px; }
.ds-legend .l-booked { background: rgba(220, 38, 38, .35); border-left: 3px solid #dc2626; }
.ds-legend .l-pending { background: rgba(217, 119, 6, .35); border-left: 3px solid #d97706; }
.ds-legend .l-mine { background: rgba(124, 58, 237, .3); border-left: 3px solid #7c3aed; }
.ds-legend .l-pick { background: rgba(37, 99, 235, .12); border: 2px dashed #2563eb; }
.slot-scale { display: flex; justify-content: space-between; font-size: .7rem; color: var(--sb-muted); margin-top: .2rem; }
.pick-card.compact .pc-img { aspect-ratio: 16 / 10; font-size: 2.2rem; }
.panel-photo { height: 190px; display: grid; place-items: center; background: var(--sb-primary-50); color: var(--sb-primary); font-size: 3rem; overflow: hidden; border-radius: 16px 16px 0 0; }
.panel-photo img { width: 100%; height: 100%; object-fit: cover; }

/* ===== ตารางรายการ → การ์ดในมือถือ (เพิ่ม class table-cards ที่ <table>; app.js ใส่ป้ายหัวคอลัมน์ให้ทุกช่อง) =====
   td.tc-title = หัวการ์ด (ขึ้นบนสุด ตัวหนา) · td.tc-hide = ซ่อนในมือถือ */
@media screen and (max-width: 767.98px) {
    .table-cards, .table-cards > tbody, .table-cards > tfoot { display: block; width: 100%; }
    .table-cards { border: 0 !important; background: transparent; margin-bottom: 0; }
    .table-cards > thead { display: none; }
    .table-cards > tbody > tr, .table-cards > tfoot > tr {
        display: flex; flex-direction: column; background: var(--bs-body-bg);
        border: 1px solid var(--bs-border-color-translucent); border-radius: 14px;
        padding: .65rem .9rem; margin-bottom: .6rem; box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    }
    .table-cards > :not(caption) > tr > td, .table-cards > :not(caption) > tr > th {
        display: block; width: 100% !important; border: 0 !important; padding: .2rem 0;
        background: transparent !important; box-shadow: none !important; text-align: left !important;
    }
    .table-cards > :not(caption) > tr > [data-label] { position: relative; padding-left: 38%; min-height: 1.6em; }
    .table-cards > :not(caption) > tr > [data-label]::before {
        content: attr(data-label); position: absolute; left: 0; top: .25rem; width: 35%;
        color: var(--bs-secondary-color); font-size: .82rem; font-weight: 400; line-height: 1.35;
    }
    .table-cards > :not(caption) > tr > .tc-title { order: -1; padding-left: 0; font-weight: 600; font-size: 1.02rem; margin-bottom: .2rem; }
    .table-cards > :not(caption) > tr > .tc-title::before { display: none; }
    .table-cards > :not(caption) > tr > .tc-hide { display: none !important; }
    .table-cards > :not(caption) > tr > td:empty { display: none; }
    .table-cards .text-nowrap { white-space: normal !important; }
    .table-cards input.form-control, .table-cards select.form-select { max-width: 160px; }
    /* การ์ดที่ห่อตารางไม่ต้องมีกรอบซ้อน */
    .card:has(> .table-responsive > .table-cards), .card:has(> .table-cards) { background: transparent; border: 0; box-shadow: none; }
    .card:has(> .table-responsive > .table-cards) > .card-header, .card:has(> .table-cards) > .card-header { background: transparent; padding-left: .2rem; border: 0; }
    .table-responsive:has(> .table-cards) { overflow: visible; }
    .doc-page .row > .col-4 { flex: 0 0 100%; max-width: 100%; }
}
/* ตัวเลขยาว (มูลค่าเป็นบาท) ในกล่องสถิติแคบ ๆ ไม่ดันจอให้กว้างเกิน */
.stat > div:last-child { min-width: 0; }
.stat-value { overflow-wrap: anywhere; }

/* ===== ห้องสมุด: ป้ายสัน / บาร์โค้ด (ขนาดจริงเป็นมิลลิเมตร ใช้ทั้งตัวอย่างบนจอและพิมพ์) ===== */
.spine { width: 25mm; height: 40mm; border: .3mm solid #222; border-radius: 1.2mm; background: #fff; color: #000; display: flex; flex-direction: column; overflow: hidden; flex-shrink: 0; }
.spine .band { height: 5.5mm; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 7.5pt; font-weight: 700; letter-spacing: .3px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.spine .lines { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; font-weight: 700; font-size: 11pt; line-height: 1.22; padding: 0 1mm; word-break: break-all; }
.spine.no-band .band { display: none; }
.spine.big { zoom: 1.55; }
.lbl-outer { width: 50mm; height: 25mm; border: .3mm solid #222; border-radius: 1.2mm; background: #fff; color: #000; padding: 1.4mm 2.5mm 1mm; display: flex; flex-direction: column; overflow: hidden; }
.lbl-outer .t { font-size: 6.2pt; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbl-outer .barcode { width: 100%; height: 11mm; display: block; margin: .6mm 0 .3mm; }
.lbl-outer .code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 8.5pt; font-weight: 700; text-align: center; letter-spacing: 1px; line-height: 1; }
.lbl-inner { width: 70mm; height: 40mm; border: .3mm solid #222; border-radius: 1.2mm; background: #fff; color: #000; padding: 2mm 3mm; display: flex; flex-direction: column; overflow: hidden; font-size: 7.5pt; line-height: 1.3; }
.lbl-inner .head { display: flex; justify-content: space-between; gap: 2mm; font-size: 6.5pt; color: #333; }
.lbl-inner .title { font-weight: 700; font-size: 8.5pt; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: .6mm 0; }
.lbl-inner .barcode { width: 100%; height: 10mm; display: block; }
.lbl-inner .code { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; text-align: center; letter-spacing: 1px; font-size: 8pt; }
.lbl-inner .meta { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 0 1.5mm; margin-top: auto; }
.lbl-inner .meta b { font-weight: 700; }
.label-sheet { width: 190mm; display: grid; gap: 2mm; margin: 0 auto 6mm; align-content: start; }
.label-sheet.spine-sheet { grid-template-columns: repeat(7, 25mm); row-gap: 2.5mm; column-gap: 2.5mm; }
.label-sheet.outer-sheet { grid-template-columns: repeat(3, 50mm); column-gap: 8mm; row-gap: 2.5mm; }
.label-sheet.inner-sheet { grid-template-columns: repeat(2, 70mm); column-gap: 10mm; row-gap: 4mm; }
.label-sheet .blank { visibility: hidden; }
.label-sheet.no-cut .spine, .label-sheet.no-cut .lbl-outer, .label-sheet.no-cut .lbl-inner { border-color: transparent; }
.label-paper { background: #fff; box-shadow: 0 2px 10px rgba(15, 23, 42, .12); padding: 10mm; width: 210mm; min-height: 297mm; margin: 0 auto 6mm; }
@media screen and (max-width: 900px) { .label-paper { zoom: .45; } }
@media print {
    .label-paper { box-shadow: none; padding: 0; margin: 0; width: auto; min-height: 0; break-after: page; }
    .label-paper:last-child { break-after: auto; }
}

/* ===== คู่มือการใช้งาน ===== */
.manual-body { font-size: 1rem; line-height: 1.75; }
.manual-body p { margin-bottom: .75rem; }
.manual-section { scroll-margin-top: 90px; padding-top: .25rem; margin-bottom: 1.75rem; }
.manual-section h2 { font-size: 1.22rem; font-weight: 700; margin: .5rem 0 .75rem; padding-bottom: .4rem; border-bottom: 1px solid var(--bs-border-color); position: relative; }
.manual-section h3 { font-size: 1.05rem; font-weight: 700; margin: 1.1rem 0 .5rem; }
.manual-anchor { position: absolute; left: -1.1rem; opacity: 0; color: var(--sb-primary); text-decoration: none; }
.manual-section h2:hover .manual-anchor { opacity: .7; }
.manual-steps { counter-reset: step; list-style: none; padding-left: 0; margin: .5rem 0 1rem; }
.manual-steps > li { counter-increment: step; position: relative; padding: .1rem 0 .55rem 2.6rem; min-height: 2rem; }
.manual-steps > li::before { content: counter(step); position: absolute; left: 0; top: .1rem; width: 1.85rem; height: 1.85rem; border-radius: 50%; background: var(--sb-primary); color: #fff; font-weight: 700; font-size: .9rem; display: grid; place-items: center; }
.manual-steps > li:not(:last-child)::after { content: ''; position: absolute; left: .9rem; top: 2.05rem; bottom: .1rem; width: 2px; background: var(--bs-border-color); }
.manual-body .ui { display: inline-block; background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color); border-radius: 6px; padding: 0 .4rem; font-weight: 600; font-size: .92em; line-height: 1.55; white-space: nowrap; }
.manual-body kbd { font-size: .82em; }
.manual-body ul { padding-left: 1.3rem; margin-bottom: .8rem; }
.manual-body ul > li { margin-bottom: .2rem; }
.manual-body table { font-size: .93rem; }
.manual-callout { border-radius: 12px; padding: .7rem .95rem; margin: .8rem 0 1rem; border: 1px solid; }
.manual-callout .mc-title { font-weight: 700; font-size: .9rem; margin-bottom: .15rem; }
.manual-callout.tip { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.manual-callout.warn { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.manual-callout.note { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.manual-go { margin: .15rem .25rem .6rem 0; }
.manual-link { font-weight: 600; text-decoration: none; white-space: nowrap; }
.manual-faq { border: 1px solid var(--bs-border-color); border-radius: 12px; padding: .65rem .95rem; margin-bottom: .55rem; background: var(--bs-body-bg); }
.manual-faq summary { font-weight: 600; cursor: pointer; }
.manual-faq[open] summary { margin-bottom: .4rem; color: var(--sb-primary-700); }
.manual-toc a { display: block; padding: .3rem .6rem; border-radius: 8px; color: var(--bs-body-color); text-decoration: none; font-size: .9rem; }
.manual-toc a:hover { background: var(--bs-tertiary-bg); }
.manual-toc a.active { background: var(--sb-primary-100); color: var(--sb-primary-700); font-weight: 600; }
.manual-toc .grp { font-size: .72rem; text-transform: uppercase; letter-spacing: .4px; color: var(--bs-secondary-color); margin: .7rem .6rem .2rem; font-weight: 700; }
.manual-onpage a { display: inline-block; margin: 0 .35rem .35rem 0; padding: .15rem .6rem; border-radius: 999px; border: 1px solid var(--bs-border-color); font-size: .85rem; text-decoration: none; color: var(--bs-body-color); }
.manual-onpage a:hover { border-color: var(--sb-primary); color: var(--sb-primary-700); }
.manual-card { display: flex; gap: .8rem; padding: .9rem; border: 1px solid var(--bs-border-color); border-radius: 14px; background: var(--bs-body-bg); text-decoration: none; color: var(--bs-body-color); height: 100%; transition: border-color .15s, box-shadow .15s; }
.manual-card:hover { border-color: var(--sb-primary); box-shadow: 0 4px 14px rgba(15, 23, 42, .06); }
.manual-card .mi { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--sb-primary-100); color: var(--sb-primary-700); font-size: 1.2rem; flex-shrink: 0; }
.manual-card .mt { font-weight: 700; line-height: 1.3; }
.manual-card .ms { font-size: .85rem; color: var(--bs-secondary-color); line-height: 1.45; margin-top: .15rem; }
.manual-hit mark { background: #fde68a; padding: 0 .1rem; border-radius: 3px; }
@media print {
    .manual-body { font-size: 10.5pt; line-height: 1.55; }
    .manual-callout { break-inside: avoid; }
    .manual-faq { break-inside: avoid; }
    .manual-faq:not([open]) .mf-body { display: block; }
    .manual-topic-print { break-before: page; }
    .manual-steps > li::before { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------------- ตัวเลือกแบบค้นหาได้ (app.js) ---------------- */
.ss { position: relative; display: block; min-width: 0; }
.input-group > .ss { flex: 1 1 auto; width: 1%; }
.ss-native { position: absolute !important; inset: 0; width: 100% !important; max-width: none !important; height: 100%; opacity: 0; pointer-events: none; }
.ss-btn { width: 100%; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background-color: #fff; }
.ss-btn.is-invalid { border-color: var(--bs-form-invalid-border-color); }
.ss-panel { display: none; position: absolute; z-index: 1065; left: 0; top: calc(100% + 4px); width: max(100%, 260px); max-width: 92vw; background: var(--sb-card); border: 1px solid var(--sb-border); border-radius: 14px; box-shadow: var(--sb-shadow-lg); padding: .5rem; }
.ss-panel.show { display: block; }
/* ตอนเปิด แผงถูกย้ายไปท้าย <body> และวางด้วยพิกัดหน้าจอ (app.js) จึงอยู่เหนือทุกอย่างและไม่ถูกตัด */
.ss-panel.floating { position: fixed; z-index: 1090; max-width: none; }
/* ในหน้าต่างป๊อปอัป: วางต่อจากปุ่มในเนื้อหา */
.modal .ss-panel { position: static; width: 100%; max-width: none; margin-top: 4px; box-shadow: none; }
.ss-list { max-height: 260px; overflow-y: auto; margin-top: .4rem; }
.ss-item { padding: .4rem .6rem; border-radius: 9px; cursor: pointer; font-size: .92rem; overflow-wrap: anywhere; }
.ss-item:hover, .ss-item.active { background: var(--sb-primary-50); }
.ss-item.selected { font-weight: 600; color: var(--sb-primary-700); }
.ss-group { padding: .35rem .6rem .15rem; font-size: .75rem; font-weight: 700; color: var(--sb-muted); }
.ss-empty { padding: .6rem; text-align: center; color: var(--sb-muted); font-size: .88rem; }
@media print { .ss-panel { display: none !important; } }

/* ---------- ผังโครงสร้างองค์กร ---------- */
.org-tree, .org-tree ul { list-style: none; margin: 0; padding: 0; }
.org-tree ul { margin-left: 22px; padding-left: 22px; border-left: 2px solid var(--bs-border-color); }
.org-tree li { position: relative; padding: 6px 0; }
.org-tree ul > li::before { content: ''; position: absolute; left: -22px; top: 34px; width: 22px; border-top: 2px solid var(--bs-border-color); }
.org-box { display: inline-block; min-width: 230px; max-width: 340px; padding: .7rem .85rem; background: #fff; border: 1px solid var(--bs-border-color); border-left: 4px solid var(--sb-primary-700, #be185d); border-radius: 14px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.org-box.kind-executive { border-left-color: #0f172a; }
.org-box.kind-division { border-left-color: #2563eb; }
.org-box.kind-group { border-left-color: #0d9488; }
.org-box.kind-unit { border-left-color: #94a3b8; }
.org-box details > summary { cursor: pointer; list-style: none; }
.org-box details > summary::-webkit-details-marker { display: none; }
@media print { .org-box { box-shadow: none; break-inside: avoid; } .org-box details > div { display: block; } }

/* ---------- หน้าจอขาย (POS) ---------- */
.pos-cart { position: sticky; top: 84px; }
.pos-item img { background: #fff; }
/* โหมดเต็มจอ: ซ่อนเมนูของระบบทั้งหมด เหลือแต่หน้าจอขาย ปุ่มใหญ่ขึ้นสำหรับจอสัมผัส */
html.pos-kiosk .sb-rail, html.pos-kiosk .sb-topbar, html.pos-kiosk .sb-demo-bar, html.pos-kiosk .sb-bottom-nav { display: none !important; }
html.pos-kiosk .sb-main { margin-left: 0; }
html.pos-kiosk .sb-content { padding: .9rem 1rem; }
html.pos-kiosk .pos-cart { top: 12px; }
html.pos-kiosk .pos-item { min-height: 84px; font-size: 1.05rem; }
html.pos-kiosk .pos-item img { height: 110px !important; }
html.pos-kiosk #pay { padding-top: 1rem; padding-bottom: 1rem; font-size: 1.35rem; }
