    <style>
        /* ✅ Checkbox always visible/clickable */
        #acceptWrap {
            display: flex;
            align-items: center;
            gap: 10px
        }

        #acceptWrap .form-check-input {
            all: revert;
            -webkit-appearance: checkbox;
            appearance: checkbox;
            width: 18px;
            height: 18px;
            margin: 0 8px 0 0;
            border: 2px solid var(--spip-red, #a40000)
        }

        #acceptWrap .form-check-input:checked {
            background-color: var(--spip-red, #a40000);
            border-color: var(--spip-red, #a40000)
        }

        #acceptWrap .form-check-label {
            margin: 0;
            font-weight: 800
        }

        :root {
            --spip-red: #a40000;
            --spip-red-2: #d32f2f;
            --ink: #0f172a;
            --muted: #5b6472;
            --line: #e6eaf0;
            --bg: #f7f7fb;
            --white: #fff;
            --danger: #dc2626;
            --radius: 14px
        }

        * {
            box-sizing: border-box
        }

        html,
        body {
            height: 100%
        }

        body {
            font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            margin: 0;
            color: var(--ink);
            background:
                radial-gradient(1200px 900px at -15% -10%, #ffecec 0%, transparent 60%),
                radial-gradient(900px 700px at 115% -10%, #fff3f3 0%, transparent 55%),
                radial-gradient(900px 700px at 50% 110%, #fff6f6 0%, transparent 55%), var(--bg)
        }

        /* ===== Hero (partials/hero.php) ===== */
        .hero {
            position: relative;
            overflow: hidden;
            color: #fff;
            background:
                radial-gradient(600px 260px at 12% -40%, rgba(255, 255, 255, .22), transparent 70%),
                radial-gradient(520px 320px at 100% 140%, rgba(0, 0, 0, .28), transparent 70%),
                linear-gradient(120deg, #8a0000 0%, var(--spip-red) 40%, var(--spip-red-2) 100%);
            box-shadow: 0 10px 30px -18px rgba(122, 0, 0, .7)
        }

        /* ลายตารางจาง ๆ (ล้อกับตราโรงเรียน) */
        .hero::before {
            content: "";
            position: absolute;
            inset: 0;
            background-image:
                linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px),
                linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px);
            background-size: 28px 28px;
            -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 55%, #000 100%);
            mask-image: linear-gradient(90deg, transparent 0%, #000 55%, #000 100%);
            pointer-events: none
        }

        /* วงแหวนตกแต่งด้านขวา */
        .hero::after {
            content: "";
            position: absolute;
            right: -70px;
            top: -90px;
            width: 280px;
            height: 280px;
            border-radius: 50%;
            border: 40px solid rgba(255, 255, 255, .06);
            pointer-events: none
        }

        .hero .inner {
            position: relative;
            z-index: 1;
            max-width: 1280px;
            margin: 0 auto;
            padding: 26px 20px;
            display: flex;
            gap: 20px;
            align-items: center
        }

        .brand {
            display: flex;
            align-items: center;
            gap: 16px;
            min-width: 0;
            color: inherit;
            text-decoration: none
        }

        .brand:hover {
            color: inherit
        }

        /* ตราไม่มีกรอบ — ใช้เงาขาวบาง ๆ แยกขอบแดงของตราออกจากพื้นแดง */
        .brand-logo {
            flex: none;
            width: 64px;
            height: 64px;
            object-fit: contain;
            filter: drop-shadow(0 0 1.5px rgba(255, 255, 255, .95)) drop-shadow(0 8px 16px rgba(0, 0, 0, .3));
            transition: transform .3s ease
        }

        .brand:hover .brand-logo {
            transform: rotate(-6deg) scale(1.04)
        }

        .brand-text {
            min-width: 0
        }

        .hero .eyebrow {
            font-size: 11px;
            font-weight: 600;
            letter-spacing: .14em;
            text-transform: uppercase;
            color: rgba(255, 255, 255, .78)
        }

        .hero h1 {
            font-weight: 900;
            font-size: 28px;
            line-height: 1.15;
            margin: 2px 0 8px;
            letter-spacing: .01em;
            text-transform: uppercase;
            text-shadow: 0 2px 10px rgba(0, 0, 0, .18)
        }

        .hero .meta {
            display: flex;
            flex-wrap: wrap;
            gap: 6px
        }

        .hero .chip {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 3px 10px;
            border-radius: 999px;
            font-size: 12.5px;
            font-weight: 700;
            background: #fff;
            color: var(--spip-red);
            white-space: nowrap
        }

        .hero .chip-ghost {
            background: rgba(255, 255, 255, .14);
            color: #fff;
            border: 1px solid rgba(255, 255, 255, .28);
            font-weight: 600
        }

        .badge-secure {
            margin-left: auto;
            flex: none;
            display: flex;
            align-items: center;
            gap: 8px;
            background: rgba(255, 255, 255, .14);
            border: 1px solid rgba(255, 255, 255, .28);
            padding: 8px 14px;
            border-radius: 999px;
            font-weight: 700;
            font-size: 14px;
            -webkit-backdrop-filter: blur(4px);
            backdrop-filter: blur(4px)
        }

        @media (max-width: 640px) {
            .hero .inner {
                padding: 18px 16px;
                gap: 12px;
                align-items: flex-start
            }

            .brand {
                gap: 12px
            }

            .brand-logo {
                width: 52px;
                height: 52px
            }

            .hero .eyebrow {
                font-size: 9.5px;
                letter-spacing: .1em
            }

            .hero h1 {
                font-size: 20px;
                margin-bottom: 6px
            }

            .hero .chip {
                font-size: 11.5px;
                padding: 2px 8px
            }

            /* มือถือ: เหลือแค่ไอคอนโล่ */
            .badge-secure {
                padding: 0;
                width: 34px;
                height: 34px;
                justify-content: center
            }

            .badge-secure span {
                display: none
            }
        }

        /* ===== Site footer (partials/footer.php) ===== */
        /* footer ติดล่างจอเสมอ (เนื้อหาสั้นก็ไม่ลอยกลางจอ): body เป็น flex column แล้วให้เนื้อหาหลักยืดเต็มที่ว่าง */
        body:has(> .site-footer) {
            display: flex;
            flex-direction: column;
            height: auto;
            min-height: 100vh;
            min-height: 100dvh
        }

        body:has(> .site-footer)>* {
            flex-shrink: 0
        }

        /* เนื้อหาหลักของแต่ละหน้า (index .wrap / login .lg / dashboard .db-wrap) — width 100% คู่กับ max-width + margin auto เดิม */
        body:has(> .site-footer)>main,
        body:has(> .site-footer)>.wrap {
            flex: 1 0 auto;
            width: 100%
        }

        .site-footer {
            position: relative;
            overflow: hidden;
            margin-top: 40px;
            color: rgba(255, 255, 255, .86);
            background:
                radial-gradient(520px 260px at 0% 0%, rgba(255, 255, 255, .08), transparent 70%),
                linear-gradient(135deg, #5c0000 0%, #7a0000 45%, var(--spip-red, #a40000) 100%)
        }

        /* ลายตารางจาง ๆ เหมือน header */
        .site-footer::before {
            content: "";
            position: absolute;
            inset: 0;
            background-image:
                linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
                linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
            background-size: 28px 28px;
            -webkit-mask-image: linear-gradient(270deg, #000 0%, transparent 60%);
            mask-image: linear-gradient(270deg, #000 0%, transparent 60%);
            pointer-events: none
        }

        .site-footer .sf-inner {
            position: relative;
            max-width: 1180px;
            margin: 0 auto;
            padding: 36px 20px 30px;
            display: grid;
            grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr);
            gap: 28px
        }

        .sf-brand {
            display: flex;
            gap: 14px;
            align-items: flex-start
        }

        .sf-brand img {
            flex: none;
            filter: drop-shadow(0 0 1.5px rgba(255, 255, 255, .95)) drop-shadow(0 6px 14px rgba(0, 0, 0, .3))
        }

        .sf-name {
            color: #fff;
            font-weight: 800;
            font-size: 15px;
            line-height: 1.3
        }

        .sf-sub {
            font-size: 12px;
            letter-spacing: .12em;
            text-transform: uppercase;
            color: rgba(255, 255, 255, .65);
            margin-top: 2px
        }

        .sf-addr {
            display: flex;
            gap: 6px;
            margin: 12px 0 0;
            font-style: normal;
            font-size: 13px;
            line-height: 1.55;
            color: rgba(255, 255, 255, .75)
        }

        .sf-h {
            color: #fff;
            font-weight: 800;
            font-size: 12px;
            letter-spacing: .12em;
            text-transform: uppercase;
            margin-bottom: 12px
        }

        .sf-link {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 6px 0;
            color: rgba(255, 255, 255, .88);
            text-decoration: none;
            font-size: 14px;
            transition: color .15s, transform .15s
        }

        .sf-link i {
            width: 32px;
            height: 32px;
            border-radius: 10px;
            display: grid;
            place-items: center;
            background: rgba(255, 255, 255, .1);
            border: 1px solid rgba(255, 255, 255, .16)
        }

        .sf-link:hover {
            color: #fff;
            transform: translateX(2px)
        }

        .sf-line {
            display: inline-flex;
            align-items: center;
            gap: 12px;
            padding: 10px 18px 10px 12px;
            border-radius: 16px;
            background: #06c755;
            color: #fff;
            text-decoration: none;
            box-shadow: 0 10px 22px -10px rgba(0, 0, 0, .5);
            transition: transform .15s, box-shadow .15s
        }

        .sf-line:hover {
            color: #fff;
            transform: translateY(-2px);
            box-shadow: 0 14px 26px -10px rgba(0, 0, 0, .55)
        }

        .sf-line i {
            font-size: 26px
        }

        .sf-line span {
            font-weight: 800;
            font-size: 16px;
            line-height: 1.15
        }

        .sf-line small {
            display: block;
            font-weight: 600;
            font-size: 11px;
            opacity: .9
        }

        .sf-bottom {
            position: relative;
            border-top: 1px solid rgba(255, 255, 255, .12);
            background: rgba(0, 0, 0, .18)
        }

        .site-footer .sf-bottom-inner {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 8px;
            padding: 14px 20px;
            font-size: 12.5px;
            color: rgba(255, 255, 255, .65)
        }

        .sf-bottom-inner a {
            color: rgba(255, 255, 255, .85);
            text-decoration: none
        }

        .sf-bottom-inner a:hover {
            color: #fff
        }

        @media (max-width: 860px) {
            .site-footer .sf-inner {
                grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
                gap: 24px
            }

            .sf-brand {
                grid-column: 1 / -1
            }
        }

        @media (max-width: 520px) {
            .site-footer .sf-inner {
                grid-template-columns: minmax(0, 1fr);
                padding: 28px 18px 24px
            }

            .site-footer .sf-bottom-inner {
                justify-content: center;
                text-align: center
            }
        }

        /* ===== Layout ===== */
        .wrap {
            max-width: 1280px;
            margin: 18px auto 32px;
            padding: 0 16px;
            display: grid;
            grid-template-columns: 1fr;
            gap: 18px
        }

        @media (min-width:992px) {
            .wrap {
                grid-template-columns: minmax(0, 1fr) 360px
            }
        }

        .card {
            background: #fff;
            border: 1px solid var(--line);
            border-radius: var(--radius);
            box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
            overflow: hidden;
            animation: fadeUp .35s ease-out
        }

        @keyframes fadeUp {
            from {
                opacity: 0;
                transform: translateY(8px)
            }

            to {
                opacity: 1;
                transform: translateY(0)
            }
        }

        .card h2 {
            margin: 0;
            padding: 18px 20px;
            font-size: 20px;
            border-bottom: 1px solid var(--line);
            background: linear-gradient(180deg, #ffffff, #fbfbfe)
        }

        .section {
            padding: 18px 20px
        }

        .section+.section {
            border-top: 1px solid var(--line)
        }

        .grid {
            display: grid;
            grid-template-columns: repeat(12, 1fr);
            gap: 12px
        }

        .col-12 {
            grid-column: span 12
        }

        label {
            font-weight: 800;
            font-size: 12.5px;
            display: block;
            margin-bottom: 6px;
            letter-spacing: .6px;
            color: #172036
        }

        label.req::after {
            content: " *";
            color: var(--danger)
        }

        input,
        select,
        textarea {
            width: 100%;
            padding: 12px;
            border: 1px solid var(--line);
            border-radius: 10px;
            font-size: 14px;
            outline: 0;
            background: #fff;
            text-transform: uppercase;
            transition: box-shadow .15s ease, border-color .15s ease, transform .05s ease
        }

        input:focus,
        select:focus,
        textarea:focus {
            border-color: #cbd5e1;
            box-shadow: 0 0 0 4px rgba(164, 0, 0, .08)
        }

        input:hover,
        select:hover,
        textarea:hover {
            transform: translateY(-1px)
        }

        .is-invalid {
            border-color: var(--danger) !important;
            box-shadow: 0 0 0 3px rgba(220, 38, 38, .12) !important
        }

        .muted {
            color: var(--muted);
            font-size: 12px
        }

        .readonly {
            padding: 11px 12px;
            border: 1px dashed var(--line);
            border-radius: 10px;
            background: #f9fafb;
            font-weight: 800
        }

        .btn {
            appearance: none;
            border: 0;
            padding: clamp(8px, 1.4vh, 12px) clamp(10px, 2.2vh, 18px);
            border-radius: 12px;
            font-weight: 800;
            cursor: pointer;
            letter-spacing: .5px;
            transition: transform .05s, box-shadow .2s;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            min-height: clamp(40px, 5.2vh, 48px);
            font-size: clamp(13px, 1.9vh, 15px);
            line-height: 1;
            overflow: hidden;
            white-space: nowrap
        }

        .btn:active {
            transform: translateY(1px)
        }

        .btn-primary {
            background: linear-gradient(135deg, var(--spip-red), var(--spip-red-2));
            color: #fff;
            box-shadow: 0 10px 22px rgba(164, 0, 0, .20) !important
        }

        .btn-outline {
            background: #fff;
            border: 1px solid var(--line);
            color: #111827;
            box-shadow: 0 6px 14px rgba(15, 23, 42, .06) !important
        }

        .btn[disabled] {
            opacity: .65;
            cursor: not-allowed
        }

        .bar {
            display: flex;
            gap: 10px;
            align-items: center;
            flex-wrap: wrap
        }

        .bar .pill {
            margin-left: auto
        }

        /* Photo */
        .photo-box {
            display: flex;
            gap: 16px;
            align-items: flex-start;
            flex-wrap: wrap
        }

        .photo-preview {
            width: 180px;
            height: 180px;
            border: 1px dashed var(--line);
            border-radius: 12px;
            object-fit: cover;
            background: #fafafa
        }

        /* Aside */
        .aside {
            position: sticky;
            top: 18px;
            height: max-content
        }

        .summary-list {
            list-style: none;
            margin: 0;
            padding: 0
        }

        .summary-list li {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 0;
            border-bottom: 1px dashed var(--line)
        }

        .summary-list i {
            font-size: 18px;
            color: var(--spip-red)
        }

        .pill {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 6px 10px;
            border-radius: 999px;
            background: #fff;
            border: 1px solid var(--line);
            font-weight: 700
        }

        .meter {
            height: 10px;
            background: #f1f5f9;
            border-radius: 999px;
            overflow: hidden
        }

        .meter>span {
            display: block;
            height: 100%;
            background: linear-gradient(90deg, var(--spip-red), var(--spip-red-2));
            width: 0%
        }

        .backtop {
            position: fixed;
            right: 18px;
            bottom: 18px;
            z-index: 50;
            display: none
        }

        .backtop.show {
            display: block
        }

        .footer {
            margin-top: 24px;
            background: linear-gradient(135deg, var(--spip-red), var(--spip-red-2));
            color: #fff;
            border-top: 1px solid rgba(255, 255, 255, .25)
        }

        .footer .inner {
            max-width: 1280px;
            margin: 0 auto;
            padding: 18px 16px;
            display: flex;
            gap: 16px;
            flex-wrap: wrap;
            align-items: center;
            justify-content: space-between
        }

        /* Single-column inside the card */
        .section .grid {
            grid-template-columns: 1fr !important;
            gap: 14px !important
        }

        .section .grid>* {
            grid-column: 1 / -1 !important;
            min-width: 0
        }

        .card .section label {
            white-space: nowrap;
            overflow-wrap: anywhere;
            letter-spacing: .3px
        }

        .card .section .bar {
            flex-direction: column !important;
            align-items: stretch !important;
            gap: 10px !important
        }

        .card .section .bar .btn {
            width: 100% !important
        }

        /* Photo 3:4 */
        #photoPreview {
            display: block;
            width: clamp(180px, 28vw, 320px) !important;
            aspect-ratio: 3/4;
            height: auto !important;
            object-fit: cover !important;
            object-position: center top !important;
            border: 1px solid var(--line);
            border-radius: 12px;
            background: #f3f4f6;
            box-shadow: 0 8px 24px rgba(15, 23, 42, .08)
        }

        @media (max-width:768px) {
            #photoPreview {
                width: min(85vw, 360px) !important
            }
        }

        .card .section .photo-box>div {
            width: 100%;
            max-width: 720px
        }

        .card .section .photo-box .bullets {
            margin: 8px 0 0 0;
            padding-left: 18px;
            color: #475569;
            font-size: 12.5px
        }

        input[type="file"] {
            text-transform: none;
            border-style: dashed
        }

        input[type="file"]::-webkit-file-upload-button {
            border: 0;
            background: #fff;
            border: 1px solid var(--line);
            padding: 8px 12px;
            border-radius: 8px;
            font-weight: 800;
            cursor: pointer
        }

        #regForm .grid {
            grid-template-columns: 1fr !important;
            gap: 14px !important
        }

        #regForm .grid>* {
            grid-column: 1 / -1 !important;
            min-width: 0
        }

        #regForm input:not([type="checkbox"]):not([type="radio"]),
        #regForm select,
        #regForm textarea {
            width: 100% !important
        }

        #regForm input[type="checkbox"],
        #regForm input[type="radio"] {
            width: auto !important;
            height: auto !important;
            display: inline-block;
            padding: 0;
            border: none;
            box-shadow: none;
            text-transform: none
        }

        .policy-panel {
            background: #fff;
            border: 1px solid var(--line);
            border-radius: 14px
        }

        .policy-panel p {
            color: #172036
        }

        /* ===== ปุ่ม Log in มุมขวาของ header (หน้า index.php / otp_gate.php ผ่าน $heroRight) ===== */
        .hero-login-wrap {
            margin-left: auto;
            flex: none;
            display: flex;
            align-items: center;
            gap: 14px;
        }

        .hero-login-hint {
            font-size: 14px;
            font-weight: 500;
            color: rgba(255, 255, 255, .85);
        }

        a.hero-login {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 11px 22px;
            border-radius: 999px;
            background: #fff;
            color: var(--spip-red);
            font-size: 15px;
            font-weight: 800;
            letter-spacing: .01em;
            text-decoration: none;
            white-space: nowrap;
            box-shadow: 0 8px 22px rgba(0, 0, 0, .2);
            transition: transform .15s, box-shadow .15s;
        }

        a.hero-login i {
            transition: transform .15s;
        }

        a.hero-login:hover {
            color: var(--spip-red);
            transform: translateY(-1px);
            box-shadow: 0 12px 28px rgba(0, 0, 0, .26);
        }

        a.hero-login:hover i {
            transform: translateX(3px);
        }

        /* มือถือ: ลงไปเต็มแถวใต้โลโก้ — ข้อความซ้าย ปุ่มขวา */
        @media (max-width: 640px) {
            .hero .inner:has(.hero-login-wrap) {
                flex-wrap: wrap;
            }

            .hero-login-wrap {
                width: 100%;
                margin-left: 0;
                justify-content: space-between;
                padding-top: 12px;
                border-top: 1px solid rgba(255, 255, 255, .18);
            }

            .hero-login-hint {
                font-size: 13px;
            }

            a.hero-login {
                padding: 9px 18px;
                font-size: 14px;
            }
        }
    </style>
