        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: sans-serif;
            background: #f5f5f5;
            color: #333;
        }

        main {
            max-width: 1200px;
            margin: 20px auto;
            padding: 0 10px;
        }

        .module-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
            gap: 20px;
        }

        .module-item {
            background-color: #fff;
            border: 1px solid #ddd;
            border-radius: 6px;
            padding: 6px;
            text-align: center;
            transition: box-shadow 0.2s;
            min-height: 125px;
        }

        .module-item:hover {
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        }

        .module-item img {
            width: 60px;
            height: 60px;
            object-fit: cover;
            margin-bottom: 8px;
        }

        .module-item a {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-decoration: none;
            color: inherit;
            transition: color 0.2s;
            justify-content: center;
            height: 100%;
        }

        .module-item a:hover .label {
            color: #a31e25;
            text-shadow: 0 1px 6px #ffd1d1;
        }

        .label {
            font-size: 0.9rem;
            line-height: 1.2;
        }

        /* module-header (combined & cleaned) */
        .module-header {
            display: flex;
            align-items: flex-start;
            gap: 20px;
            background: #fff;
            border: 1px solid #ddd;
            padding: 12px;
            border-radius: 6px;
            margin-bottom: 20px;
        }

        .module-icon {
            width: 60px;
            height: 60px;
            object-fit: cover;
            flex-shrink: 0;
            margin-right: 12px;
        }

        .module-title {
            font-family: 'Kanit', sans-serif;
            flex: 1 1 0%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            min-width: 180px;
            margin-bottom: 0;
        }

        .module-title h2 {
            font-size: 1.5rem;
            color: #a31e25;
            margin: 0 0 2px 0;
        }

        .subtitle {
            font-size: 1rem;
            color: #007bff;
        }

        .module-header-form {
            font-family: 'Kanit', sans-serif;
            flex: 0 0 55%;
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            min-width: 320px;
            margin-left: auto;
            gap: 0;
        }

        .module-header-form .form-row {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            margin-bottom: 10px;
            width: auto;
            gap: 12px;
        }

        .module-header-form .form-row:last-child {
            margin-bottom: 0;
        }

        .module-header-form .row-academic {
            font-size: 1.2rem;
            font-weight: bold;
            gap: 8px;
            margin-bottom: 14px;
            flex-wrap: wrap;
        }

        .module-header-form .label-academic {
            color: #444;
            font-size: 1.25rem;
        }

        .module-header-form .value-academic {
            color: #007bff;
            font-size: 1.5rem;
            font-weight: bold;
        }

        .module-header-form .label-semester {
            color: #444;
            font-size: 1.25rem;
        }

        .module-header-form .value-semester {
            color: #007bff;
            font-size: 1.5rem;
            font-weight: bold;
        }

        .module-header-form label,
        .module-header-form .checkbox-label {
            color: #444;
            font-weight: 500;
            font-size: 1rem;
            margin-bottom: 0;
            text-align: left;
            flex: 0 0 auto;
            white-space: nowrap;
        }

        .module-header-form .checkbox-label {
            margin-right: 0;
            gap: 8px;
        }

        .module-header-form select,
        .module-header-form input[type="date"] {
            padding: 3px 12px;
            border: 1px solid #ccc;
            border-radius: 4px;
            font-size: 1rem;
            flex: 0 0 auto;
            width: auto;
            min-width: 120px;
            max-width: 180px;
        }

        .module-header-form .row-submit {
            justify-content: flex-start;
            width: auto;
        }

        .module-header-form .submit-btn {
            background: #a31e25;
            color: #fff;
            border: none;
            border-radius: 4px;
            padding: 6px 20px;
            font-size: 1rem;
            cursor: pointer;
            font-weight: bold;
            transition: background 0.15s;
        }

        .module-header-form .submit-btn:hover {
            background: #7c171d;
        }

        /* Responsive (Mobile) */
        @media (max-width:900px) {
            .module-header-form {
                width: 100%;
                min-width: unset;
            }

            .module-header-form .row-submit {
                justify-content: flex-end;
            }

            .module-header {
                flex-direction: column;
                align-items: stretch;
            }

            .module-title {
                margin-bottom: 10px;
            }
        }


        .content-box {
            background: #fff;
            border: 1px solid #ddd;
            border-radius: 6px;
            padding: 24px;
        }

        .content-box h3 {
            font-size: 1.2rem;
            color: #a31e25;
            margin-bottom: 16px;
            border-bottom: 2px solid #a31e25;
            display: inline-block;
            padding-bottom: 4px;
        }

        .feature-overview {
            background: #fff;
            border-color: #ead7d9;
            box-shadow: 0 16px 34px rgba(67, 24, 27, 0.08);
        }

        .feature-overview h3 {
            position: relative;
            display: inline-flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 22px;
            padding: 10px 18px 10px 14px;
            background: #fff;
            color: #a31e25;
            border: 1px solid #ead7d9;
            border-left: 5px solid #a31e25;
            border-radius: 8px;
            box-shadow: 0 8px 18px rgba(67, 24, 27, 0.08);
        }

        .feature-overview h3::before {
            content: "";
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: #a31e25;
            box-shadow: 0 0 0 5px rgba(163, 30, 37, 0.12);
        }

        .top-list {
            counter-reset: feature-card;
            list-style: none;
            margin-top: 6px;
            padding: 0;
            display: grid;
            gap: 16px;
        }

        .top-list>li {
            counter-increment: feature-card;
            position: relative;
            display: block;
            margin-bottom: 0;
            padding: 18px 20px 18px 68px;
            border: 1px solid #e8e7e4;
            border-radius: 8px;
            background: #fff;
            box-shadow: 0 10px 22px rgba(67, 24, 27, 0.06);
            transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
        }

        .top-list>li:hover {
            transform: translateY(-2px);
            border-color: #d9b3b6;
            box-shadow: 0 16px 28px rgba(67, 24, 27, 0.1);
        }

        .top-list>li::before {
            content: counter(feature-card, decimal-leading-zero);
            position: absolute;
            top: 18px;
            left: 20px;
            width: 40px;
            height: 40px;
            display: grid;
            place-items: center;
            border-radius: 8px;
            background: #a31e25;
            color: #fff;
            font-weight: 700;
            font-size: 0.95rem;
            box-shadow: 0 10px 18px rgba(163, 30, 37, 0.18);
        }

        .top-list>li .item-title {
            display: block;
            margin-bottom: 10px;
            min-height: 40px;
            display: flex;
            align-items: center;
            font-size: 1.05rem;
            font-weight: 700;
            color: #7c171d;
            letter-spacing: 0.01em;
            line-height: 1.3;
        }

        .top-list>li>ol {
            margin: 0;
            padding: 0;
            list-style: none;
            display: grid;
            gap: 10px;
        }

        .top-list>li>ol>li {
            margin: 0;
            padding: 12px 14px 12px 12px;
            border-radius: 8px;
            background: #f9fafb;
            border: 1px solid #e5e7eb;
        }

        .top-list>li>ol>li::before {
            content: none;
        }

        .top-list>li>ol>li>a {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            font-size: 0.96rem;
            font-weight: 500;
        }

        .top-list>li>ol>li>a::before {
            content: none;
        }

        .top-list>li>ol>li>ol {
            margin: 10px 0 0;
            padding: 0;
            list-style: none;
            display: grid;
            gap: 8px;
        }

        .top-list>li>ol>li>ol>li {
            margin: 0;
        }

        .top-list>li>ol>li>ol>li::before {
            content: none;
        }

        .top-list>li>ol>li>ol>li>a {
            display: flex;
            align-items: center;
            min-height: 44px;
            padding: 11px 14px 11px 12px;
            border-radius: 8px;
            background: #fff;
            border: 1px solid #dbe7f7;
            font-size: 0.93rem;
            box-shadow: 0 6px 14px rgba(29, 78, 216, 0.05);
        }

        .top-list>li>ol>li>ol>li>a::before {
            content: none;
        }

        .top-list a {
            color: #1d4ed8;
            text-decoration: none;
            transition: color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
        }

        .top-list a:hover {
            color: #a31e25;
            text-decoration: underline;
            text-underline-offset: 3px;
        }

        .top-list>li>ol>li>ol>li>a:hover {
            transform: translateX(2px);
            border-color: #93c5fd;
            box-shadow: 0 10px 18px rgba(29, 78, 216, 0.1);
        }

        footer {
            text-align: center;
            font-size: 0.8rem;
            color: #666;
            margin: 40px 0 20px;
        }

        .report-header {
            display: flex;
            flex-direction: column;
            align-items: center;
            margin: 5px 0 5px 0;
        }

        .report-header .logo {
            width: 130px;
            height: 130px;
            object-fit: contain;
        }

        .report-header .report-title {
            font-size: 1.25rem;
            font-weight: bold;
            margin: 8px 0 2px 0;
            text-align: center;
        }

        .report-header .report-desc {
            font-size: 1.0rem;
            color: #222;
            text-align: center;
            font-weight: bold;
        }

        .table-container {
            display: flex;
            justify-content: center;
            width: 100%;
            margin: 0 auto 32px auto;
        }

        .student-table {
            border-collapse: collapse;
            background: #fff;
            box-shadow: 0 2px 18px rgba(80, 80, 100, 0.10);
            font-size: 0.9rem;
            min-width: 720px;
            max-width: 1200px;
            width: auto;
            margin: 0 auto;
            text-align: center;
        }

        .student-table.fullwidth {
            width: 100%;
            min-width: unset;
            max-width: unset;
        }

        .student-table thead th {
            background: #f5f5f5;
            color: #444;
            font-weight: bold;
            padding: 10px 8px;
            border-bottom: 2px solid #c2c2c2;
            border-right: 1px solid #e0e0e0;
            text-align: center;
        }

        .student-table th:last-child,
        .student-table td:last-child {
            border-right: none;
        }

        .student-table tbody td {
            padding: 8px 6px;
            border-bottom: 1px solid #e9e9e9;
            border-right: 1px solid #f0f0f0;
            vertical-align: middle;
        }

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

        .table-container .student-table tbody tr:hover,
        .table-container .grade-table tbody tr:hover,
        .student-table.fullwidth .student-table tbody tr:hover {
            background: #fff3f3;
        }

        .student-table td,
        .student-table th {
            text-align: center;
        }

        .student-table td.name-col,
        .student-table th.name-col {
            text-align: left;
            padding-left: 16px;
        }

        .student-table .score {
            color: #0b5ed7;
            font-weight: bold;
        }

        .student-table .score-low {
            color: #f3ae1d;
        }

        .student-table .text-green,
        .text-green {
            color: #1dab04;
        }

        .student-table .text-red,
        .text-red {
            color: #cb0f0f;
        }

        .student-table .text-blue,
        .text-blue {
            color: #0b5ed7;
            font-weight: bold;
        }

        .student-table .text-orange,
        .text-orange {
            color: #f3ae1d;
        }

        .student-table .label-box {
            border: 1px solid #55aa55;
            background: #eaffea;
            border-radius: 5px;
            padding: 2px 10px;
            display: inline-block;
            font-size: 0.88em;
            font-weight: 500;
            margin: 0 1px;
        }

        .student-table .label-box.blue {
            border-color: #136be6;
            background: #eaf4ff;
            color: #136be6;
        }

        .student-table .label-box.green {
            border-color: #0fa956;
            background: #e8ffef;
            color: #0fa956;
        }

        .schedule-section {
            overflow: hidden;
        }

        .schedule-report-header {
            margin-bottom: 14px;
        }

        .schedule-report-header .logo {
            width: 96px;
            height: 96px;
        }

        .schedule-report-header .report-title {
            color: #344054;
            font-size: 1.12rem;
            line-height: 1.25;
        }

        .schedule-report-header .report-desc {
            color: #7c171d;
            font-size: 0.96rem;
            line-height: 1.25;
        }

        .schedule-table-container {
            width: 100%;
            overflow-x: auto;
            border: 1px solid #e8dadd;
            border-radius: 10px;
            background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
            box-shadow: 0 12px 26px rgba(67, 24, 27, 0.07);
        }

        .schedule-table {
            width: 100%;
            min-width: 1040px;
            border-collapse: separate;
            border-spacing: 0;
            table-layout: fixed;
            background: #fff;
            color: #344054;
            font-family: 'Kanit', sans-serif;
            font-size: 0.92rem;
            line-height: 1.25;
            text-align: center;
        }

        .schedule-table th,
        .schedule-table td {
            border-right: 1px solid #e6eaef;
            border-bottom: 1px solid #e6eaef;
            transition: background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
        }

        .schedule-table th:last-child,
        .schedule-table td:last-child {
            border-right: none;
        }

        .schedule-table tbody tr:last-child th,
        .schedule-table tbody tr:last-child td {
            border-bottom: none;
        }

        .schedule-table thead th {
            background: #fff7f8;
            color: #7c171d;
            font-size: 0.98rem;
            font-weight: 700;
            padding: 9px 8px;
        }

        .schedule-table thead tr:last-child th {
            background: #f8fafc;
            color: #475467;
            font-size: 1.05rem;
            padding: 8px 6px;
        }

        .schedule-day-head {
            width: 98px;
            vertical-align: middle;
        }

        .schedule-group-head {
            letter-spacing: 0.02em;
        }

        .schedule-lunch-head,
        .schedule-lunch {
            width: 98px;
        }

        .schedule-table tbody th,
        .schedule-table tbody td {
            height: 104px;
            padding: 10px 8px;
            vertical-align: top;
        }

        .schedule-day {
            background: #f8fafc;
            color: #475467;
            font-size: 0.98rem;
            font-weight: 700;
            vertical-align: middle;
        }

        .schedule-entry {
            display: grid;
            gap: 1px;
            padding: 5px 4px;
            border-radius: 8px;
        }

        .schedule-entry + .schedule-entry {
            margin-top: 6px;
            border-top: 1px dashed #d9e2ec;
            padding-top: 9px;
        }

        .schedule-subject {
            color: #2f3a4a;
            font-size: 0.98rem;
            font-weight: 700;
            line-height: 1.15;
        }

        .schedule-teacher,
        .schedule-room {
            color: #475467;
            font-size: 0.88rem;
            font-weight: 500;
            line-height: 1.2;
        }

        .schedule-lunch,
        .schedule-empty {
            color: #667085;
            font-size: 1rem;
            font-weight: 700;
            vertical-align: middle;
        }

        .schedule-table tbody td[data-period]:hover {
            background: #eef7ff;
            box-shadow: inset 0 0 0 999px rgba(14, 116, 184, 0.05);
        }

        .schedule-table tbody td[data-period]:hover .schedule-entry {
            background: rgba(255, 255, 255, 0.68);
            box-shadow: 0 8px 18px rgba(14, 116, 184, 0.10);
        }

        .schedule-table tbody td[data-period]:hover .schedule-subject {
            color: #075985;
        }

        /* Responsive ตารางเลื่อนได้บนจอเล็ก */
        @media (max-width: 900px) {

            .student-table,
            .student-table.fullwidth {
                min-width: 720px;
                width: 100%;
                font-size: 0.87rem;
            }

            .table-container {
                overflow-x: auto;
            }

            .schedule-table-container {
                border-radius: 10px;
            }

            .schedule-table {
                min-width: 900px;
                font-size: 0.86rem;
            }

            .schedule-table tbody th,
            .schedule-table tbody td {
                padding: 9px 7px;
            }

            .schedule-day-head {
                width: 86px;
            }

            .module-header-form {
                width: 100%;
                flex: unset;
                margin-left: 0;
                gap: 8px 0;
            }
        }

        @media (max-width:600px) {
            .module-header-form {
                flex-direction: column;
                align-items: flex-end;
            }

            .module-header-form .form-row,
            .module-header-form .row-academic {
                flex-direction: row;
                flex-wrap: wrap;
                align-items: flex-end;
                width: 100%;
                margin-bottom: 10px;
                gap: 10px;
            }

            .module-header-form label,
            .module-header-form .checkbox-label {
                text-align: right;
                flex: 0 0 auto;
                min-width: 0;
                margin-right: 0;
                margin-bottom: 3px;
                max-width: unset;
            }

            .module-header-form select,
            .module-header-form input[type="date"] {
                width: auto;
                min-width: 100px;
                max-width: 100%;
                margin-bottom: 0;
            }

            .module-header-form .row-academic span {
                font-size: 1.15rem;
            }

            .module-header-form .row-submit {
                width: auto;
                justify-content: flex-end;
            }

            .module-grid {
                grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
                gap: 10px;
            }

            .module-item {
                min-height: 100px;
                padding-top: 12px;
                padding-bottom: 12px;
            }

            .module-item .label {
                font-size: 0.9rem;
            }

            .module-header {
                flex-direction: column;
                text-align: center;
            }

            .module-header img,
            .module-header h2,
            .subtitle {
                margin: 0 auto;
            }

            .module-icon {
                margin-bottom: 12px;
            }

            .content-box {
                padding: 16px;
            }

            .feature-overview h3 {
                width: 100%;
                justify-content: center;
                text-align: center;
                border-radius: 18px;
                padding-left: 18px;
                padding-right: 18px;
            }

            .top-list {
                gap: 12px;
            }

            .top-list>li {
                padding: 16px 12px 16px 56px;
                border-radius: 16px;
            }

            .top-list>li::before {
                left: 16px;
                width: 34px;
                height: 34px;
                border-radius: 12px;
            }

            .top-list>li .item-title {
                margin-bottom: 8px;
                font-size: 1rem;
                min-height: 34px;
            }

            .top-list>li>ol>li {
                padding: 10px 10px 10px 8px;
            }

            .top-list>li>ol>li>ol {
                margin-top: 8px;
            }

            .top-list>li>ol>li>ol>li>a {
                min-height: 40px;
                padding: 10px 10px 10px 8px;
            }

            .report-header {
                margin: 5px 0 5px 0;
            }

            .report-header .logo {
                width: 110px;
                height: 110px;
                object-fit: contain;
            }

            .report-header .report-title {
                font-size: 1.05rem;
                font-weight: bold;
                margin: 4px 0 2px 0;
                text-align: center;
            }

            .report-header .report-desc {
                font-size: 0.8rem;
                color: #222;
                text-align: center;
                font-weight: bold;
            }
        }

        .grade-table {
            border-collapse: collapse;
            background: #fff;
            box-shadow: 0 2px 18px rgba(80, 80, 100, 0.09);
            font-size: 0.9rem;
            min-width: 940px;
            max-width: 1200px;
            width: auto;
            margin: 0 auto;
            text-align: center;
        }

        .grade-table.fullwidth {
            width: 100%;
            min-width: unset;
            max-width: unset;
        }

        .grade-table thead th {
            background: #f5f5f5;
            color: #444;
            font-weight: bold;
            padding: 10px 8px;
            border-bottom: 2px solid #c2c2c2;
            border-right: 1px solid #e0e0e0;
            text-align: center;
        }

        .grade-table th:last-child,
        .grade-table td:last-child {
            border-right: none;
        }

        .grade-table tbody td {
            padding: 8px 6px;
            border-bottom: 1px solid #e9e9e9;
            border-right: 1px solid #f0f0f0;
            vertical-align: middle;
        }

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

        .grade-table td,
        .grade-table th {
            text-align: center;
        }

        .grade-table td.subject-col,
        .grade-table th.subject-col {
            text-align: left;
            padding-left: 16px;
        }

        @media (max-width: 900px) {

            .grade-table,
            .grade-table.fullwidth {
                min-width: 720px;
                width: 100%;
                font-size: 0.87rem;
            }

            .table-container {
                overflow-x: auto;
            }
        }

        /* ฟอร์ม academic row */
        .row-academic {
            display: flex;
            align-items: center;
            gap: 18px;
            font-size: 1.2rem;
            font-weight: bold;
            flex-wrap: wrap;
        }

        .academic-group {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .year-arrow {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 2px;
            border-radius: 3px;
            transition: background 0.15s;
            cursor: pointer;
            text-decoration: none;
            align-self: center;
        }

        .semester-group {
            gap: 2px;
        }

        .year-arrow img {
            width: 10px;
            height: 10px;
            display: block;
            filter: grayscale(30%) brightness(1.1);
            margin: 0;
        }

        .year-arrow:hover {
            background: #f0f0f0;
        }

        .value-academic {
            min-width: 38px;
            text-align: center;
            display: inline-block;
            color: #a31e25;
            font-size: 1.1rem;
            font-weight: bold;
            vertical-align: middle;
            margin: 0 1px;
        }

        .value-semester {
            min-width: 12px;
            text-align: center;
            display: inline-block;
            color: #007bff;
            font-size: 1.1rem;
            font-weight: bold;
            vertical-align: middle;
            margin: 0 1px;
        }

        .label-academic,
        .label-semester {
            color: #444;
            font-size: 1rem;
            vertical-align: middle;
        }

        .label-semester {
            margin-left: 3px;
        }


        /* ทำเนียบรูปภาพ */
        .student-photo-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
            gap: 10px 2px;
            justify-items: center;
            counter-reset: photono;
        }

        .student-card {
            background: #fff;
            border: 1px solid #f3f1f2;
            border-radius: 12px;
            padding: 5px 5px 7px 5px;
            display: flex;
            flex-direction: column;
            align-items: center;
            box-shadow: 0 2px 8px rgba(120, 0, 60, 0.06);
            transition: transform 0.15s, box-shadow 0.15s;
            min-width: 140px;
            max-width: 220px;
            position: relative;
            counter-increment: photono;
        }

        .student-card:hover {
            transform: translateY(-2px) scale(1.03);
            box-shadow: 0 6px 24px rgba(120, 0, 60, 0.11);
        }

        .student-card .photo-frame {
            position: relative;
        }

        .student-card .photo-frame::before {
            content: counter(photono);
            position: absolute;
            top: 212px;
            left: 7px;
            z-index: 2;
            background: #830fa9;
            color: #fff;
            font-size: 0.9rem;
            font-weight: bold;
            border-radius: 50%;
            width: 27px;
            height: 27px;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 2px 8px #0002;
        }

        .photo-frame {
            border: 1px solid #913768;
            border-radius: 8px;
            overflow: hidden;
            width: 190px;
            height: 245px;
            /* 4:3 ratio */
            background: #eef2fb;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .photo-frame img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            object-position: center;
            aspect-ratio: 3/4;
        }

        .student-info {
            width: 100%;
            text-align: center;
        }

        .student-name {
            font-size: 0.9rem;
            margin-bottom: 0px;
        }

        .student-nickname {
            font-weight: 600;
            font-size: 0.9rem;
            color: #009e28;
            margin-bottom: 5px;
        }

        .student-email,
        .student-contact {
            font-size: 0.8rem;
            display: flex;
            align-items: center;
            gap: 6px;
            justify-content: center;
            margin-bottom: 2px;
            word-break: break-all;
        }

        .icon-contact {
            width: 17px;
            height: 17px;
            object-fit: contain;
            opacity: 0.92;
        }

        @media (max-width: 1200px) {
            .student-photo-grid {
                grid-template-columns: repeat(4, 1fr);
            }
        }

        @media (max-width: 900px) {
            .student-photo-grid {
                grid-template-columns: repeat(3, 1fr);
            }
        }

        @media (max-width: 600px) {
            .student-photo-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 10px 3px;
            }

            .student-card {
                max-width: 96vw;
                padding: 7px 1vw 10px 1vw;
            }

            .photo-frame {
                width: 123px;
                height: 160px;
            }

            .student-name {
                font-size: 0.8rem;
            }

            .student-nickname {
                font-size: 0.8rem;
            }

            .student-email,
            .student-contact {
                font-size: 0.7rem;
            }

            .student-card .photo-frame::before {
                content: counter(photono);
                position: absolute;
                top: 130px;
                left: 4px;
                color: #fff;
                font-size: 0.9rem;
                border-radius: 50%;
                width: 24px;
                height: 24px;
            }
        }


        /* Notification Messages */
        .msg {
            margin-left: auto;
            margin-right: auto;
            width: 60%;
            /* หรือ 50%, 70% ตามที่ต้องการ */
            max-width: 640px;
            /* เพื่อไม่ให้ยาวเกิน */
            min-width: 480px;
            padding: 10px 16px;
            border-radius: 6px;
            margin-bottom: 12px;
            font-size: 1rem;
            font-weight: 500;
            display: block;
            letter-spacing: 0.01em;
            box-shadow: 0 1px 8px #0001;
        }

        .msg-success {
            background: #eaffea;
            color: #128100;
            border: 1px solid #77d486;
        }

        .msg-info {
            background: #e5f0ff;
            color: #2166c0;
            border: 1px solid #7bb7f0;
        }

        .msg-error {
            background: #fff3f3;
            color: #c00303;
            border: 1px solid #f199a3;
        }

        .msg-warning {
            background: #fff7e0;
            color: #8a6500;
            border: 1px solid #f5ce6e;
        }

        .msg-standard {
            background: #ffffff;
            color: #000000;
            border: 1px solid #d3d2ce;
        }

        /* Table layout for form */
        .form-table {
            font-family: 'Kanit', sans-serif;
            border-collapse: separate;
            border-spacing: 0 5px;
            margin-bottom: 18px;
            font-size: 0.9rem;
        }

        .form-table td {
            padding: 8px 6px;
            vertical-align: top;
        }

        .form-table label {
            padding: 6px 9px;
            font-weight: 600;
            color: #333;
        }

        .form-table input,
        .form-table select,
        .form-table textarea {
            padding: 6px 9px;
            border: 1px solid #b9b9b9;
            border-radius: 4px;
            font-size: 1rem;
            font-family: inherit;
            transition: border 0.18s;
        }

        .form-table input:focus,
        .form-table select:focus,
        .form-table textarea:focus {
            border: 1.5px solid #3173ff;
            outline: none;
            background: #eaf4ff;
        }

        .form-table button.btn-form {
            margin-right: 8px;
        }

        /* Modern horizontal form */
        .standard-form {
            max-width: 420px;
            margin: 18px 0 0 0;
            background: #f5f9fc;
            border-radius: 8px;
            padding: 22px 18px;
            border: 1px solid #e2eaf1;
        }

        .standard-form .form-row {
            display: flex;
            flex-direction: column;
            margin-bottom: 15px;
        }

        .standard-form label {
            margin-bottom: 4px;
            color: #2252a2;
            font-weight: 500;
        }

        .standard-form input,
        .standard-form select {
            padding: 7px 10px;
            border: 1px solid #b2b8c8;
            border-radius: 5px;
            font-size: 1rem;
            font-family: inherit;
            background: #fff;
            transition: border 0.15s;
        }

        .standard-form input:focus,
        .standard-form select:focus {
            border: 1.5px solid #2c7efa;
            background: #f1f7fe;
        }

        .standard-form button.btn-form {
            margin-top: 4px;
            width: 100%;
        }

        /* Buttons */
        .btn-form {
            background: #3577ef;
            color: #fff;
            padding: 8px 22px;
            border: none;
            border-radius: 5px;
            font-weight: 600;
            font-size: 1rem;
            cursor: pointer;
            transition: background 0.18s;
            box-shadow: 0 1px 8px #0001;
        }

        .btn-form:hover,
        .btn-form:focus {
            background: #2355b6;
        }

        .btn-form.btn-cancel {
            background: #bdbdbd;
            color: #333;
        }

        .btn-form.btn-cancel:hover,
        .btn-form.btn-cancel:focus {
            background: #a9a9a9;
        }

        /* Generic message (div/span ทั่วไป) */
        .generic-message {
            color: #1a3159;
            font-size: 0.99rem;
            margin: 10px 0 0 0;
            display: inline-block;
        }

        /* Responsive สำหรับฟอร์ม */
        @media (max-width: 700px) {

            /* สามารถซ่อนได้ กรณีดูบน mobile */
            .hide-mobile {
                display: none;
            }

            .form-table,
            .form-table td {
                font-size: 0.99rem;
            }

            .form-table input,
            .form-table select,
            .form-table textarea {
                font-size: 0.97rem;
                padding: 5px 6px;
            }

            .standard-form {
                padding: 14px 5vw;
                max-width: 98vw;
            }

            .standard-form label {
                font-size: 0.97rem;
            }

            .standard-form button.btn-form {
                font-size: 1rem;
                padding: 7px 1vw;
            }
        }

        /* ทำให้ table ภายใต้ .form-table จัดกลาง */
        @media (min-width: 700px) {
            form.form-table>table {
                margin-left: auto;
                margin-right: auto;
                /* เลือกกำหนดความกว้าง เช่น */
                /* width: 70%; */
            }
        }


        /* ปรับปุ่มในฟอร์ม table ให้อยู่กลางบนจอเล็ก */
        @media (max-width: 600px) {
            .msg {
                width: 95%;
                min-width: 0;
            }

            .form-table td {
                display: block;
                width: 100%;
                box-sizing: border-box;
            }

            .form-table tr {
                display: block;
                margin-bottom: 8px;
            }

            .form-table label {
                margin-bottom: 2px;
                padding: 0px 0px;
                margin-left: 3px;
            }

            .form-table input,
            .form-table select,
            .form-table textarea {
                width: 100% !important;
                min-width: 10px;
                max-width: 100% !important;
            }

            .form-table input[type="checkbox"],
            .form-table input[type="radio"] {
                width: auto !important;
            }

        }

        /* ปุ่ม print report */
        .print-button-wrapper {
            display: flex;
            justify-content: flex-end;
            margin-top: 12px;
        }

        .btn-print {
            font-family: 'Kanit', sans-serif;
            background-color: #04AA6D;
            color: white;
            border: none;
            border-radius: 6px;
            padding: 8px 20px;
            font-size: 1rem;
            font-weight: bold;
            cursor: pointer;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
            transition: background 0.2s;
        }

        .btn-print:hover {
            background-color: #1edf98;
        }

        /* ซ่อนปุ่มเวลา print */
        @media print {
            .btn-print {
                display: none !important;
            }
        }

