/* =====================================================================
   ชุดระบบรับสมัครสอบ Pre-Entrance - สไตล์ส่วนกลาง (ใช้ร่วมกันทุกหน้า)
   โรงเรียนนวมินทราชินูทิศ สตรีวิทยา ๒
   ===================================================================== */

        :root {
            /* เนื้อหาใช้งานจริง = 1180 - (padding 20 x2) = 1140px (เท่า academic.nmrsw2.ac.th) */
            --container: 1180px;
            --navy: #1a2e5a;
            --navy-dark: #102a56;
            --gold: #eab308;
            /* ไล่เฉดทอง (วัดจากภาพต้นแบบ) : ขอบสองข้างเข้ม ค่อย ๆ สว่างขึ้นตรงกลาง */
            --gold-grad: linear-gradient(to right,
                #c19741 0%, #cdac5b 16%, #e5c97f 34%, #f7e794 50%,
                #e5c97f 66%, #cdac5b 84%, #c19741 100%);
            /* เส้นทองใต้ navbar (ยาวตลอดความกว้างจอ) */
            --gold-line: linear-gradient(to right,
                #b68f4e 0%, #c9ac70 30%, #e7d595 57%, #c9ac70 82%, #b68f4e 100%);
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: 'IBM Plex Sans Thai', sans-serif;
        }

        html { scroll-behavior: smooth; }

        body {
            background-color: #f4f6f9;
            color: #333;
        }

        a { text-decoration: none; }

        /* ============ NAVBAR (แบบ container ไม่ใช่ fluid) ============ */
        .navbar {
            background-color: var(--navy);
            color: white;
            box-shadow: 0 2px 6px rgba(0,0,0,0.25);
            position: relative;
            z-index: 30;
        }

        /* เส้นสีทองไล่เฉดใต้ nav menu ยาวตลอดจอ */
        .navbar::after {
            content: '';
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            height: 4px;
            background: var(--gold-line);
        }

        .nav-container {
            max-width: var(--container);
            margin: 0 auto;
            padding: 0 20px;
            height: 70px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 16px;
        }

        .logo-container {
            display: flex;
            align-items: center;
            gap: 12px;
            min-width: 0;
        }

        .logo-emblem {
            height: 52px;
            width: auto;
            flex: none;
            object-fit: contain;
        }

        .logo-text { min-width: 0; }

        .logo-text h1 {
            font-size: 16px;
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .logo-text p {
            font-size: 13px;
            color: #cbd5e1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .nav-links {
            display: flex;
            align-items: stretch;
            height: 70px;
            list-style: none;
        }

        .nav-links li { display: flex; }

        .nav-links a {
            display: flex;
            align-items: center;
            padding: 0 11px;
            color: white;
            font-size: 13px;
            white-space: nowrap;
            transition: background-color 0.2s, color 0.2s;
        }

        .nav-links a:hover { background-color: rgba(255,255,255,0.12); }

        .nav-links a.active { background-color: rgba(255,255,255,0.17); }

        .nav-links a.btn-login {
            background: var(--gold-grad);
            color: var(--navy);
            font-weight: 600;
            font-size: 13px;
            height: 36px;
            align-self: center;
            margin-left: 8px;
            padding: 0 16px;
            border-radius: 20px;
            box-shadow: 0 2px 6px rgba(0,0,0,0.22);
            transition: filter 0.2s;
        }

        .nav-links a.btn-login:hover {
            background: var(--gold-grad);
            color: var(--navy);
            filter: brightness(1.07);
        }

        /* ============ HERO ============ */
        .hero {
            position: relative;
            /* Overlay ไล่เฉดแนวนอน : ขอบซ้าย-ขวา ไม่มี overlay เลย (0%) / กลางเข้มเหมือนเดิม */
            background:
                linear-gradient(to right,
                    rgba(21,42,88,0) 0%,
                    rgba(21,42,88,0) 10%,
                    rgba(21,42,88,0.28) 17%,
                    rgba(21,42,88,0.58) 23%,
                    rgba(21,42,88,0.74) 28%,
                    rgba(21,42,88,0.79) 35%,
                    rgba(21,42,88,0.80) 50%,
                    rgba(21,42,88,0.79) 65%,
                    rgba(21,42,88,0.74) 72%,
                    rgba(21,42,88,0.58) 77%,
                    rgba(21,42,88,0.28) 83%,
                    rgba(21,42,88,0) 90%,
                    rgba(21,42,88,0) 100%),
                url('../images/hero.jpg') center/cover no-repeat;
            background-color: var(--navy);
            color: white;
            overflow: hidden;
        }

        .hero-inner {
            max-width: var(--container);
            margin: 0 auto;
            padding: 46px 20px 54px;
            min-height: 380px;
            position: relative;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            text-align: center;
        }

        .hero-title {
            font-size: 34px;
            font-weight: 700;
            margin-bottom: 6px;
            text-shadow: 0 2px 8px rgba(0,0,0,0.55);
        }

        .hero-subtitle {
            font-size: 27px;
            font-weight: 600;
            color: #f6c445;
            margin-bottom: 14px;
            text-shadow: 0 2px 8px rgba(0,0,0,0.55);
        }

        .hero-tagline {
            font-size: 19px;
            color: #e8eef7;
            margin-bottom: 30px;
            text-shadow: 0 2px 8px rgba(0,0,0,0.55);
        }

        .btn-register {
            display: inline-flex;
            align-items: center;
            justify-content: space-between;
            gap: 22px;
            min-width: 380px;
            background: var(--gold-grad);
            color: #1f2a44;
            padding: 12px 14px 12px 32px;
            border-radius: 40px;
            box-shadow: 0 8px 18px rgba(0,0,0,0.35);
            transition: transform 0.2s, box-shadow 0.2s;
        }

        .btn-register:hover {
            transform: translateY(-2px);
            box-shadow: 0 12px 22px rgba(0,0,0,0.4);
        }

        .btn-register .btn-text { text-align: left; line-height: 1.3; }

        .btn-register .btn-main {
            display: block;
            font-size: 20px;
            font-weight: 700;
        }

        .btn-register .btn-sub {
            display: block;
            font-size: 14px;
            font-weight: 400;
        }

        .btn-register .arrow-icon {
            flex: none;
            width: 46px;
            height: 46px;
            background-color: #1f2a44;
            color: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
        }

        .btn-details {
            margin-top: 22px;
            background: var(--gold-grad);
            color: #1f2a44;
            padding: 13px 44px;
            border-radius: 30px;
            font-size: 17px;
            font-weight: 600;
            box-shadow: 0 6px 14px rgba(0,0,0,0.3);
            transition: transform 0.2s;
        }

        .btn-details:hover { transform: translateY(-2px); }

        /* ============ CONTENT ============ */
        .content {
            max-width: var(--container);
            margin: 14px auto 0;
            padding: 0 20px;
            display: grid;
            grid-template-columns: 260px 1fr;
            gap: 20px;
            align-items: start;
            position: relative;
            z-index: 10;
        }

        /* Sidebar : วางคร่อมขอบล่างของ hero */
        .sidebar {
            margin-top: -158px;
            display: flex;
            flex-direction: column;
            gap: 14px;
        }

        .side-card {
            background: white;
            color: #333;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 4px 12px rgba(0,0,0,0.12);
        }

        .card-header {
            background-color: var(--navy-dark);
            color: white;
            padding: 8px 14px;
            font-size: 15px;
            font-weight: 500;
        }

        .news-item {
            padding: 12px 14px;
            border-bottom: 1px solid #e8edf5;
            font-size: 13px;
        }

        .news-item:last-child { border-bottom: none; }

        .news-title {
            font-weight: 500;
            color: #1e293b;
            margin-bottom: 4px;
        }

        .news-date {
            font-size: 11px;
            color: #64748b;
        }

        .news-more {
            padding: 8px 14px;
            border-top: 1px solid #e8edf5;
            text-align: right;
            font-size: 12px;
            color: #1d4ed8;
        }

        .plain-body {
            padding: 14px;
            font-size: 13px;
        }

        /* Main column */
        /* กันคอลัมน์หลักถูกยืดเกินความกว้างจอเมื่อตารางกว้างกว่าพื้นที่ (เช่น จอมือถือ)
           แล้วให้ .table-wrap เลื่อนในแนวนอนแทน */
        .content > main { min-width: 0; }

        .panel {
            background: white;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 4px 10px rgba(0,0,0,0.07);
            margin-bottom: 14px;
        }

        .panel:last-child { margin-bottom: 0; }

        .panel-header {
            background-color: var(--navy-dark);
            color: white;
            padding: 9px 18px;
            font-size: 16px;
            font-weight: 500;
        }

        .panel-body {
            padding: 22px 20px;
            text-align: center;
            color: #64748b;
            font-size: 14px;
        }

        /* ============ หน้ารายละเอียด (test4) ============ */
        .breadcrumb {
            font-size: 13px;
            color: #64748b;
            margin: 2px 0 12px;
        }

        .breadcrumb a { color: #1d4ed8; }

        .breadcrumb a:hover { text-decoration: underline; }

        .breadcrumb span { color: #94a3b8; }

        .page-intro {
            padding: 18px 20px 4px;
            font-size: 14.5px;
            line-height: 1.8;
            color: #475569;
        }

        /* สารบัญหัวข้อ */
        .toc {
            list-style: none;
            counter-reset: toc;
            padding: 12px 20px 6px;
        }

        .toc li {
            counter-increment: toc;
            border-bottom: 1px dashed #e2e8f0;
        }

        .toc li:last-child { border-bottom: none; }

        .toc a {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 11px 6px;
            font-size: 14.5px;
            color: #1e293b;
            border-radius: 6px;
            transition: background-color 0.15s, color 0.15s;
        }

        .toc a::before {
            content: counter(toc);
            flex: none;
            width: 26px;
            height: 26px;
            border-radius: 50%;
            background: var(--navy);
            color: #fff;
            font-size: 13px;
            font-weight: 600;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .toc a:hover { background: #f1f5f9; color: #1d4ed8; }

        .toc a::after {
            content: '\f105';
            font-family: 'Font Awesome 6 Free';
            font-weight: 900;
            margin-left: auto;
            color: #cbd5e1;
        }

        .toc a:hover::after { color: var(--gold); }

        /* หัวเรื่องย่อยของแต่ละหัวข้อ */
        .detail-head {
            display: flex;
            align-items: center;
            gap: 14px;
            padding: 20px 20px 4px;
        }

        .detail-icon {
            flex: none;
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background: var(--gold-grad);
            color: #1f2a44;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 21px;
            box-shadow: 0 3px 8px rgba(0,0,0,0.18);
        }

        .detail-title {
            font-size: 18px;
            font-weight: 700;
            color: var(--navy);
        }

        .detail-sub {
            font-size: 13.5px;
            color: #64748b;
        }

        .detail-text {
            padding: 10px 20px 4px;
            font-size: 14px;
            line-height: 1.85;
            color: #475569;
        }

        .detail-list {
            padding: 8px 20px 18px 42px;
            font-size: 14px;
            line-height: 1.9;
            color: #475569;
        }

        .detail-list li::marker { color: #c19741; }

        /* ตารางตัวอย่างข้อมูล */
        .table-wrap {
            overflow-x: auto;
            padding: 8px 20px 4px;
        }

        .detail-table {
            width: 100%;
            min-width: 480px;
            border-collapse: collapse;
            font-size: 13.5px;
        }

        .detail-table caption {
            text-align: left;
            font-size: 13px;
            color: #64748b;
            padding-bottom: 8px;
        }

        .detail-table th {
            background-color: var(--navy-dark);
            color: #fff;
            padding: 9px 12px;
            font-weight: 500;
            text-align: left;
            white-space: nowrap;
        }

        .detail-table td {
            padding: 9px 12px;
            border-bottom: 1px solid #e8edf5;
            color: #334155;
            vertical-align: top;
        }

        .detail-table tbody tr:nth-child(even) { background: #f8fafc; }

        .detail-table tbody tr:last-child td { border-bottom: none; }

        .detail-table .num { text-align: center; white-space: nowrap; }

        .detail-table tr.total-row td {
            background: #f1f5f9;
            font-weight: 700;
            color: var(--navy);
        }

        .tag {
            display: inline-block;
            background: var(--gold-grad);
            color: #1f2a44;
            font-size: 11.5px;
            font-weight: 600;
            padding: 2px 10px;
            border-radius: 11px;
            white-space: nowrap;
        }

        /* หมายเหตุ */
        .note {
            margin: 14px 20px 4px;
            background: #fffbeb;
            border-left: 4px solid #eab308;
            border-radius: 0 6px 6px 0;
            padding: 10px 14px;
            font-size: 13px;
            line-height: 1.75;
            color: #78350f;
        }

        .note i { margin-right: 6px; }

        /* ปุ่มท้ายหน้า */
        .cta-bar {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 14px;
            padding: 20px;
        }

        .btn-cta {
            background: var(--gold-grad);
            color: #1f2a44;
            padding: 12px 30px;
            border-radius: 30px;
            font-size: 15px;
            font-weight: 600;
            box-shadow: 0 6px 14px rgba(0,0,0,0.22);
            transition: transform 0.2s;
        }

        .btn-cta:hover { transform: translateY(-2px); }

        .btn-ghost {
            color: #1d4ed8;
            font-size: 14.5px;
            font-weight: 500;
        }

        .btn-ghost:hover { text-decoration: underline; }

        .cta-hint {
            font-size: 13px;
            color: #64748b;
            width: 100%;
        }

        /* ============ FOOTER ============ */
        footer {
            background-color: #101f45;
            color: #93a3bd;
            margin-top: 30px;
            padding: 18px 0 22px;
            font-size: 12.5px;
            line-height: 1.7;
        }

        .footer-container {
            max-width: var(--container);
            margin: 0 auto;
            padding: 0 20px;
            text-align: center;
        }

        footer .copyright { color: #e2e8f0; }

        footer a { color: #cbd5e1; }

        footer a:hover { color: #fff; text-decoration: underline; }

        /* ============ RESPONSIVE ============ */
        /* ปรับความกว้างตาม breakpoint แบบเดียวกับเว็บอ้างอิง (1140 / 85% / 90%) */
        @media (max-width: 1179px) { :root { --container: 100%; } }
        @media (max-width: 1024px) { :root { --container: 85%; } }
        @media (max-width: 767px)  { :root { --container: 90%; } }

        /* จอ <=1024px : ให้ navbar ห่อเป็น 2 แถว
           เพื่อให้ชื่อโรงเรียนแสดงครบ ไม่ถูกตัดทอน (...) */
        @media (max-width: 1024px) {
            .nav-container {
                height: auto;
                flex-wrap: wrap;
                justify-content: center;
                padding: 12px 20px;
                gap: 8px;
            }

            .nav-links {
                height: auto;
                flex-wrap: wrap;
                justify-content: center;
            }

            .nav-links a { padding: 8px 12px; }

            .nav-links a.btn-login { align-self: center; }
        }

        @media (max-width: 900px) {
            .hero-inner { padding: 40px 20px 46px; min-height: 0; }

            .hero-title { font-size: 26px; }

            .hero-subtitle { font-size: 21px; }

            .hero-tagline { font-size: 16px; }

            .btn-register { min-width: 0; width: 100%; max-width: 380px; }

            .content { grid-template-columns: 1fr; }

            /* Mobile view : ซ่อนคอลัมน์แรก (sidebar) เหลือเฉพาะเนื้อหาหลัก */
            .sidebar { display: none; }

            /* หน้ารายละเอียด : กระชับระยะห่างเมื่อเหลือคอลัมน์เดียว */
            .page-intro,
            .detail-text { padding-left: 16px; padding-right: 16px; }

            .toc,
            .detail-list { padding-left: 16px; padding-right: 16px; }

            .detail-list { padding-left: 38px; }

            .detail-head { padding: 16px 16px 4px; }

            .table-wrap { padding: 8px 16px 4px; }

            .note { margin: 12px 16px 4px; }

            .cta-bar { padding: 16px; }
        }

        @media (max-width: 520px) {
            .logo-text h1 { white-space: normal; }

            .hero-title { font-size: 22px; }

            .btn-register .btn-main { font-size: 17px; }

            .detail-icon { width: 40px; height: 40px; font-size: 18px; }

            .detail-title { font-size: 16.5px; }

            .btn-cta { width: 100%; text-align: center; }
        }

        /* ===== ส่วนเฉพาะหน้าแรก : จุดเด่น 4 หัวข้อ ===== */
        .features-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 14px;
            padding: 18px 16px;
            text-align: center;
        }

        .feature-icon {
            font-size: 30px;
            color: #1d4ed8;
            margin-bottom: 8px;
        }

        .feature-title {
            font-size: 14px;
            font-weight: 600;
            color: #1e293b;
        }

        .feature-desc {
            font-size: 12px;
            color: #64748b;
        }

        /* ===== ส่วนเฉพาะหน้ากำหนดการ : ไทม์ไลน์ ===== */
        /* ไทม์ไลน์ขั้นตอน */
        .timeline {
            list-style: none;
            padding: 16px 20px 10px 24px;
        }

        .timeline li {
            position: relative;
            padding: 0 0 20px 34px;
            border-left: 3px solid #e2e8f0;
        }

        .timeline li:last-child {
            border-left-color: transparent;
            padding-bottom: 4px;
        }

        .timeline li::before {
            content: '';
            position: absolute;
            left: -9px;
            top: 2px;
            width: 15px;
            height: 15px;
            border-radius: 50%;
            background: var(--gold-grad);
            border: 2px solid #fff;
            box-shadow: 0 0 0 2px #c19741;
        }

        .tl-date {
            font-size: 12.5px;
            font-weight: 600;
            color: #a16207;
            margin-bottom: 2px;
        }

        .tl-title {
            font-size: 14.5px;
            font-weight: 600;
            color: var(--navy);
            margin-bottom: 2px;
        }

        .tl-desc {
            font-size: 13px;
            color: #64748b;
            line-height: 1.7;
        }

        /* ===== ส่วนเฉพาะหน้าประกาศผล : ค้นหา + การ์ดผลสอบ ===== */
        /* ลิงก์ข้อความในเนื้อหา */
        .link { color: #1d4ed8; }

        .link:hover { text-decoration: underline; }

        /* ช่องค้นหาผลสอบ */
        .search-form {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
            gap: 14px;
            align-items: end;
            padding: 18px 20px 6px;
        }

        .field label {
            display: block;
            font-size: 13px;
            font-weight: 500;
            color: #475569;
            margin-bottom: 6px;
        }

        .field input {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid #cbd5e1;
            border-radius: 8px;
            background: #f8fafc;
            font-family: inherit;
            font-size: 14px;
            color: #1e293b;
            transition: border-color 0.15s, box-shadow 0.15s;
        }

        .field input::placeholder { color: #94a3b8; }

        .field input:focus {
            outline: none;
            border-color: #c19741;
            background: #fff;
            box-shadow: 0 0 0 3px rgba(193,151,65,0.22);
        }

        .btn-search {
            background: var(--gold-grad);
            color: #1f2a44;
            border: none;
            padding: 11px 24px;
            border-radius: 24px;
            font-family: inherit;
            font-size: 14.5px;
            font-weight: 600;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            box-shadow: 0 4px 10px rgba(0,0,0,0.18);
            transition: transform 0.2s;
        }

        .btn-search:hover { transform: translateY(-2px); }

        .hint {
            padding: 8px 20px 18px;
            font-size: 13px;
            color: #64748b;
            line-height: 1.75;
        }

        /* การ์ดผลสอบ */
        .result-card {
            margin: 6px 20px 18px;
            border: 1px solid #e2e8f0;
            border-radius: 10px;
            overflow: hidden;
            box-shadow: 0 4px 12px rgba(0,0,0,0.06);
        }

        .result-top {
            background: #f1f5f9;
            padding: 12px 16px;
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 8px 20px;
            font-size: 13.5px;
            color: #475569;
            border-bottom: 1px solid #e2e8f0;
        }

        .result-top strong { color: var(--navy); }

        .badge-pass {
            margin-left: auto;
            background: var(--gold-grad);
            color: #1f2a44;
            font-size: 12px;
            font-weight: 600;
            padding: 4px 14px;
            border-radius: 13px;
        }

        .score-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 1px;
            background: #e2e8f0;
        }

        .score-item {
            background: #fff;
            padding: 16px 8px;
            text-align: center;
        }

        .score-val {
            font-size: 23px;
            font-weight: 700;
            color: var(--navy);
            line-height: 1.2;
        }

        .score-val.gold { color: #b68f4e; }

        .score-val.text {
            font-size: 18px;
            font-weight: 600;
            color: var(--navy);
        }

        .score-label {
            font-size: 12px;
            color: #64748b;
            margin-top: 4px;
        }

        .detail-table .col-time { width: 150px; }

        /* ===== กำหนดการตอบโต้ (ส่วนเฉพาะหน้า) ===== */
        @media (max-width: 900px) {
            .features-grid { grid-template-columns: repeat(2, 1fr); }
            .timeline { padding: 14px 16px 8px 20px; }
            .search-form { padding: 16px 16px 6px; }
            .hint { padding: 8px 16px 16px; }
            .result-card { margin: 6px 16px 16px; }
        }

        @media (max-width: 640px) {
            .score-grid { grid-template-columns: repeat(2, 1fr); }
            .badge-pass { margin-left: 0; }
        }

        @media (max-width: 520px) {
            .features-grid { grid-template-columns: 1fr; }
            .btn-search { width: 100%; }
        }

        /* ===== การ์ดทางลัด (หน้า index) ===== */
        .quick-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
            gap: 14px;
            padding: 18px 16px;
        }

        .quick-card {
            display: flex;
            align-items: center;
            gap: 13px;
            padding: 14px 15px;
            border: 1px solid #e2e8f0;
            border-radius: 10px;
            background: #f8fafc;
            transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
        }

        .quick-card:hover {
            transform: translateY(-3px);
            border-color: #c19741;
            box-shadow: 0 8px 18px rgba(0,0,0,0.10);
            background: #fff;
        }

        .quick-icon {
            flex: none;
            width: 42px;
            height: 42px;
            border-radius: 50%;
            background: var(--gold-grad);
            color: #1f2a44;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 17px;
        }

        .quick-title { font-size: 14.5px; font-weight: 600; color: var(--navy); }

        .quick-desc { font-size: 12.5px; color: #64748b; line-height: 1.55; }

        .quick-card .quick-go { margin-left: auto; color: #cbd5e1; font-size: 13px; }

        .quick-card:hover .quick-go { color: #c19741; }

        @media (max-width: 520px) { .quick-grid { grid-template-columns: 1fr; } }

        /* ===== กล่องไฟล์เอกสาร PDF (ContentType::PdfList) =====
           แถวละ 1 ไฟล์ เรียงเป็นแนวตั้ง — ลิงก์เปิดแท็บใหม่ใช้ได้แม้ JS ไม่ทำงาน
           ส่วนปุ่ม "อ่านในหน้า" / "เต็มหน้าจอ" เป็นของเสริมจาก js/pdf-list.js ===== */
        .pdf-list {
            display: flex;
            flex-direction: column;
            gap: 10px;
            padding: 18px 16px;
        }

        .pdf-row {
            border: 1px solid #e2e8f0;
            border-radius: 10px;
            background: #f8fafc;
            overflow: hidden;
        }

        .pdf-head {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 10px;
            padding: 13px 15px;
        }

        .pdf-link {
            display: inline-flex;
            align-items: center;
            gap: 9px;
            min-width: 0;
            color: var(--navy);
            font-size: 14.5px;
            font-weight: 600;
            text-decoration: none;
        }

        .pdf-link i { flex: none; color: #dc2626; font-size: 17px; }

        .pdf-link:hover .pdf-title { color: #c19741; text-decoration: underline; }

        /* ชื่อเอกสารยาวมาก ๆ ต้องตัดเป็นบรรทัดเดียว กันแถบปุ่มถูกดันตกแถว */
        .pdf-title {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .pdf-open-hint {
            flex: none;
            padding: 2px 9px;
            border-radius: 11px;
            background: #e2e8f0;
            color: #64748b;
            font-size: 11.5px;
            font-weight: 500;
        }

        .pdf-tools {
            margin-left: auto;
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .pdf-toggle,
        .pdf-full {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 6px 13px;
            border: 1px solid #cbd5e1;
            border-radius: 20px;
            background: #fff;
            color: #334155;
            font: inherit;
            font-size: 12.5px;
            font-weight: 600;
            cursor: pointer;
            transition: border-color 0.15s, color 0.15s;
        }

        .pdf-toggle:hover,
        .pdf-full:hover {
            border-color: #c19741;
            color: #1d4ed8;
        }

        /* [hidden] ต้องถูกบังคับทับ display: inline-flex ไม่งั้นปุ่มจะโผล่ทั้งที่ซ่อนไว้ */
        .pdf-toggle[hidden],
        .pdf-full[hidden] { display: none; }

        .pdf-frame { border-top: 1px solid #e2e8f0; background: #fff; }

        .pdf-frame iframe {
            display: block;
            width: 100%;
            height: 68vh;
            min-height: 420px;
            border: 0;
            background: #fff;
        }

        /* แถบซูมของตัวเอง — ใช้แทนช่องซูมใน toolbar ของเบราว์เซอร์ที่ #toolbar=0 ซ่อนไป */
        .pdf-zoom {
            display: flex;
            align-items: center;
            gap: 5px;
            padding: 7px 8px;
            border-top: 1px solid #e2e8f0;
            background: #f8fafc;
        }

        .pdf-zoom-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-width: 30px;
            height: 27px;
            padding: 0 8px;
            border: 1px solid #cbd5e1;
            border-radius: 6px;
            background: #fff;
            color: #334155;
            font: inherit;
            font-size: 13px;
            font-weight: 600;
            line-height: 1;
            cursor: pointer;
            transition: border-color 0.15s, color 0.15s;
        }

        .pdf-zoom-btn:hover {
            border-color: #c19741;
            color: #1d4ed8;
        }

        .pdf-zoom-value {
            min-width: 56px;
            background: #f1f5f9;
            font-variant-numeric: tabular-nums;
        }

        .pdf-empty {
            margin: 0;
            padding: 18px 16px;
            color: #64748b;
            font-size: 13.5px;
        }

        /* เต็มหน้าจอ — ต้องนิยามเองทั้งก้อน เพราะเบราว์เซอร์ยกเลิก styling ของบรรพบุรุษ
           (ค่าเริ่มต้นของ :fullscreen คือพื้นหลังดำ ซึ่งทำให้ขอบขาวรอบ PDF หายไป) */
        .pdf-frame:fullscreen {
            display: flex;
            flex-direction: column;
            border-top: 0;
            background: #fff;
        }

        .pdf-frame:fullscreen iframe { flex: 1; height: 100%; min-height: 0; }

        /* เต็มหน้าจออยู่แล้ว เส้นคั่นบนของแถบซูมไม่จำเป็น ปล่อยไว้จะขึ้นเส้นพาดขอบจอ */
        .pdf-frame:fullscreen .pdf-zoom { border-top: 0; }

        @media (max-width: 520px) {
            .pdf-tools { margin-left: 0; width: 100%; }
            .pdf-frame iframe { height: 60vh; min-height: 300px; }
        }

        /* ===== ปุ่มเลื่อนกลับขึ้นบนสุด (js/main.js) ===== */
        .back-to-top {
            position: fixed;
            right: 20px;
            bottom: 20px;
            width: 44px;
            height: 44px;
            border: none;
            border-radius: 50%;
            background: var(--gold-grad);
            color: #1f2a44;
            font-size: 17px;
            font-family: inherit;
            cursor: pointer;
            box-shadow: 0 6px 16px rgba(0,0,0,0.28);
            opacity: 0;
            visibility: hidden;
            transform: translateY(10px);
            transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
            z-index: 60;
        }

        .back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }

        .form-msg {
            margin: 4px 20px 18px;
            padding: 10px 14px;
            border-radius: 8px;
            font-size: 13.5px;
            line-height: 1.7;
            display: none;
        }

        .form-msg.show { display: block; }
        .form-msg.ok { background: #f0fdf4; border-left: 4px solid #16a34a; color: #166534; }
        .form-msg.err { background: #fef2f2; border-left: 4px solid #dc2626; color: #991b1b; }

        @media (max-width: 900px) { .form-msg { margin: 4px 16px 16px; } }

        /* ===== ส่วนเฉพาะหน้าสมัครสอบ : ขั้นตอน + แบบฟอร์มกรอกข้อมูล ===== */
        .form-area {
            display: flex;
            flex-direction: column;
            gap: 14px;
        }

        /* ขั้นตอนการสมัครสอบ */
        .steps-container {
            background: white;
            padding: 15px;
            border-radius: 8px;
            box-shadow: 0 4px 10px rgba(0,0,0,0.07);
        }

        .steps-title {
            font-size: 16px;
            font-weight: 700;
            color: var(--navy-dark);
            margin-bottom: 12px;
        }

        .steps-list {
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 13px;
            color: #334155;
            font-weight: 500;
        }

        .step-item {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .step-item.active {
            color: var(--navy-dark);
            font-weight: 700;
        }

        .step-arrow { color: #94a3b8; }

        /* การ์ดฟอร์ม */
        .form-card {
            background: white;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 4px 10px rgba(0,0,0,0.07);
        }

        .form-header {
            background-color: var(--navy-dark);
            color: white;
            padding: 10px 16px;
            font-size: 14px;
            font-weight: 500;
        }

        .form-body { padding: 20px; }

        .form-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 15px;
            margin-bottom: 15px;
        }

        .form-grid-3 {
            display: grid;
            grid-template-columns: 1fr 120px 1fr;
            gap: 15px;
            margin-bottom: 15px;
        }

        /* กริด 3 ช่องเท่ากัน — ใช้กับแถวคำนำหน้า/ชั้นปี/สังกัด และที่อยู่ */
        .form-grid-3col {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 15px;
            margin-bottom: 15px;
        }

        /*
         * กริดกว้างแค่ไม่เท่ากัน — แบ่งสัดส่วนตามคอลัมน์ของฟอร์มสมัครสอบ
         * โค้ดเก่า (bootstrap col-md-*) ช่องกลางจึงกว้างกว่าช่องริม
         */
        .form-grid-3-6-3 {
            display: grid;
            grid-template-columns: 3fr 6fr 3fr;
            gap: 15px;
            margin-bottom: 15px;
        }

        /* แถวเลขที่ / หมู่ที่ / หมู่บ้าน — สองช่องแรกสั้น ช่องหมู่บ้านยาว */
        .form-grid-2-2-8 {
            display: grid;
            grid-template-columns: 2fr 2fr 8fr;
            gap: 15px;
            margin-bottom: 15px;
        }

        /* แถวอำเภอ/เขต / จังหวัด / รหัสไปรษณีย์ — ช่องรหัสไปรษณีย์สั้น */
        .form-grid-5-5-2 {
            display: grid;
            grid-template-columns: 5fr 5fr 2fr;
            gap: 15px;
            margin-bottom: 15px;
        }

        /*
         * แถบที่ซ่อนด้วย attribute hidden (เช่น "อยู่อาศัยรวม" ที่รอให้เลือกวันที่ครบ)
         * ต้องเขียนทับ display: grid ของตัวเอง มิฉะนั้นจะยังแสดงอยู่
         */
        .form-grid[hidden] { display: none; }

        /* หัวข้อส่วนย่อยในฟอร์ม เช่น "ที่อยู่ตามทะเบียนบ้าน" */
        .form-section-title {
            color: var(--navy-dark);
            border-bottom: 1px solid #e2e8f0;
            margin: 22px 0 15px;
            padding-bottom: 6px;
            font-size: 13px;
            font-weight: 700;
        }

        .form-group {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        .form-group.full-width {
            grid-column: span 2;
            margin-bottom: 15px;
        }

        .form-group label {
            font-size: 12px;
            font-weight: 600;
            color: #334155;
        }

        .form-control {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid #cbd5e1;
            border-radius: 4px;
            font-size: 13px;
            outline: none;
            background-color: #f8fafc;
        }

        .form-control:focus {
            border-color: #2563eb;
            background-color: #fff;
        }

        /* ปุ่มดำเนินการ */
        .form-actions {
            display: flex;
            justify-content: center;
            gap: 10px;
            margin-top: 25px;
        }

        /* ชิดขวา — แถวปุ่มของฟอร์มสมัครสอบตามแบบฟอร์มต้นฉบับ */
        .form-actions.end { justify-content: flex-end; }

        .btn-submit {
            background: var(--gold-grad);
            color: var(--navy-dark);
            border: none;
            padding: 9px 25px;
            border-radius: 20px;
            font-size: 14px;
            font-family: inherit;
            font-weight: 500;
            cursor: pointer;
            transition: filter 0.2s, transform 0.2s;
        }

        .btn-submit:hover { filter: brightness(1.07); transform: translateY(-1px); }

        .btn-cancel {
            background-color: #94a3b8;
            color: white;
            border: none;
            padding: 9px 25px;
            border-radius: 20px;
            font-size: 14px;
            font-family: inherit;
            font-weight: 500;
            cursor: pointer;
            transition: background-color 0.2s;
        }

        .btn-cancel:hover { background-color: #7c8ba1; }

        /* ===== ฟอร์ม : จัดหน้าจอเล็ก ===== */
        @media (max-width: 640px) {
            .form-grid,
            .form-grid-3,
            .form-grid-3col,
            .form-grid-3-6-3,
            .form-grid-2-2-8,
            .form-grid-5-5-2 { grid-template-columns: 1fr; }

            .form-group.full-width { grid-column: span 1; }

            .steps-list {
                flex-direction: column;
                align-items: flex-start;
                gap: 8px;
            }

            .step-arrow { display: none; }
        }

        /* ===== หน้าเข้าสู่ระบบ (login2.html : split-screen) ===== */
        /* ปุ่มเมนู "สำหรับเจ้าหน้าที่" เมื่ออยู่หน้า login */
        .nav-links a.btn-login.active { box-shadow: inset 0 0 0 2px rgba(255,255,255,0.65); }

        .login-wrap {
            padding: 6px 20px 16px;
            max-width: 540px;
            margin: 0 auto;
        }

        .login-form {
            display: flex;
            flex-direction: column;
            gap: 14px;
        }

        .login-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            flex-wrap: wrap;
            font-size: 13px;
            color: #334155;
        }

        .remember {
            display: flex;
            align-items: center;
            gap: 6px;
            cursor: pointer;
        }

        .btn-block {
            width: 100%;
            padding: 11px;
            font-size: 15px;
            font-weight: 600;
        }

        .login-divider {
            display: flex;
            align-items: center;
            gap: 12px;
            color: #94a3b8;
            font-size: 12.5px;
        }

        .login-divider::before,
        .login-divider::after {
            content: "";
            flex: 1;
            height: 1px;
            background: #e2e8f0;
        }

        .login-note {
            text-align: center;
            font-size: 13.5px;
            color: #475569;
        }

        @media (max-width: 520px) {
            .login-wrap { padding: 6px 16px 14px; }
            .login-row { justify-content: flex-start; }
            .btn-block { font-size: 14.5px; }
        }

        /* ===== หน้า login2 : Split-screen เต็มจอ (ไม่มี hero/ sidebar) ===== */
        /* ความกว้างเท่ากับ nav menu (container - ขอบใน 20px ทั้งสองข้าง) */
        .split {
            max-width: calc(var(--container) - 40px);
            margin: 14px auto 0;
            display: grid;
            grid-template-columns: 1fr 1fr;
            min-height: 640px;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 10px 28px rgba(15,31,69,0.12);
            position: relative;
            z-index: 10;
        }

        /* ซ้าย : แผงแบรนด์บนภาพพื้นหลัง */
        .split-brand {
            position: relative;
            display: flex;
            flex-direction: column;
            justify-content: center;
            gap: 18px;
            padding: 46px 44px;
            color: #fff;
            overflow: hidden;
            background:
                linear-gradient(rgba(16,31,69,0.90), rgba(16,31,69,0.90)),
                url('../images/hero.jpg') center/cover no-repeat;
        }

        /* วงกลมเส้นทองตามธีม */
        .split-brand::after {
            content: "";
            position: absolute;
            right: -130px;
            bottom: -140px;
            width: 340px;
            height: 340px;
            border: 26px solid rgba(229,201,127,0.30);
            border-radius: 50%;
            pointer-events: none;
        }

        .split-brand > * { position: relative; z-index: 1; }

        .split-logo {
            display: flex;
            align-items: center;
            gap: 13px;
            margin-bottom: 4px;
        }

        .split-logo img {
            width: 58px;
            height: 58px;
            object-fit: contain;
            background: #fff;
            border-radius: 50%;
            padding: 5px;
        }

        .split-logo h1 { font-size: 16.5px; font-weight: 700; line-height: 1.45; }

        .split-logo p { font-size: 12.5px; color: #c3d0ea; }

        .split-title {
            font-size: 26px;
            font-weight: 700;
            line-height: 1.5;
            text-shadow: 0 2px 8px rgba(0,0,0,0.45);
        }

        .split-text {
            font-size: 14.5px;
            line-height: 1.9;
            color: #d6e0f2;
        }

        .split-list {
            list-style: none;
            display: flex;
            flex-direction: column;
            gap: 11px;
            margin: 4px 0;
        }

        .split-list li {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            font-size: 14px;
            line-height: 1.75;
            color: #e7edf9;
        }

        .split-list i {
            color: #e5c97f;
            width: 18px;
            text-align: center;
            margin-top: 5px;
        }

        .split-actions {
            display: flex;
            align-items: center;
            gap: 16px;
            flex-wrap: wrap;
            margin-top: 8px;
        }

        .split-link {
            color: #fff;
            font-size: 14px;
            font-weight: 500;
            text-decoration: underline;
            text-underline-offset: 3px;
        }

        .split-link:hover { color: #e5c97f; }

        /* ขวา : ฟอร์มเข้าสู่ระบบ */
        .split-panel {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 46px 36px;
            background: #f1f5f9;
        }

        .split-box {
            width: 100%;
            max-width: 430px;
            background: #fff;
            border-radius: 12px;
            box-shadow: 0 8px 24px rgba(15,31,69,0.10);
            padding: 30px 30px 26px;
        }

        .split-heading {
            font-size: 21px;
            font-weight: 700;
            color: var(--navy-dark);
            margin-bottom: 6px;
        }

        .split-sub {
            font-size: 13.5px;
            color: #64748b;
            line-height: 1.8;
            margin-bottom: 18px;
        }

        .split-badge {
            display: inline-block;
            background: var(--gold-grad);
            color: #1f2a44;
            font-size: 11.5px;
            font-weight: 700;
            padding: 4px 12px;
            border-radius: 14px;
            margin-bottom: 12px;
        }

        .split-note {
            margin-top: 16px;
            padding-top: 14px;
            border-top: 1px dashed #e2e8f0;
            font-size: 12.5px;
            color: #94a3b8;
            line-height: 1.75;
            text-align: center;
        }

        /* เว้นขอบให้ footer ชิดกับส่วน split */
        .split + footer { margin-top: 0; }

        @media (max-width: 900px) {
            .split { grid-template-columns: 1fr; min-height: 0; }
            .split-brand { padding: 34px 24px; gap: 15px; }
            .split-title { font-size: 22px; }
            .split-panel { padding: 30px 20px 40px; }
            .split-brand::after { right: -150px; bottom: -170px; }
        }

        @media (max-width: 520px) {
            .split-brand { padding: 26px 18px; }
            .split-title { font-size: 19px; }
            .split-text { font-size: 13.5px; line-height: 1.8; }
            .split-list li { font-size: 13.5px; }
            .split-box { padding: 24px 18px 22px; }
            .split-panel { padding: 24px 14px 34px; }
        }

        /* ===== แถบเลือกภาษาแบบ dropdown ใน header (TH default / EN / CN / JA) ===== */
        .nav-links li.lang-item {
            align-items: center;
            padding-right: 4px;
            margin-left: 6px;
        }

        .lang-dropdown { position: relative; }

        .lang-toggle {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 6px 9px;
            border: 1px solid rgba(255,255,255,0.28);
            border-radius: 14px;
            background: rgba(255,255,255,0.08);
            color: #e7edf9;
            font-family: inherit;
            font-size: 11px;
            font-weight: 600;
            line-height: 1.3;
            white-space: nowrap;
            cursor: pointer;
            transition: background-color 0.18s, color 0.18s, border-color 0.18s;
        }

        .lang-toggle .flag { font-size: 14px; line-height: 1; }

        .lang-toggle .caret {
            font-size: 9px;
            opacity: 0.75;
            transition: transform 0.2s;
        }

        .lang-toggle:hover,
        .lang-toggle[aria-expanded="true"] {
            background: rgba(255,255,255,0.22);
            border-color: rgba(255,255,255,0.5);
            color: #fff;
        }

        .lang-toggle[aria-expanded="true"] .caret { transform: rotate(180deg); }

        .lang-menu {
            position: absolute;
            top: calc(100% + 9px);
            right: 0;
            min-width: 178px;
            margin: 0;
            padding: 6px;
            list-style: none;
            background: #12203c;
            border: 1px solid rgba(212,175,55,0.5);
            border-radius: 10px;
            box-shadow: 0 16px 34px rgba(0,0,0,0.4);
            opacity: 0;
            visibility: hidden;
            transform: translateY(-6px);
            transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
            z-index: 1200;
        }

        .lang-menu::before {
            content: '';
            position: absolute;
            top: -5px;
            right: 24px;
            width: 9px;
            height: 9px;
            background: #12203c;
            border-left: 1px solid rgba(212,175,55,0.5);
            border-top: 1px solid rgba(212,175,55,0.5);
            transform: rotate(45deg);
        }

        .lang-dropdown.open .lang-menu {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
        }

        .lang-option {
            display: flex;
            align-items: center;
            gap: 8px;
            width: 100%;
            padding: 8px 10px;
            border: 0;
            border-radius: 7px;
            background: transparent;
            color: #e7edf9;
            font-family: inherit;
            font-size: 13px;
            text-align: left;
            cursor: pointer;
            transition: background-color 0.15s, color 0.15s;
        }

        .lang-option .flag { font-size: 15px; line-height: 1; }

        .lang-option .label { flex: 1; }

        .lang-option .code {
            font-size: 10.5px;
            font-weight: 700;
            letter-spacing: 0.04em;
            opacity: 0.6;
        }

        .lang-option:hover { background: rgba(255,255,255,0.10); color: #fff; }

        .lang-option.active {
            background: var(--gold-grad);
            color: #1f2a44;
            font-weight: 600;
        }

        .lang-option.active .code { opacity: 0.8; }

        @media (max-width: 767px) {
            .nav-links li.lang-item { margin-left: 2px; padding-right: 0; }
            .lang-menu { right: -6px; min-width: 164px; }
        }

        /* จอ tablet (<=1024px) และมือถือ (<=767px) : ซ่อนปุ่มธงเปลี่ยนภาษา
           เหตุผล — ที่ความกว้างนี้ .nav-links เริ่มห่อเป็น 2 แถวอยู่แล้ว (บล็อกด้านบนสุดของไฟล์)
           ชื่อโรงเรียน + เมนู + ปุ่มทอง สำคัญกว่า และพื้นที่แนวนอนไม่พอ

           ซ่อนเฉพาะ UI ด้วย CSS เท่านั้น ไม่ได้ลบ markup ออก เพราะ
           main.js → initLang() จะ return ก่อนถ้าหา .lang-dropdown ไม่เจอ
           ทำให้ภาษาที่ผู้ใช้เลือกไว้ (localStorage 'nmrsw2-lang') หยุดถูกนำไปใช้
           เพราะไม่มีปุ่มเปลี่ยนภาษาให้กดกลับเป็นไทยบนจอเล็กอีกต่อไป */
        @media (max-width: 1024px) {
            .nav-links li.lang-item { display: none; }
        }