.form-actions-cell {
    text-align: center;
}

.date-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.buddhist-date-label {
    min-height: 20px;
    color: #667085;
    font-size: 0.9rem;
    font-weight: 500;
}

.buddhist-date-label.is-valid {
    color: #128100;
}

.buddhist-date-label.is-invalid {
    color: #c00303;
}

.calendar-popup {
    position: absolute;
    z-index: 2000;
    width: 300px;
    padding: 12px;
    border: 1px solid #ead7d9;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 38px rgba(67, 24, 27, 0.16);
    font-family: 'Kanit', sans-serif;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.calendar-title {
    color: #7c171d;
    font-weight: 700;
    text-align: center;
}

.calendar-nav {
    width: 32px;
    height: 32px;
    border: 1px solid #ead7d9;
    border-radius: 8px;
    background: #fff;
    color: #a31e25;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    transition: background 0.18s, border-color 0.18s;
}

.calendar-nav:hover,
.calendar-nav:focus {
    background: #fff3f3;
    border-color: #d9b3b6;
    outline: none;
}

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-weekdays {
    margin-bottom: 6px;
    color: #667085;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
}

.calendar-day {
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #334155;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.92rem;
    transition: background 0.18s, border-color 0.18s, color 0.18s;
}

.calendar-day:hover,
.calendar-day:focus {
    background: #fff3f3;
    border-color: #ead7d9;
    color: #a31e25;
    outline: none;
}

.calendar-day.is-empty {
    pointer-events: none;
}

.calendar-day.is-today {
    border-color: #93c5fd;
    color: #1d4ed8;
    font-weight: 700;
}

.calendar-day.is-selected {
    background: #a31e25;
    border-color: #a31e25;
    color: #fff;
    font-weight: 700;
}

.chart-panel {
    width: 100%;
    max-width: 600px;
    margin: auto;
    overflow-x: auto;
    overflow-y: hidden;
}

.chart-wrapper {
    width: 100%;
    max-width: 100%;
    text-align: center;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 0 auto;
}

.chart-scroll {
    min-width: 300px;
    padding-bottom: 10px;
}

.chart-primary {
    margin-bottom: 32px;
}

@media (max-width: 600px) {
    .chart-panel canvas {
        min-width: 300px;
    }
}
