/* 
   ==========================================================================
   MODERN VANILLA CSS DESIGN SYSTEM (REFINED FOR CODEX)
   Primary Colors: Black, White Soft, White, Blue Dark, Red Dark, Gray 800
   ========================================================================== 
*/

@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700;800;900&display=swap');

/* --- Define Hybrid Font --- */
@font-face {
    font-family: 'HybridFont';
    font-style: normal;
    font-weight: 300;
    src: local('Sarabun Light'), local('Sarabun-Light'), 
         url('https://fonts.gstatic.com/s/sarabun/v17/DtVjJx26TKEr37c9aAFJn2QN.woff2') format('woff2');
    unicode-range: U+00A0, U+0108, U+0118, U+014A, U+017F, U+019E, U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+20AB, U+25CC;
}
@font-face {
    font-family: 'HybridFont';
    font-style: normal;
    font-weight: 400;
    src: local('Sarabun Regular'), local('Sarabun-Regular'), 
         url('https://fonts.gstatic.com/s/sarabun/v17/DtVjJx26TKEr37c9aAFJn2QN.woff2') format('woff2');
    unicode-range: U+00A0, U+0108, U+0118, U+014A, U+017F, U+019E, U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+20AB, U+25CC;
}
@font-face {
    font-family: 'HybridFont';
    font-style: normal;
    font-weight: 500;
    src: local('Sarabun Medium'), local('Sarabun-Medium'), 
         url('https://fonts.gstatic.com/s/sarabun/v17/DtVjJx26TKEr37c9aAFJn2QN.woff2') format('woff2');
    unicode-range: U+00A0, U+0108, U+0118, U+014A, U+017F, U+019E, U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+20AB, U+25CC;
}
@font-face {
    font-family: 'HybridFont';
    font-style: normal;
    font-weight: 700;
    src: local('Sarabun Bold'), local('Sarabun-Bold'), 
         url('https://fonts.gstatic.com/s/sarabun/v17/DtVmJx26TKEr37c9YK5sik8s6zDX.woff2') format('woff2');
    unicode-range: U+00A0, U+0108, U+0118, U+014A, U+017F, U+019E, U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+20AB, U+25CC;
}

/* Reset and Core Variables */
:root {
    --font-primary: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --theme-transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);

    /* Core 6 Colors mapped for Light Theme by default */
    --black: #090b11;
    --white-soft: #f8fafc;
    --white: #ffffff;
    --blue-dark: #1d4ed8;
    --red-dark: #b91c1c;
    --gray-800: #1e293b;

    /* Semantic Mappings for Light Theme (Original app defaults) */
    --app-bg: var(--white-soft);           /* #f8fafc */
    --app-surface: var(--white);           /* #ffffff */
    --app-text: var(--black);              /* #090b11 */
    --app-muted: #64748b;
    --app-border: rgba(9, 11, 17, 0.08);   
    --border-glass: rgba(9, 11, 17, 0.08);
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    --shadow-sm: 0 4px 12px rgba(9, 11, 17, 0.05);
    --shadow-md: 0 12px 28px rgba(9, 11, 17, 0.08);
    --shadow-blue: 0 0 16px rgba(29, 78, 216, 0.25);
    --shadow-red: 0 0 16px rgba(185, 28, 28, 0.25);
}

/* Reset settings */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary) !important;
    background-color: var(--app-bg) !important;
    color: var(--app-text) !important;
    font-size: 14px; /* เนื้อหา 14 */
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* Typography elements */
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-primary) !important;
    font-weight: 700 !important;
    color: var(--app-text) !important;
    font-size: 16px !important; /* หัวข้อสำคัญ 16 */
    margin-bottom: 0.5rem;
}

p {
    font-size: 14px !important; /* เนื้อหา 14 */
    color: var(--app-text) !important;
    opacity: 0.85;
    margin-bottom: 1.25rem;
}

/* Sidebar Navigation (Re-styled using system variables) */
.sidebar {
    width: 240px;
    height: 100vh;
    background-color: var(--white) !important;
    border-right: 1px solid var(--border-glass) !important;
    position: fixed;
    top: 0;
    left: 0;
    padding: 1.5rem 0.85rem;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1040;
    transition: transform 0.24s ease;
    box-shadow: none !important;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 1030;
    display: none;
    border: 0;
    padding: 0;
    background: rgba(15, 23, 42, 0.58) !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

body.sidebar-open {
    overflow: hidden;
    touch-action: none;
}

body.sidebar-open #sidebarOverlay {
    opacity: 1;
    pointer-events: auto;
}

.app-brand-lockup {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--app-text) !important;
    font-weight: 800;
}

.app-brand-sidebar,
.app-brand-mobile {
    flex-direction: column !important;
    gap: 0.45rem !important;
    text-align: center;
    line-height: 1.12;
}

.app-brand-sidebar {
    padding: 0.25rem 0.5rem 0.75rem;
    margin-bottom: 1.5rem;
}

.mobile-topbar {
    display: none;
}

.app-brand-logo {
    display: block;
    width: 4.75rem;
    height: auto;
    object-fit: contain;
}

.app-brand-sidebar .app-brand-logo {
    width: 5.25rem;
}

.app-brand-name {
    display: block;
    color: var(--app-text);
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 0;
}

.app-brand-sidebar .app-brand-name {
    font-size: 1.05rem;
}

.app-brand-mobile .app-brand-logo {
    width: 2.8rem;
}

.app-brand-mobile .app-brand-name {
    font-size: 0.78rem;
}

.menu a {
    display: flex; 
    align-items: center; 
    gap: 10px;           
    padding: 10px 12px;   
    margin-bottom: 4px;  
    border-radius: var(--radius-sm) !important; 
    text-decoration: none; 
    color: var(--gray-800) !important; 
    font-weight: 700; 
    font-size: 14px; 
    transition: var(--theme-transition);
}

.menu a svg {
    width: 2.25rem !important;
    height: 2.25rem !important;
    flex: 0 0 2.25rem;
    padding: .5rem;
    border-radius: var(--radius-sm) !important;
    background: rgba(29, 78, 216, 0.08); 
    color: var(--blue-dark) !important;
    transition: var(--theme-transition);
}

.menu a:hover {
    background-color: var(--white-soft) !important;
    color: var(--black) !important;
    transform: translateX(3px);
}

.menu a:hover svg {
    background-color: var(--blue-dark);
    color: var(--white) !important;
}

.menu a.active-menu {
    background: rgba(29, 78, 216, 0.08) !important;
    color: var(--blue-dark) !important;
    border-left: 4px solid var(--blue-dark) !important;
    border-top-left-radius: 0px !important;
    border-bottom-left-radius: 0px !important;
    border-top-right-radius: var(--radius-sm) !important;
    border-bottom-right-radius: var(--radius-sm) !important;
    font-weight: 800 !important;
}

.menu a.active-menu svg {
    background-color: var(--blue-dark);
    color: var(--white) !important;
}

.menu a.logout {
    background: rgba(185, 28, 28, 0.08) !important;
    color: var(--red-dark) !important;
    margin-top: 20px;
}

.menu a.logout svg {
    background: rgba(185, 28, 28, 0.1);
    color: var(--red-dark) !important;
}

.menu a.logout:hover {
    background: var(--red-dark) !important;
    color: var(--white) !important;
    transform: none;
}

.menu a.logout:hover svg {
    background-color: rgba(255,255,255,0.15);
    color: var(--white) !important;
}

.homeroom-menu {
    border-left: 3px solid rgba(29, 78, 216, 0.5) !important;
}

.content-wrapper {
    margin-left: 240px;
    padding: 2rem;
    min-height: 100vh;
}

.app-top-menu {
    display: none;
}

.navbar {
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--app-border);
    background: var(--white);
    transition: var(--theme-transition);
}

.navbar-container {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border-radius: var(--radius-sm);
    color: var(--app-muted) !important;
    font-size: 14px !important;
    font-weight: 800;
    line-height: 1;
    text-decoration: none !important;
    transition: var(--theme-transition);
    white-space: nowrap;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-top-menu-inner {
    max-width: none;
    padding: 0 !important;
}

.app-top-links {
    min-width: 0;
    flex: 1 1 auto;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.app-top-links::-webkit-scrollbar {
    display: none;
}

.app-top-link,
.app-top-logout {
    min-height: 2.45rem;
    padding: 0.55rem 0.85rem;
}

.app-top-menu .nav-link {
    position: relative;
    background: transparent !important;
}

.app-top-menu .nav-link::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -0.65rem;
    width: 0;
    height: 3px;
    border-radius: 999px;
    background: var(--blue-dark);
    transform: translateX(-50%);
    transition: var(--theme-transition);
}

.app-top-link:hover,
.app-top-link.active,
.app-top-link.active-menu {
    color: var(--blue-dark) !important;
}

.app-top-link:hover::after,
.app-top-link.active::after,
.app-top-link.active-menu::after {
    width: 72%;
}

.app-top-actions {
    flex: 0 0 auto;
    margin-left: auto;
}

.app-top-logout {
    background: rgba(185, 28, 28, 0.08) !important;
    color: var(--red-dark) !important;
}

.app-top-logout::after {
    display: none !important;
}

.app-top-logout:hover {
    background: var(--red-dark) !important;
    color: var(--white) !important;
}

.app-top-logout svg {
    width: 1.15rem !important;
    height: 1.15rem !important;
    color: currentColor !important;
}

@media (min-width: 1024px) {
    .app-top-menu {
        position: fixed;
        top: 0;
        right: 0;
        left: 240px;
        z-index: 1035;
        display: flex !important;
        min-height: 4.25rem;
        align-items: center;
        border-bottom: 1px solid var(--app-border);
        background: var(--white) !important;
        padding: 0.75rem 2rem;
        box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
    }

    .content-wrapper {
        padding-top: 5.75rem !important;
    }

    .mobile-sidebar-logout {
        display: none !important;
    }
}

@media (max-width: 1023px) {
    .mobile-topbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1050;
        display: flex !important;
        justify-content: space-between;
        min-height: 4.85rem;
        align-items: center !important;
        border-bottom: 1px solid var(--app-border);
        background-color: var(--white) !important;
        box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06) !important;
        padding: 0.55rem 1rem !important;
    }

    .mobile-menu-btn {
        width: 2.65rem !important;
        height: 2.65rem !important;
        flex: 0 0 2.65rem !important;
        border: 1px solid var(--app-border) !important;
        border-radius: var(--radius-sm) !important;
        background-color: var(--white) !important;
        color: var(--app-text) !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08) !important;
    }

    .mobile-top-actions {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 0.5rem !important;
    }

    .mobile-logout-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.35rem !important;
        min-height: 2.65rem !important;
        padding: 0 0.75rem !important;
        border: 1px solid rgba(185, 28, 28, 0.18) !important;
        border-radius: var(--radius-sm) !important;
        background: #fff1f2 !important;
        color: var(--red-dark) !important;
        font-size: 0.78rem !important;
        font-weight: 900 !important;
        line-height: 1 !important;
        text-decoration: none !important;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08) !important;
    }

    .mobile-logout-btn svg {
        width: 1.05rem !important;
        height: 1.05rem !important;
        color: currentColor !important;
        stroke: currentColor !important;
    }

    .mobile-menu-btn svg {
        width: 1.35rem !important;
        height: 1.35rem !important;
        color: var(--app-text) !important;
        stroke: currentColor !important;
    }

    .app-brand-mobile {
        align-items: flex-start !important;
        justify-content: center !important;
        min-width: 5.25rem;
    }

    .app-brand-mobile .app-brand-logo {
        width: 3.25rem;
    }

    .app-brand-mobile .app-brand-name {
        font-size: 0.76rem;
        line-height: 1;
    }

    .sidebar {
        width: min(82vw, 18rem) !important;
        max-width: 18rem;
        display: flex !important;
        flex-direction: column !important;
        transform: translateX(-105%);
        border-right: 1px solid var(--app-border) !important;
        background-color: var(--white) !important;
        opacity: 1 !important;
        padding: 1rem 0.85rem 1.25rem !important;
        overflow: hidden !important;
        box-shadow: 8px 0 24px rgba(15, 23, 42, 0.14) !important;
    }

    .sidebar.open { transform: translateX(0); }

    .sidebar-overlay {
        display: block;
        background-color: rgba(15, 23, 42, 0.52) !important;
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
    }

    .sidebar .app-brand-sidebar {
        flex: 0 0 auto !important;
        margin-bottom: 0.95rem !important;
        padding-bottom: 0.95rem;
        border-bottom: 1px solid var(--app-border);
    }

    .sidebar .app-brand-sidebar .app-brand-logo {
        width: 3.6rem;
    }

    .sidebar .app-brand-sidebar .app-brand-name {
        font-size: 0.8rem;
    }

    .sidebar .menu {
        display: flex !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        flex-direction: column !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-right: 0.25rem !important;
        scrollbar-width: thin;
    }

    .menu a {
        min-height: 2.7rem;
        gap: 0.75rem;
        padding: 0.48rem 0.65rem !important;
        margin-bottom: 0.28rem;
        font-size: 0.82rem !important;
    }

    .menu a svg {
        width: 2.1rem !important;
        height: 2.1rem !important;
        flex-basis: 2.1rem !important;
        padding: 0.48rem;
    }
.menu a:hover {
        transform: none;
    }

    .menu a.mobile-sidebar-logout {
        position: sticky !important;
        bottom: 0 !important;
        z-index: 2 !important;
        margin-top: 0.75rem !important;
        margin-bottom: 0 !important;
        border: 1px solid rgba(185, 28, 28, 0.18) !important;
        background: #fff1f2 !important;
        box-shadow: 0 -8px 16px rgba(255, 255, 255, 0.92) !important;
    }

    .content-wrapper { margin-left: 0 !important; padding-top: 6rem !important; }
}

@media (max-width: 640px) {
    .content-wrapper {
        padding-left: 0.85rem !important;
        padding-right: 0.85rem !important;
        padding-bottom: 1.25rem !important;
    }
}

@media (max-width: 380px) {
    .mobile-topbar {
        min-height: 4.55rem;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .app-brand-mobile .app-brand-logo {
        width: 2.85rem;
    }

    .app-brand-mobile .app-brand-name {
        font-size: 0.7rem;
    }

    .mobile-menu-btn {
        width: 2.35rem !important;
        height: 2.35rem !important;
        flex-basis: 2.35rem !important;
    }

    .mobile-logout-btn {
        width: 2.35rem !important;
        min-height: 2.35rem !important;
        padding: 0 !important;
    }

    .mobile-logout-btn span {
        display: none !important;
    }
}

/* Card Styling */
.card, .content-wrapper .card, .content-wrapper section, .content-wrapper article, .content-wrapper .student-standard-hero, .content-wrapper .student-standard-card {
    background-color: var(--app-surface) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--radius-md) !important;
    padding: 1.5rem !important;
    box-shadow: var(--shadow-sm) !important;
    transition: var(--theme-transition);
}

.card:hover, .content-wrapper .card:hover, .content-wrapper .student-standard-card:hover {
    border-color: var(--blue-dark) !important;
    box-shadow: var(--shadow-md) !important;
}

.card h1, .card h2, .card h3, .card h4, .card h5, .card h6 {
    margin-top: 0;
}

/* Button Component */
.btn, .tw-btn, .content-wrapper button[class*="rounded"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    font-family: var(--font-primary) !important;
    font-size: 14px !important; /* เมนู ขนาด 14 */
    font-weight: 700 !important;
    border-radius: var(--radius-sm) !important;
    border: 1px solid transparent !important;
    cursor: pointer;
    transition: var(--theme-transition);
    outline: none;
    text-decoration: none !important;
    line-height: 1.2;
    white-space: nowrap;
}

.btn:active, .tw-btn:active {
    transform: scale(0.97);
}

.btn-sm, .tw-btn-sm {
    padding: 0.42rem 0.75rem !important;
    font-size: 12px !important;
    line-height: 1.2;
    gap: 0.25rem;
}

.btn-primary, .tw-btn-input, .content-wrapper .bg-brand-600, .content-wrapper .bg-blue-600, .content-wrapper .bg-sky-600 {
    background-color: var(--blue-dark) !important;
    color: var(--white) !important;
    border-color: var(--blue-dark) !important;
}

.btn-primary:hover, .tw-btn-input:hover, .content-wrapper .bg-brand-600:hover, .content-wrapper .bg-blue-600:hover {
    filter: brightness(1.1);
    box-shadow: var(--shadow-blue) !important;
}

.btn-secondary, .tw-btn-output, .tw-btn-muted, .content-wrapper .border-slate-300 {
    background-color: var(--white) !important;
    border: 1px solid var(--app-border) !important;
    color: var(--blue-dark) !important;
}

.btn-secondary:hover, .tw-btn-output:hover, .tw-btn-muted:hover {
    background-color: var(--white-soft) !important;
    border-color: var(--blue-dark) !important;
}

.btn-red, .btn-delete, .tw-btn-delete {
    background-color: rgba(185, 28, 28, 0.08) !important;
    border: 1px solid rgba(185, 28, 28, 0.2) !important;
    color: var(--red-dark) !important;
}

.btn-red:hover, .btn-delete:hover, .tw-btn-delete:hover {
    background-color: var(--red-dark) !important;
    color: var(--white) !important;
    box-shadow: var(--shadow-red) !important;
}

.btn-edit, .tw-btn-edit {
    background-color: #15803d !important;
    border: 1px solid #15803d !important;
    color: var(--white) !important;
}

.btn-edit:hover, .tw-btn-edit:hover {
    filter: brightness(1.1);
    box-shadow: 0 8px 20px rgba(21, 128, 61, 0.25) !important;
}

.btn-add, .tw-btn-add {
    background-color: var(--blue-dark) !important;
    border: 1px solid var(--blue-dark) !important;
    color: var(--white) !important;
}

.btn-add:hover, .tw-btn-add:hover {
    filter: brightness(1.1);
    box-shadow: var(--shadow-blue) !important;
}

.btn-back, .tw-btn-back {
    background-color: var(--gray-800) !important;
    border: 1px solid var(--gray-800) !important;
    color: var(--white-soft) !important;
}

.btn-back:hover, .tw-btn-back:hover {
    background-color: var(--black) !important;
    color: var(--white) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
}

/* Badges Component */
.badge, .tw-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem !important;
    font-weight: 800 !important;
    border-radius: var(--radius-sm) !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid transparent !important;
    line-height: 1;
    white-space: nowrap;
}

.badge-blue, .tw-badge-year {
    background-color: rgba(29, 78, 216, 0.08) !important;
    color: var(--blue-dark) !important;
    border-color: rgba(29, 78, 216, 0.15) !important;
}

.badge-red {
    background-color: rgba(185, 28, 28, 0.08) !important;
    color: var(--red-dark) !important;
    border-color: rgba(185, 28, 28, 0.15) !important;
}

.badge-gray, .tw-badge {
    background-color: var(--white-soft) !important;
    color: var(--app-muted) !important;
    border-color: var(--app-border) !important;
}

/* Form inputs & controls */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    margin-bottom: 0.5rem;
    color: var(--app-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-control, .content-wrapper input:not([type="checkbox"]):not([type="radio"]), .content-wrapper select, .content-wrapper textarea {
    width: 100% !important;
    padding: 0.65rem 0.9rem !important;
    font-family: var(--font-primary) !important;
    font-size: 14px !important; /* เนื้อหา 14 */
    background-color: var(--white) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--radius-sm) !important;
    color: var(--app-text) !important;
    outline: none;
    box-shadow: none !important;
    transition: var(--theme-transition);
}

.form-control:focus, .content-wrapper input:not([type="checkbox"]):not([type="radio"]):focus, .content-wrapper select:focus, .content-wrapper textarea:focus {
    border-color: var(--blue-dark) !important;
    box-shadow: 0 0 10px rgba(29, 78, 216, 0.15) !important;
}

.form-control.control-error {
    border-color: var(--red-dark) !important;
}

.form-control.control-error:focus {
    box-shadow: 0 0 10px rgba(185, 28, 28, 0.15) !important;
}

/* Score input grid */
.score-table input.score-box[type="number"],
.score-table .score-box.form-control,
.content-wrapper .score-table input.score-box[type="number"] {
    width: 3.35rem !important;
    min-width: 3.35rem !important;
    height: 2.75rem !important;
    padding: 0.25rem 0.35rem !important;
    text-align: center !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    color: var(--app-text) !important;
    background-color: var(--white) !important;
    border: 1px solid rgba(9, 11, 17, 0.12) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: none !important;
    caret-color: var(--blue-dark) !important;
}

.score-table input.score-box[type="number"]:focus,
.content-wrapper .score-table input.score-box[type="number"]:focus {
    border-color: var(--blue-dark) !important;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14) !important;
}

.score-table input.score-box[type="number"]::-webkit-outer-spin-button,
.score-table input.score-box[type="number"]::-webkit-inner-spin-button {
    margin: 0 !important;
    -webkit-appearance: none !important;
}

.score-table input.score-box[type="number"] {
    appearance: textfield !important;
    -moz-appearance: textfield !important;
}

/* Custom Checkboxes and Radios */
.form-checkbox, .form-radio {
    appearance: none !important;
    -webkit-appearance: none !important;
    background-color: var(--white) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--radius-sm) !important;
    width: 20px !important;
    height: 20px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    vertical-align: middle !important;
    transition: var(--theme-transition) !important;
    position: relative !important;
    outline: none !important;
}

.form-radio {
    border-radius: var(--radius-full) !important;
}

.form-checkbox:hover, .form-radio:hover {
    border-color: var(--blue-dark) !important;
}

.form-checkbox:focus, .form-radio:focus {
    border-color: var(--blue-dark) !important;
}

.form-checkbox:checked {
    background-color: var(--blue-dark) !important;
    border-color: var(--blue-dark) !important;
}

.form-radio:checked {
    background-color: var(--white) !important;
    border-color: var(--blue-dark) !important;
}

.form-checkbox:checked::before {
    content: "" !important;
    width: 10px !important;
    height: 5px !important;
    border-left: 2.5px solid var(--white) !important;
    border-bottom: 2.5px solid var(--white) !important;
    transform: rotate(-45deg) translate(0.5px, -0.5px) !important;
    position: absolute !important;
}

.form-radio:checked::before {
    content: "" !important;
    width: 8px !important;
    height: 8px !important;
    background-color: var(--blue-dark) !important;
    border-radius: var(--radius-full) !important;
    position: absolute !important;
}

.checkbox-label, .radio-label {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 14px !important; /* เนื้อหา 14 */
    color: var(--app-text) !important;
    cursor: pointer;
    user-select: none;
    margin-right: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 400;
}

/* Switch Toggles */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--white);
    border: 1px solid var(--app-border);
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius-full);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px; width: 16px;
    left: 3px; bottom: 3px;
    background-color: var(--gray-800);
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
}

.switch input:checked + .slider {
    background-color: var(--blue-dark);
    border-color: var(--blue-dark);
}

.switch input:checked + .slider:before {
    transform: translateX(20px);
    background-color: var(--white);
}

.switch-red input:checked + .slider {
    background-color: var(--red-dark);
    border-color: var(--red-dark);
}

/* Tables Styling */
table, .table-modern, .content-wrapper table {
    width: 100%;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    margin-top: 1rem;
    background-color: var(--app-surface) !important;
}

.content-wrapper .overflow-x-auto {
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--app-border) !important;
    overflow-x: auto;
}

th, td, .table-modern th, .table-modern td, .content-wrapper table th, .content-wrapper table td {
    padding: 1rem 1.25rem !important;
    font-size: 14px !important; /* เนื้อหา 14 */
    color: var(--app-text) !important;
    border-bottom: 1px solid var(--app-border) !important;
    text-align: left;
    vertical-align: middle;
}

thead th, .table-modern thead th, .content-wrapper table thead th {
    background-color: var(--white-soft) !important;
    color: var(--app-text) !important;
    font-size: 16px !important; /* หัวข้อสำคัญ 16 */
    font-weight: 700 !important;
    border-bottom: 2px solid var(--app-border) !important;
    letter-spacing: 0.025em;
}

tbody tr:hover, .table-modern tr:hover, .content-wrapper table tbody tr:hover {
    background-color: rgba(29, 78, 216, 0.02) !important;
}

.table-striped tbody tr:nth-child(even) td {
    background-color: rgba(9, 11, 17, 0.015) !important;
}

/* Custom Tabs */
.custom-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: -1px;
    position: relative;
    z-index: 10;
}

.custom-tab-link {
    padding: 10px 24px;
    font-size: 14px !important; /* เมนู ขนาด 14 */
    color: var(--app-muted);
    text-decoration: none;
    background: var(--white-soft);
    border: 1px solid var(--app-border);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: var(--theme-transition);
}

.custom-tab-link.active {
    background-color: var(--white);
    color: var(--blue-dark) !important;
    font-weight: 700;
    border-bottom: 2px solid var(--white);
}

/* Modal and Overlays */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(9, 11, 17, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background-color: var(--white);
    border: 1px solid var(--app-border);
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9) translateY(-10px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

.modal-overlay.show .modal-box {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--app-border);
}

.modal-title {
    font-size: 16px !important; /* หัวข้อสำคัญ 16 */
    font-weight: 700;
    color: var(--app-text);
}

.modal-close {
    background: none;
    border: none;
    color: var(--app-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
    transition: var(--theme-transition);
}

.modal-close:hover {
    color: var(--app-text);
    opacity: 1;
}

.modal-body {
    padding: 1.5rem;
    font-size: 14px !important; /* เนื้อหา 14 */
    color: var(--app-text);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    background-color: var(--white-soft);
    border-top: 1px solid var(--app-border);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: var(--gray-800);
    border: 1px solid var(--border-glass);
    color: var(--white);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    transform: translateY(150%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 3000;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-primary);
    font-size: 14px !important; /* เนื้อหา 14 */
}

.toast.show {
    transform: translateY(0);
}

.toast-info {
    border-color: var(--blue-dark);
    box-shadow: 0 4px 15px rgba(29, 78, 216, 0.15);
}

.toast-danger {
    border-color: var(--red-dark);
    box-shadow: 0 4px 15px rgba(185, 28, 28, 0.15);
}

/* Alert boxes */
.alert-box {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.2rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.55;
}

.alert-info {
    background-color: rgba(29, 78, 216, 0.08);
    border-color: rgba(29, 78, 216, 0.22);
    color: var(--blue-dark);
}

.alert-danger {
    background-color: rgba(185, 28, 28, 0.08);
    border-color: rgba(185, 28, 28, 0.22);
    color: var(--red-dark);
}

.alert-success {
    background-color: rgba(21, 128, 61, 0.08);
    border-color: rgba(21, 128, 61, 0.22);
    color: #15803d;
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.26);
    color: #92400e;
}

/* Minimal tables: horizontal row lines only */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--app-border);
    border-radius: var(--radius-md);
    background-color: var(--white);
}

.table-custom,
.table-minimal {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    background-color: var(--white);
    text-align: left;
}

.table-custom th,
.table-minimal th {
    padding: 0.9rem 1.25rem;
    border: 0;
    border-bottom: 3px double var(--app-border);
    background-color: var(--white);
    color: var(--app-text);
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

.table-custom td,
.table-minimal td {
    padding: 0.95rem 1.25rem;
    border: 0;
    border-bottom: 1px solid var(--app-border);
    color: var(--app-muted);
    font-size: 14px;
    vertical-align: middle;
}

.table-custom tbody tr:last-child td,
.table-minimal tbody tr:last-child td {
    border-bottom: 0;
}

.table-custom tbody tr:hover td,
.table-minimal tbody tr:hover td {
    background-color: var(--white-soft);
    color: var(--app-text);
}

/* Interactive tabs */
.tabs-nav-underline {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    border-bottom: 1px solid var(--app-border);
    margin: 0 0 1.5rem 0;
    padding: 0;
    list-style: none;
}

.tabs-nav-underline .tab-btn {
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.75rem 0.25rem;
    font-family: var(--font-primary);
    font-size: 14px;
    color: var(--app-muted);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    opacity: 0.85;
    transition: var(--theme-transition);
}

.tabs-nav-underline .tab-btn:hover,
.tabs-nav-underline .tab-btn.active {
    color: var(--blue-dark);
    opacity: 1;
}

.tabs-nav-underline .tab-btn.active {
    border-bottom-color: var(--blue-dark);
}

.tabs-nav-pills {
    display: inline-flex;
    gap: 0.25rem;
    margin: 0 0 1.5rem 0;
    padding: 0.25rem;
    list-style: none;
    background-color: var(--white-soft);
    border: 1px solid var(--app-border);
    border-radius: var(--radius-sm);
}

.tabs-nav-pills .tab-btn {
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 0.6rem 1.2rem;
    font-family: var(--font-primary);
    font-size: 14px;
    color: var(--app-muted);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: var(--theme-transition);
}

.tabs-nav-pills .tab-btn:hover {
    color: var(--app-text);
}

.tabs-nav-pills .tab-btn.active {
    background-color: var(--blue-dark);
    color: var(--white);
}

.tab-panel {
    display: none;
    animation: tabFadeIn 0.25s ease;
}

.tab-panel.active {
    display: block;
}

@keyframes tabFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Loading animations */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--app-border);
    border-top: 3px solid var(--blue-dark);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
    display: inline-block;
}

.spinner-red {
    border-top-color: var(--red-dark);
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2.5px;
}

.pulse-dots {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--blue-dark);
    border-radius: var(--radius-full);
    animation: pulseDot 1.4s infinite ease-in-out both;
}

.pulse-dot:nth-child(1) { animation-delay: -0.32s; }
.pulse-dot:nth-child(2) { animation-delay: -0.16s; }
.pulse-dot-red { background-color: var(--red-dark); }

.skeleton-line {
    height: 16px;
    width: 100%;
    margin-bottom: 0.75rem;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, var(--white-soft) 25%, rgba(255,255,255,0.85) 37%, var(--white-soft) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 1rem;
}

.progress-loader {
    width: 100%;
    height: 4px;
    background-color: var(--white-soft);
    border: 1px solid var(--app-border);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-loader-bar {
    width: 40%;
    height: 100%;
    background-color: var(--blue-dark);
    border-radius: var(--radius-full);
    position: absolute;
    left: -40%;
    animation: sweep 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    box-shadow: var(--shadow-blue);
}

.progress-loader-red .progress-loader-bar {
    background-color: var(--red-dark);
    box-shadow: var(--shadow-red);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulseDot {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

@keyframes shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

@keyframes sweep {
    0% { left: -40%; }
    100% { left: 100%; }
}

/* Chart components */
.chart-card {
    background-color: var(--white);
    border: 1px solid var(--app-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: var(--theme-transition);
}

.chart-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 180px;
    padding-top: 1.5rem;
    border-bottom: 2px solid var(--app-border);
    position: relative;
    margin-bottom: 1rem;
}

.bar-column-wrap {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

.bar-column {
    width: 50%;
    max-width: 32px;
    height: 0;
    background: linear-gradient(180deg, var(--blue-dark) 0%, rgba(29, 78, 216, 0.35) 100%);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    cursor: pointer;
    position: relative;
    transition: height 1.2s cubic-bezier(0.25, 0.8, 0.25, 1), filter 0.2s ease;
}

.bar-column:hover {
    filter: brightness(1.12);
    box-shadow: var(--shadow-blue);
}

.bar-column-red {
    background: linear-gradient(180deg, var(--red-dark) 0%, rgba(185, 28, 28, 0.35) 100%);
}

.bar-label {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--app-muted);
    font-weight: 700;
}

.donut-chart {
    position: relative;
    width: 150px;
    height: 150px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem auto;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease;
}

.donut-chart:hover {
    transform: scale(1.03);
}

.donut-hole {
    width: 96px;
    height: 96px;
    border-radius: var(--radius-full);
    background-color: var(--white);
    border: 1px solid var(--app-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--app-text);
    z-index: 2;
}

.donut-label-val {
    font-size: 1.25rem;
    font-weight: 800;
}

.donut-label-title {
    font-size: 0.7rem;
    color: var(--app-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.line-chart-svg {
    width: 100%;
    height: 180px;
    background-color: var(--white);
    border: 1px solid var(--app-border);
    border-radius: var(--radius-sm);
    overflow: visible;
}

.line-chart-grid {
    stroke: var(--app-border);
    stroke-width: 1;
    stroke-dasharray: 4 4;
}

.line-chart-path {
    stroke: var(--blue-dark);
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke-dashoffset 2s ease;
}

.line-chart-path-red {
    stroke: var(--red-dark);
}

.line-chart-point {
    fill: var(--white);
    stroke: var(--blue-dark);
    stroke-width: 3;
    cursor: pointer;
    transition: r 0.2s ease, fill 0.2s ease;
}

.line-chart-point:hover {
    r: 6;
    fill: var(--blue-dark);
}

/* Custom Select Dropdown Styles (select-custom & custom-select) */
.custom-select, .select-custom {
    position: relative;
    width: 100%;
}

.custom-select-trigger, .select-custom-trigger {
    width: 100%;
    padding: 0.75rem 1rem !important;
    font-family: var(--font-primary) !important;
    font-size: 14px !important; /* เนื้อหา 14 */
    background-color: var(--white) !important;
    color: var(--app-text) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--radius-sm) !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    cursor: pointer !important;
    transition: var(--theme-transition) !important;
    user-select: none !important;
}

.custom-select-trigger:after, .select-custom-trigger:after {
    content: '▼' !important;
    font-size: 0.65rem !important;
    color: var(--app-muted) !important;
    transition: transform 0.3s ease !important;
}

.custom-select.open .custom-select-trigger, 
.select-custom.open .select-custom-trigger {
    border-color: var(--blue-dark) !important;
    box-shadow: 0 0 10px rgba(29, 78, 216, 0.15) !important;
}

.custom-select.open .custom-select-trigger:after, 
.select-custom.open .select-custom-trigger:after {
    transform: rotate(180deg) !important;
    color: var(--blue-dark) !important;
}

.custom-options, .select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background-color: var(--white) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-md) !important;
    z-index: 1100 !important;
    display: none;
    overflow: hidden;
}

.custom-select.open .custom-options, 
.select-custom.open .select-options {
    display: block !important;
}

.custom-option, .select-option {
    padding: 0.75rem 1rem !important;
    font-family: var(--font-primary) !important;
    font-size: 14px !important; /* เนื้อหา 14 */
    color: var(--app-text) !important;
    cursor: pointer !important;
    transition: var(--theme-transition) !important;
    user-select: none !important;
}

.custom-option:hover, .select-option:hover {
    background-color: var(--white-soft) !important;
    color: var(--blue-dark) !important;
}

.custom-option.selected, .select-option.selected {
    background-color: var(--blue-dark) !important;
    color: var(--white) !important;
}

/* Floating Dropdown Menu Component */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.5rem;
    background-color: var(--white) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--radius-md) !important;
    min-width: 200px;
    box-shadow: var(--shadow-md) !important;
    z-index: 1100;
    display: none;
    overflow: hidden;
}

.dropdown-menu.show {
    display: block !important;
}

.dropdown-hover:hover .dropdown-menu {
    display: block !important;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    font-size: 14px !important; /* เมนู ขนาด 14 */
    color: var(--app-text) !important;
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--theme-transition);
}

.dropdown-item:hover {
    background-color: var(--white-soft) !important;
    color: var(--blue-dark) !important;
}

/* ====================================================
   TAILWIND UTILITY MAPPING LAYER
   ==================================================== */
.flex { display: flex !important; }
.inline-flex { display: inline-flex !important; }
.grid { display: grid !important; }
.hidden { display: none !important; }
.block { display: block !important; }
.relative { position: relative !important; }
.fixed { position: fixed !important; }
.sticky { position: sticky !important; }
.inset-0 { top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important; }
.top-0 { top: 0 !important; }
.left-0 { left: 0 !important; }
.right-0 { right: 0 !important; }
.bottom-0 { bottom: 0 !important; }
.z-10 { z-index: 10 !important; }
.z-50 { z-index: 50 !important; }
.z-\[1\] { z-index: 1 !important; }
.z-\[1030\] { z-index: 1030 !important; }
.z-\[1040\] { z-index: 1040 !important; }
.z-\[1050\] { z-index: 1050 !important; }
.z-\[2000\] { z-index: 2000 !important; }
.z-\[9999\] { z-index: 9999 !important; }
.overflow-auto { overflow: auto !important; }

/* Alignment mapping */
.items-center { align-items: center !important; }
.items-start { align-items: flex-start !important; }
.items-end { align-items: flex-end !important; }
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }
.justify-end { justify-content: flex-end !important; }
.flex-col { flex-direction: column !important; }
.flex-col-reverse { flex-direction: column-reverse !important; }
.flex-1 { flex: 1 1 0% !important; }
.flex-grow { flex-grow: 1 !important; }
.flex-wrap { flex-wrap: wrap !important; }
.shrink-0 { flex-shrink: 0 !important; }
.self-start { align-self: flex-start !important; }

/* Spacings and gaps mapping */
.gap-0 { gap: 0 !important; }
.gap-0\.5 { gap: 0.125rem !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-1\.5 { gap: 0.375rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 0.75rem !important; }
.gap-4 { gap: 1rem !important; }
.gap-5 { gap: 1.25rem !important; }
.gap-6 { gap: 1.5rem !important; }

.space-y-1 > * + * { margin-top: 0.25rem !important; }
.space-y-2 > * + * { margin-top: 0.5rem !important; }
.space-y-3 > * + * { margin-top: 0.75rem !important; }
.space-y-4 > * + * { margin-top: 1rem !important; }
.space-y-5 > * + * { margin-top: 1.25rem !important; }
.space-y-6 > * + * { margin-top: 1.5rem !important; }

/* Padding */
.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-2\.5 { padding: 0.625rem !important; }
.p-3 { padding: 0.75rem !important; }
.p-4 { padding: 1rem !important; }
.p-5 { padding: 1.25rem !important; }
.p-6 { padding: 1.5rem !important; }
.p-8 { padding: 2rem !important; }
.p-10 { padding: 2.5rem !important; }

.px-0 { padding-left: 0 !important; padding-right: 0 !important; }
.px-1 { padding-left: 0.25rem !important; padding-right: 0.25rem !important; }
.px-2 { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
.px-2\.5 { padding-left: 0.625rem !important; padding-right: 0.625rem !important; }
.px-3 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
.px-3\.5 { padding-left: 0.875rem !important; padding-right: 0.875rem !important; }
.px-4 { padding-left: 1rem !important; padding-right: 1rem !important; }
.px-5 { padding-left: 1.25rem !important; padding-right: 1.25rem !important; }
.px-6 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
.px-7 { padding-left: 1.75rem !important; padding-right: 1.75rem !important; }
.px-8 { padding-left: 2rem !important; padding-right: 2rem !important; }
.px-10 { padding-left: 2.5rem !important; padding-right: 2.5rem !important; }

.py-0\.5 { padding-top: 0.125rem !important; padding-bottom: 0.125rem !important; }
.py-1 { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
.py-1\.5 { padding-top: 0.375rem !important; padding-bottom: 0.375rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-2\.5 { padding-top: 0.625rem !important; padding-bottom: 0.625rem !important; }
.py-3 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
.py-3\.5 { padding-top: 0.875rem !important; padding-bottom: 0.875rem !important; }
.py-4 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.py-5 { padding-top: 1.25rem !important; padding-bottom: 1.25rem !important; }
.py-6 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
.py-8 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
.py-10 { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
.py-12 { padding-top: 3rem !important; padding-bottom: 3rem !important; }

.pr-1 { padding-right: 0.25rem !important; }
.pr-3 { padding-right: 0.75rem !important; }
.pr-4 { padding-right: 1rem !important; }
.pe-3 { padding-inline-end: 0.75rem !important; }
.pl-2 { padding-left: 0.5rem !important; }
.pl-3 { padding-left: 0.75rem !important; }
.pl-4 { padding-left: 1rem !important; }
.pl-5 { padding-left: 1.25rem !important; }
.pb-2 { padding-bottom: 0.5rem !important; }
.pb-3 { padding-bottom: 0.75rem !important; }
.pb-4 { padding-bottom: 1rem !important; }
.pb-5 { padding-bottom: 1.25rem !important; }
.pb-6 { padding-bottom: 1.5rem !important; }
.pb-8 { padding-bottom: 2rem !important; }
.pt-2 { padding-top: 0.5rem !important; }
.pt-3 { padding-top: 0.75rem !important; }
.pt-4 { padding-top: 1rem !important; }
.pt-5 { padding-top: 1.25rem !important; }
.pt-6 { padding-top: 1.5rem !important; }
.pt-20 { padding-top: 5rem !important; }

/* Margins */
.m-0 { margin: 0 !important; }
.m-4 { margin: 1rem !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 0.75rem !important; }
.mt-4 { margin-top: 1rem !important; }
.mt-5 { margin-top: 1.25rem !important; }
.mt-6 { margin-top: 1.5rem !important; }
.mt-8 { margin-top: 2rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-5 { margin-bottom: 1.25rem !important; }
.mb-6 { margin-bottom: 1.5rem !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }

/* Sizing */
.w-full { width: 100% !important; }
.w-fit { width: fit-content !important; }
.w-60 { width: 15rem !important; }
.w-1\.5 { width: 0.375rem !important; }
.w-1\/2 { width: 50% !important; }
.w-10 { width: 2.5rem !important; }
.w-12 { width: 3rem !important; }
.w-14 { width: 3.5rem !important; }
.w-16 { width: 4rem !important; }
.w-2 { width: 0.5rem !important; }
.w-20 { width: 5rem !important; }
.w-25 { width: 6.25rem !important; }
.w-32 { width: 8rem !important; }
.w-36 { width: 9rem !important; }
.w-4 { width: 1rem !important; }
.w-40 { width: 10rem !important; }
.w-5 { width: 1.25rem !important; }
.w-6 { width: 1.5rem !important; }
.w-8 { width: 2rem !important; }
.w-9 { width: 2.25rem !important; }
.w-\[10\%\] { width: 10% !important; }
.w-\[15\%\] { width: 15% !important; }
.w-\[20\%\] { width: 20% !important; }
.w-\[360px\] { width: 360px !important; }
.w-\[45\%\] { width: 45% !important; }

.h-1\.5 { height: 0.375rem !important; }
.h-10 { height: 2.5rem !important; }
.h-11 { height: 2.75rem !important; }
.h-12 { height: 3rem !important; }
.h-14 { height: 3.5rem !important; }
.h-16 { height: 4rem !important; }
.h-2 { height: 0.5rem !important; }
.h-20 { height: 5rem !important; }
.h-32 { height: 8rem !important; }
.h-4 { height: 1rem !important; }
.h-40 { height: 10rem !important; }
.h-48 { height: 12rem !important; }
.h-5 { height: 1.25rem !important; }
.h-52 { height: 13rem !important; }
.h-6 { height: 1.5rem !important; }
.h-8 { height: 2rem !important; }
.h-9 { height: 2.25rem !important; }
.h-full { height: 100% !important; }
.h-screen { height: 100vh !important; }
.max-w-4xl { max-width: 56rem !important; }
.max-w-5xl { max-width: 64rem !important; }
.max-h-\[88vh\] { max-height: 88vh !important; }

/* Grid columns mappings */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)) !important; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }

/* Borders & Rings */
.border { border: 1px solid var(--app-border) !important; }
.border-0 { border-width: 0px !important; }
.border-2 { border-width: 2px !important; }
.border-4 { border-width: 4px !important; }
.border-dashed { border-style: dashed !important; }
.border-b { border-bottom: 1px solid var(--app-border) !important; }
.border-l { border-left: 1px solid var(--app-border) !important; }
.border-l-4 { border-left-width: 4px !important; }
.border-t { border-top: 1px solid var(--app-border) !important; }
.border-t-4 { border-top-width: 4px !important; }
.border-collapse { border-collapse: collapse !important; }

.border-slate-100 { border-color: var(--app-border) !important; }
.border-slate-200 { border-color: var(--app-border) !important; }
.border-slate-300 { border-color: rgba(9, 11, 17, 0.15) !important; }
.border-slate-700 { border-color: var(--app-muted) !important; }
.border-slate-800 { border-color: var(--gray-800) !important; }
.border-white\/15 { border-color: rgba(255, 255, 255, 0.15) !important; }

.border-blue-100 { border-color: rgba(29, 78, 216, 0.2) !important; }
.border-brand-200 { border-color: rgba(29, 78, 216, 0.3) !important; }
.border-brand-500 { border-color: var(--blue-dark) !important; }
.border-emerald-100 { border-color: rgba(29, 78, 216, 0.2) !important; }
.border-emerald-200 { border-color: rgba(29, 78, 216, 0.3) !important; }
.border-emerald-500 { border-color: var(--blue-dark) !important; }
.border-indigo-100 { border-color: rgba(29, 78, 216, 0.2) !important; }
.border-violet-200 { border-color: rgba(29, 78, 216, 0.3) !important; }
.border-sky-100 { border-color: rgba(29, 78, 216, 0.2) !important; }
.border-sky-200 { border-color: rgba(29, 78, 216, 0.3) !important; }
.border-sky-300 { border-color: rgba(29, 78, 216, 0.4) !important; }

.border-amber-100 { border-color: #fde68a !important; }
.border-amber-200 { border-color: #fcd34d !important; }
.border-amber-400 { border-color: #fbbf24 !important; }

.border-red-200 { border-color: rgba(185, 28, 28, 0.3) !important; }
.border-rose-100 { border-color: rgba(185, 28, 28, 0.2) !important; }
.border-rose-200 { border-color: rgba(185, 28, 28, 0.3) !important; }
.border-rose-300 { border-color: rgba(185, 28, 28, 0.4) !important; }
.border-rose-500 { border-color: var(--red-dark) !important; }
.border-t-rose-500 { border-top-color: var(--red-dark) !important; }

.ring-1 { box-shadow: 0 0 0 1px var(--app-border) !important; }
.ring-slate-200 { box-shadow: 0 0 0 2px var(--app-border) !important; }
.ring-emerald-200 { box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.2) !important; }
.ring-sky-200 { box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.2) !important; }
.ring-orange-200 { box-shadow: 0 0 0 2px rgba(185, 28, 28, 0.2) !important; }

/* Rounded corners */
.rounded { border-radius: var(--radius-sm) !important; }
.rounded-\[4px\] { border-radius: 4px !important; }
.rounded-md { border-radius: var(--radius-sm) !important; }
.rounded-lg { border-radius: var(--radius-md) !important; }
.rounded-xl { border-radius: var(--radius-lg) !important; }
.rounded-2xl { border-radius: 16px !important; }
.rounded-3xl { border-radius: 24px !important; }
.rounded-full { border-radius: var(--radius-full) !important; }
.rounded-b-lg { border-bottom-left-radius: var(--radius-md) !important; border-bottom-right-radius: var(--radius-md) !important; }
.rounded-t-lg { border-top-left-radius: var(--radius-md) !important; border-top-right-radius: var(--radius-md) !important; }
.rounded-t-xl { border-top-left-radius: var(--radius-lg) !important; border-top-right-radius: var(--radius-lg) !important; }
.rounded-l-2xl { border-top-left-radius: 16px !important; border-bottom-left-radius: 16px !important; }
.rounded-l-md { border-top-left-radius: var(--radius-sm) !important; border-bottom-left-radius: var(--radius-sm) !important; }

/* Shadows */
.shadow-none { box-shadow: none !important; }
.shadow { box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06) !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-md) !important; }
.shadow-xl { box-shadow: var(--shadow-md) !important; }
.shadow-2xl { box-shadow: var(--shadow-md) !important; }
.shadow-inner { box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06) !important; }
.shadow-soft { box-shadow: var(--shadow-sm) !important; }
.shadow-xs { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important; }
.shadow-\[4px_0_18px_rgba\(15\,23\,42\,0\.14\)\] { box-shadow: 4px 0 18px rgba(15,23,42,0.14) !important; }
.shadow-brand-600\/20 { box-shadow: 0 4px 12px rgba(29, 78, 216, 0.2) !important; }
.shadow-emerald-500\/30 { box-shadow: 0 4px 12px rgba(29, 78, 216, 0.3) !important; }
.shadow-emerald-600\/20 { box-shadow: 0 4px 12px rgba(29, 78, 216, 0.2) !important; }
.shadow-emerald-600\/25 { box-shadow: 0 4px 12px rgba(29, 78, 216, 0.25) !important; }
.shadow-sky-600\/20 { box-shadow: 0 4px 12px rgba(29, 78, 216, 0.2) !important; }
.shadow-sky-600\/25 { box-shadow: 0 4px 12px rgba(29, 78, 216, 0.25) !important; }
.shadow-slate-200\/60 { box-shadow: var(--shadow-sm) !important; }
.shadow-slate-200\/70 { box-shadow: var(--shadow-sm) !important; }

/* Text colors mapping */
.text-slate-100 { color: var(--white-soft) !important; }
.text-slate-200 { color: rgba(255, 255, 255, 0.8) !important; }
.text-slate-300 { color: rgba(9, 11, 17, 0.4) !important; }
.text-slate-400 { color: var(--app-muted) !important; }
.text-slate-500, .text-gray-500 { color: var(--app-muted) !important; }
.text-slate-600, .text-gray-600 { color: var(--app-text) !important; opacity: 0.75; }
.text-slate-700, .text-gray-700 { color: var(--app-text) !important; opacity: 0.85; }
.text-slate-800, .text-gray-800 { color: var(--app-text) !important; }
.text-slate-900, .text-gray-900 { color: var(--app-text) !important; }
.text-slate-950, .text-black { color: var(--app-text) !important; }
.text-white { color: var(--white) !important; }
.text-\[\#1d4ed8\] { color: var(--blue-dark) !important; }

.text-blue-600 { color: var(--blue-dark) !important; }
.text-blue-700 { color: var(--blue-dark) !important; }
.text-blue-900 { color: var(--blue-dark) !important; }
.text-brand-500 { color: var(--blue-dark) !important; }
.text-brand-600 { color: var(--blue-dark) !important; }
.text-brand-700 { color: var(--blue-dark) !important; }
.text-current { color: currentColor !important; }
.text-emerald-300 { color: var(--blue-dark) !important; }
.text-emerald-400 { color: var(--blue-dark) !important; }
.text-emerald-500 { color: var(--blue-dark) !important; }
.text-emerald-600 { color: var(--blue-dark) !important; }
.text-emerald-700 { color: var(--blue-dark) !important; }
.text-emerald-800 { color: var(--blue-dark) !important; }
.text-indigo-500 { color: var(--blue-dark) !important; }
.text-indigo-600 { color: var(--blue-dark) !important; }
.text-indigo-700 { color: var(--blue-dark) !important; }
.text-indigo-800 { color: var(--blue-dark) !important; }
.text-violet-600 { color: var(--blue-dark) !important; }
.text-violet-700 { color: var(--blue-dark) !important; }
.text-sky-100 { color: var(--white-soft) !important; }
.text-sky-300 { color: var(--blue-dark) !important; }
.text-sky-500 { color: var(--blue-dark) !important; }
.text-sky-600 { color: var(--blue-dark) !important; }
.text-sky-700 { color: var(--blue-dark) !important; }
.text-sky-800 { color: var(--blue-dark) !important; }

.text-amber-200 { color: #fde68a !important; }
.text-amber-300 { color: #fcd34d !important; }
.text-amber-500 { color: #f59e0b !important; }
.text-amber-600 { color: #d97706 !important; }
.text-amber-700 { color: #b45309 !important; }
.text-amber-800 { color: #92400e !important; }
.text-amber-900 { color: #78350f !important; }

.text-orange-600 { color: var(--red-dark) !important; }
.text-orange-700 { color: var(--red-dark) !important; }
.text-red-700 { color: var(--red-dark) !important; }
.text-rose-300 { color: var(--red-dark) !important; }
.text-rose-400 { color: var(--red-dark) !important; }
.text-rose-600 { color: var(--red-dark) !important; }
.text-rose-700 { color: var(--red-dark) !important; }
.text-rose-800 { color: var(--red-dark) !important; }

/* Backgrounds mapping */
.bg-white { background-color: var(--white) !important; }
.bg-slate-50, .bg-gray-50 { background-color: var(--app-bg) !important; }
.bg-slate-100, .bg-gray-100 { background-color: rgba(9, 11, 17, 0.05) !important; }
.bg-slate-200 { background-color: rgba(9, 11, 17, 0.1) !important; }
.bg-slate-600 { background-color: var(--app-muted) !important; }
.bg-slate-900 { background-color: var(--gray-800) !important; }
.bg-slate-950 { background-color: var(--black) !important; }
.bg-slate-950\/50 { background-color: rgba(9, 11, 17, 0.5) !important; }
.bg-slate-950\/95 { background-color: rgba(9, 11, 17, 0.95) !important; }
.bg-transparent { background-color: transparent !important; }
.backdrop-blur-sm { backdrop-filter: blur(4px) !important; -webkit-backdrop-filter: blur(4px) !important; }

.bg-blue-50 { background-color: rgba(29, 78, 216, 0.08) !important; }
.bg-brand-100 { background-color: rgba(29, 78, 216, 0.1) !important; }
.bg-brand-50 { background-color: rgba(29, 78, 216, 0.05) !important; }
.bg-brand-500 { background-color: var(--blue-dark) !important; }
.bg-brand-600 { background-color: var(--blue-dark) !important; }
.bg-cyan-600 { background-color: var(--blue-dark) !important; }
.bg-emerald-100 { background-color: rgba(29, 78, 216, 0.1) !important; }
.bg-emerald-400 { background-color: var(--blue-dark) !important; }
.bg-emerald-50 { background-color: rgba(29, 78, 216, 0.05) !important; }
.bg-emerald-500 { background-color: var(--blue-dark) !important; }
.bg-emerald-600 { background-color: var(--blue-dark) !important; }
.bg-indigo-100 { background-color: rgba(29, 78, 216, 0.1) !important; }
.bg-indigo-50 { background-color: rgba(29, 78, 216, 0.05) !important; }
.bg-sky-100 { background-color: rgba(29, 78, 216, 0.1) !important; }
.bg-sky-50 { background-color: rgba(29, 78, 216, 0.05) !important; }
.bg-sky-500 { background-color: var(--blue-dark) !important; }
.bg-sky-600 { background-color: var(--blue-dark) !important; }
.bg-violet-100 { background-color: rgba(29, 78, 216, 0.1) !important; }
.bg-violet-50 { background-color: rgba(29, 78, 216, 0.05) !important; }

.bg-amber-100 { background-color: #fef3c7 !important; }
.bg-amber-400 { background-color: #fbbf24 !important; }
.bg-amber-50 { background-color: #fffbeb !important; }
.bg-amber-500 { background-color: #f59e0b !important; }

.bg-orange-50 { background-color: rgba(185, 28, 28, 0.05) !important; }
.bg-red-50 { background-color: rgba(185, 28, 28, 0.05) !important; }
.bg-rose-100 { background-color: rgba(185, 28, 28, 0.1) !important; }
.bg-rose-50 { background-color: rgba(185, 28, 28, 0.05) !important; }
.bg-rose-500 { background-color: var(--red-dark) !important; }
.bg-rose-600 { background-color: var(--red-dark) !important; }

.bg-white\/10 { background-color: rgba(255, 255, 255, 0.1) !important; }
.bg-white\/80 { background-color: rgba(255, 255, 255, 0.8) !important; }
.bg-white\/90 { background-color: rgba(255, 255, 255, 0.9) !important; }
.bg-white\/95 { background-color: rgba(255, 255, 255, 0.95) !important; }
.bg-opacity-10 { opacity: 0.1 !important; }

/* Font size mapping */
.text-xs { font-size: 0.75rem !important; }
.text-sm { font-size: 14px !important; /* เนื้อหา 14 */ }
.text-base { font-size: 14px !important; /* เนื้อหา 14 */ }
.text-lg { font-size: 16px !important; /* หัวข้อสำคัญ 16 */ }
.text-xl { font-size: 1.25rem !important; }
.text-2xl { font-size: 1.5rem !important; }
.text-3xl { font-size: 1.875rem !important; }
.text-4xl { font-size: 2.25rem !important; }
.text-5xl { font-size: 3rem !important; }
.text-6xl { font-size: 3.75rem !important; }
.text-\[9px\] { font-size: 9px !important; }
.text-\[10px\] { font-size: 10px !important; }
.text-\[11px\] { font-size: 11px !important; }

.font-semibold { font-weight: 500 !important; }
.font-bold { font-weight: 700 !important; }
.font-black { font-weight: 800 !important; }
.tracking-wide { letter-spacing: 0.025em !important; }
.tracking-tight { letter-spacing: -0.025em !important; }
.uppercase { text-transform: uppercase !important; }
.leading-6 { line-height: 1.5rem !important; }
.leading-7 { line-height: 1.75rem !important; }
.no-underline { text-decoration: none !important; }
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
.text-nowrap { white-space: nowrap !important; }
.whitespace-nowrap { white-space: nowrap !important; }
.whitespace-pre-line { white-space: pre-line !important; }
.whitespace-pre-wrap { white-space: pre-wrap !important; }
.truncate { overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; }

/* Responsive utility breakpoints */

/* --- Small Screens (sm) --- */
@media (min-width: 640px) {
    .sm\:bg-transparent { background-color: transparent !important; }
    .sm\:flex-1 { flex: 1 1 0% !important; }
    .sm\:flex-row { flex-direction: row !important; }
    .sm\:gap-4 { gap: 1rem !important; }
    .sm\:grid-cols-\[1fr_auto\] { grid-template-columns: 1fr auto !important; }
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
    .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
    .sm\:inline { display: inline !important; }
    .sm\:items-center { align-items: center !important; }
    .sm\:items-end { align-items: flex-end !important; }
    .sm\:items-start { align-items: flex-start !important; }
    .sm\:justify-between { justify-content: space-between !important; }
    .sm\:justify-center { justify-content: center !important; }
    .sm\:justify-end { justify-content: flex-end !important; }
    .sm\:min-w-44 { min-width: 11rem !important; }
    .sm\:mt-0 { margin-top: 0 !important; }
    .sm\:p-0 { padding: 0 !important; }
    .sm\:p-5 { padding: 1.25rem !important; }
    .sm\:p-6 { padding: 1.5rem !important; }
    .sm\:p-8 { padding: 2rem !important; }
    .sm\:px-6 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
    .sm\:self-auto { align-self: auto !important; }
    .sm\:text-3xl { font-size: 1.875rem !important; }
    .sm\:text-4xl { font-size: 2.25rem !important; }
    .sm\:text-base { font-size: 14px !important; /* เนื้อหา 14 */ }
    .sm\:text-right { text-align: right !important; }
    .sm\:w-60 { width: 15rem !important; }
    .sm\:w-auto { width: auto !important; }
    .sm\:w-fit { width: fit-content !important; }
}

/* --- Medium Screens (md) --- */
@media (min-width: 768px) {
    .md\:col-span-2 { grid-column: span 2 / span 2 !important; }
    .md\:col-span-3 { grid-column: span 3 / span 3 !important; }
    .md\:col-span-4 { grid-column: span 4 / span 4 !important; }
    .md\:col-span-5 { grid-column: span 5 / span 5 !important; }
    .md\:col-span-6 { grid-column: span 6 / span 6 !important; }
    .md\:col-span-7 { grid-column: span 7 / span 7 !important; }
    .md\:col-span-8 { grid-column: span 8 / span 8 !important; }
    .md\:col-span-12 { grid-column: span 12 / span 12 !important; }
    .md\:col-start-8 { grid-column-start: 8 !important; }
    .md\:flex-row { flex-direction: row !important; }
    .md\:grid-cols-\[1fr_1fr_auto_auto\] { grid-template-columns: 1fr 1fr auto auto !important; }
    .md\:grid-cols-\[1fr_auto\] { grid-template-columns: 1fr auto !important; }
    .md\:grid-cols-\[1fr_auto_1fr\] { grid-template-columns: 1fr auto 1fr !important; }
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
    .md\:grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)) !important; }
    .md\:items-center { align-items: center !important; }
    .md\:items-end { align-items: flex-end !important; }
    .md\:items-start { align-items: flex-start !important; }
    .md\:justify-between { justify-content: space-between !important; }
    .md\:p-7 { padding: 1.75rem !important; }
    .md\:p-8 { padding: 2rem !important; }
    .md\:px-8 { padding-left: 2rem !important; padding-right: 2rem !important; }
    .md\:text-right { text-align: right !important; }
}

/* --- Large Screens (lg) --- */
@media (min-width: 1024px) {
    .lg\:col-span-4 { grid-column: span 4 / span 4 !important; }
    .lg\:col-span-5 { grid-column: span 5 / span 5 !important; }
    .lg\:col-span-7 { grid-column: span 7 / span 7 !important; }
    .lg\:col-span-8 { grid-column: span 8 / span 8 !important; }
    .lg\:flex-row { flex-direction: row !important; }
    .lg\:grid-cols-\[1\.2fr_0\.8fr\] { grid-template-columns: 1.2fr 0.8fr !important; }
    .lg\:grid-cols-\[1fr_360px\] { grid-template-columns: 1fr 360px !important; }
    .lg\:grid-cols-\[320px_1fr\] { grid-template-columns: 320px 1fr !important; }
    .lg\:grid-cols-\[360px_1fr\] { grid-template-columns: 360px 1fr !important; }
    .lg\:grid-cols-\[420px_1fr\] { grid-template-columns: 420px 1fr !important; }
    .lg\:grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)) !important; }
    .lg\:grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)) !important; }
    .lg\:hidden { display: none !important; }
    .lg\:items-center { align-items: center !important; }
    .lg\:items-end { align-items: flex-end !important; }
    .lg\:items-start { align-items: flex-start !important; }
    .lg\:justify-between { justify-content: space-between !important; }
    .lg\:justify-end { justify-content: flex-end !important; }
    .lg\:ml-60 { margin-left: 15rem !important; }
    .lg\:ml-auto { margin-left: auto !important; }
    .lg\:pt-8 { padding-top: 2rem !important; }
    .lg\:px-8 { padding-left: 2rem !important; padding-right: 2rem !important; }
}

/* --- Extra Large Screens (xl) --- */
@media (min-width: 1200px) {
    .xl\:col-span-2 { grid-column: span 2 / span 2 !important; }
    .xl\:col-span-3 { grid-column: span 3 / span 3 !important; }
    .xl\:flex-row { flex-direction: row !important; }
    .xl\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .xl\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
    .xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
    .xl\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
    .xl\:items-end { align-items: flex-end !important; }
    .xl\:items-start { align-items: flex-start !important; }
    .xl\:justify-between { justify-content: space-between !important; }
    .xl\:w-auto { width: auto !important; }
}

/* --- Print Styles --- */
@media print {
    .print\:inline-flex { display: inline-flex !important; }
}

/* Mobile sidebar fixes must stay after utility mappings. */
@media (min-width: 1024px) {
    .navbar.app-top-menu {
        position: fixed !important;
        inset: 0 0 auto 240px !important;
        z-index: 1035 !important;
        display: flex !important;
        min-height: 4.25rem !important;
        align-items: center !important;
        border-bottom: 1px solid var(--app-border) !important;
        background: var(--white) !important;
        padding: 0.75rem 2rem !important;
        box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04) !important;
    }

    .app-top-menu .navbar-container {
        max-width: none !important;
        padding: 0 !important;
    }

    .app-top-menu .nav-menu {
        margin: 0 !important;
        padding: 0 !important;
    }

    .app-top-menu .nav-actions {
        margin-left: auto !important;
    }

    .content-wrapper {
        padding-top: 5.75rem !important;
    }

    .mobile-sidebar-logout {
        display: none !important;
    }
}

@media (max-width: 1023px) {
    .navbar.app-top-menu {
        display: none !important;
    }

    .mobile-topbar {
        position: fixed !important;
        inset: 0 0 auto 0 !important;
        z-index: 1050 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        min-height: 4.85rem !important;
        padding: 0.55rem 1rem !important;
        background: var(--white) !important;
        color: var(--app-text) !important;
        border-bottom: 1px solid var(--app-border) !important;
        box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06) !important;
    }

    .mobile-menu-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 2.65rem !important;
        height: 2.65rem !important;
        flex: 0 0 2.65rem !important;
        padding: 0 !important;
        border: 1px solid var(--app-border) !important;
        border-radius: var(--radius-sm) !important;
        background: var(--white) !important;
        color: var(--app-text) !important;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08) !important;
    }

    .mobile-top-actions {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 0.5rem !important;
    }

    .mobile-logout-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.35rem !important;
        min-height: 2.65rem !important;
        padding: 0 0.75rem !important;
        border: 1px solid rgba(185, 28, 28, 0.18) !important;
        border-radius: var(--radius-sm) !important;
        background: #fff1f2 !important;
        color: var(--red-dark) !important;
        font-size: 0.78rem !important;
        font-weight: 900 !important;
        line-height: 1 !important;
        text-decoration: none !important;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08) !important;
    }

    .mobile-logout-btn svg,
    .mobile-logout-btn svg * {
        width: 1.05rem !important;
        height: 1.05rem !important;
        color: currentColor !important;
        stroke: currentColor !important;
    }

    .mobile-menu-btn svg,
    .mobile-menu-btn svg * {
        color: var(--app-text) !important;
        stroke: currentColor !important;
    }

    .sidebar {
        top: 4.85rem !important;
        z-index: 1040 !important;
        display: flex !important;
        flex-direction: column !important;
        height: calc(100dvh - 4.85rem) !important;
        background: var(--white) !important;
        opacity: 1 !important;
        overflow: hidden !important;
    }

    .sidebar-overlay {
        position: fixed !important;
        inset: 0 !important;
        z-index: 1030 !important;
        display: block !important;
        background: rgba(15, 23, 42, 0.58) !important;
    }

    .app-brand-mobile .app-brand-logo {
        width: 3.25rem !important;
    }

    .sidebar .app-brand-sidebar .app-brand-logo {
        width: 3.6rem !important;
    }

    .sidebar .app-brand-sidebar {
        flex: 0 0 auto !important;
    }

    .sidebar .menu {
        display: flex !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        flex-direction: column !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-right: 0.25rem !important;
    }

    .menu a.mobile-sidebar-logout {
        position: sticky !important;
        bottom: 0 !important;
        z-index: 2 !important;
        margin-top: 0.75rem !important;
        margin-bottom: 0 !important;
        border: 1px solid rgba(185, 28, 28, 0.18) !important;
        background: #fff1f2 !important;
        box-shadow: 0 -8px 16px rgba(255, 255, 255, 0.92) !important;
    }
}

@media (max-width: 380px) {
    .mobile-logout-btn {
        width: 2.35rem !important;
        min-height: 2.35rem !important;
        padding: 0 !important;
    }

    .mobile-logout-btn span {
        display: none !important;
    }
}

/* Original dashboard custom accents overrides mapping */
.dashboard-hero-dark {
    background-color: var(--blue-dark) !important;
    border-right: 1px solid var(--app-border) !important;
    border-radius: var(--radius-md) 0 0 var(--radius-md) !important;
}

/* Sidebar-only navigation: top menu and accordion groups are disabled in the app layout. */
.app-top-menu,
.navbar.app-top-menu,
.mobile-logout-btn {
    display: none !important;
}

.sidebar {
    display: flex !important;
    flex-direction: column !important;
}

.sidebar .menu {
    display: flex !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    flex-direction: column !important;
}

.menu a.logout {
    margin-top: auto !important;
    margin-bottom: 0 !important;
}

@media (min-width: 1024px) {
    .content-wrapper {
        padding-top: 2rem !important;
    }
}

@media (max-width: 1023px) {
    .dashboard-hero-dark {
        border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
    }
}

.dashboard-hero-dark h1 {
    color: var(--white) !important;
}

.dashboard-hero-dark .dashboard-hero-pill {
    border-color: var(--white) !important;
    background: var(--white) !important;
    color: var(--blue-dark) !important;
}

.dashboard-hero-dark .dashboard-hero-copy {
    color: var(--white-soft) !important;
    opacity: 0.9 !important;
}

.dashboard-role-badge {
    background-color: var(--blue-dark) !important;
    color: var(--white) !important;
    border: 1px solid var(--blue-dark) !important;
}

.dashboard-palette-cyan {
    background-color: rgba(29, 78, 216, 0.08) !important;
    color: var(--blue-dark) !important;
}

.dashboard-palette-yellow {
    background-color: rgba(255, 239, 102, 0.15) !important;
    color: var(--black) !important;
}

.dashboard-palette-coral {
    background-color: rgba(185, 28, 28, 0.08) !important;
    color: var(--red-dark) !important;
}

.dashboard-palette-gray {
    background-color: var(--white-soft) !important;
    color: var(--gray-800) !important;
}

.dashboard-metric-card {
    background-color: var(--white) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--radius-md) !important;
    padding: 1.25rem !important;
}

.dashboard-menu-grid > a:nth-child(4n+1) { background-color: var(--white-soft) !important; }
.dashboard-menu-grid > a:nth-child(4n+2) { background-color: rgba(29, 78, 216, 0.03) !important; }
.dashboard-menu-grid > a:nth-child(4n+3) { background-color: rgba(185, 28, 28, 0.02) !important; }
.dashboard-menu-grid > a:nth-child(4n+4) { background-color: var(--white-soft) !important; }

.dashboard-menu-grid > a:hover {
    background-color: var(--white) !important;
    border-color: var(--blue-dark) !important;
}

.dashboard-menu-grid > a:nth-child(4n+1) .dashboard-menu-icon {
    background: var(--blue-dark) !important;
    color: var(--white) !important;
}

.dashboard-menu-grid > a:nth-child(4n+2) .dashboard-menu-icon {
    background: var(--gray-800) !important;
    color: var(--white) !important;
}

.dashboard-menu-grid > a:nth-child(4n+3) .dashboard-menu-icon {
    background: var(--red-dark) !important;
    color: var(--white) !important;
}

.dashboard-menu-grid > a:nth-child(4n+4) .dashboard-menu-icon {
    background: var(--white-soft) !important;
    color: var(--blue-dark) !important;
    border: 1px solid var(--app-border) !important;
}

.student-level-bar {
    background-color: var(--blue-dark) !important;
}

.student-level-row:nth-child(4n+2) .student-level-bar {
    background-color: var(--gray-800) !important;
}

.student-level-row:nth-child(4n+3) .student-level-bar {
    background-color: var(--red-dark) !important;
}

.student-level-row:nth-child(4n+4) .student-level-bar {
    background-color: var(--white-soft) !important;
    border: 1px solid var(--app-border);
}

.radial-progress-bg {
    stroke: var(--white-soft) !important;
}

/* Responsive utilities */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem;
    }
}

/* App Header Bar - Premium Top Menu */
.app-header {
    height: 64px;
    background-color: var(--white) !important;
    border-bottom: 1px solid var(--app-border) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: var(--theme-transition);
}

.nav-user {
    position: relative;
    cursor: pointer;
}

.nav-avatar-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-full);
}

.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    border: 2px solid var(--app-border);
    object-fit: cover;
}

.nav-avatar-btn:hover .nav-avatar {
    border-color: var(--blue-dark);
}

.nav-user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background-color: var(--white);
    border: 1px solid var(--app-border);
    border-radius: var(--radius-md);
    min-width: 220px;
    box-shadow: var(--shadow-md);
    padding: 0.5rem;
    z-index: 1100;
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-user.open .nav-user-dropdown {
    display: block;
    opacity: 1;
    transform: translateY(4px);
}

.nav-user-info {
    padding: 0.5rem 0.75rem 0.75rem 0.75rem;
    border-bottom: 1px solid var(--app-border);
    margin-bottom: 0.5rem;
}

.nav-user-name {
    font-size: 14px !important; /* เมนู ขนาด 14 */
    font-weight: 700;
    color: var(--app-text);
}

.nav-user-role {
    font-size: 0.75rem;
    color: var(--app-muted);
    margin-top: 0.15rem;
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 14px !important; /* เมนู ขนาด 14 */
    color: var(--app-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--theme-transition);
}

.nav-dropdown-item:hover {
    background-color: var(--white-soft);
    color: var(--blue-dark);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--app-border);
    margin: 0.25rem 0;
}

/* Vanilla.CSS top menu dropdown/select layer */
.app-header .dropdown,
.app-header .nav-user,
.top-menu .dropdown,
.navbar .dropdown,
.mobile-topbar .dropdown {
    position: relative !important;
}

.app-header .dropdown-menu,
.app-header .nav-user-dropdown,
.top-menu .dropdown-menu,
.top-menu .nav-user-dropdown,
.navbar .dropdown-menu,
.navbar .nav-user-dropdown,
.mobile-topbar .dropdown-menu {
    position: absolute !important;
    top: calc(100% + .5rem) !important;
    right: 0 !important;
    left: auto !important;
    min-width: 13.5rem !important;
    padding: .45rem !important;
    background: var(--white) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-md) !important;
    z-index: 1200 !important;
    overflow: hidden !important;
}

.app-header .dropdown.open .dropdown-menu,
.app-header .dropdown-menu.show,
.app-header .nav-user.open .nav-user-dropdown,
.top-menu .dropdown.open .dropdown-menu,
.top-menu .dropdown-menu.show,
.top-menu .nav-user.open .nav-user-dropdown,
.navbar .dropdown.open .dropdown-menu,
.navbar .dropdown-menu.show,
.navbar .nav-user.open .nav-user-dropdown,
.mobile-topbar .dropdown.open .dropdown-menu,
.mobile-topbar .dropdown-menu.show {
    display: block !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
}

.app-header .dropdown-item,
.app-header .nav-dropdown-item,
.top-menu .dropdown-item,
.top-menu .nav-dropdown-item,
.navbar .dropdown-item,
.navbar .nav-dropdown-item,
.mobile-topbar .dropdown-item {
    display: flex !important;
    align-items: center !important;
    gap: .55rem !important;
    width: 100% !important;
    min-height: 2.65rem !important;
    padding: .65rem .75rem !important;
    color: var(--app-text) !important;
    background: transparent !important;
    border-radius: var(--radius-sm) !important;
    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: 700 !important;
}

.app-header .dropdown-item:hover,
.app-header .nav-dropdown-item:hover,
.top-menu .dropdown-item:hover,
.top-menu .nav-dropdown-item:hover,
.navbar .dropdown-item:hover,
.navbar .nav-dropdown-item:hover,
.mobile-topbar .dropdown-item:hover {
    background: var(--white-soft) !important;
    color: var(--blue-dark) !important;
    transform: none !important;
}

.app-header select,
.top-menu select,
.navbar select,
.mobile-topbar select {
    min-height: 2.75rem !important;
    padding: .65rem 2.35rem .65rem .9rem !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--radius-sm) !important;
    background-color: var(--white) !important;
    color: var(--app-text) !important;
    font-family: var(--font-primary) !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    box-shadow: none !important;
    outline: none !important;
}

.app-header select:focus,
.top-menu select:focus,
.navbar select:focus,
.mobile-topbar select:focus {
    border-color: var(--blue-dark) !important;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, .14) !important;
}

/* Final app layout override: sidebar-only navigation, no top-menu spacer. */
.app-top-menu,
.navbar.app-top-menu,
.mobile-logout-btn {
    display: none !important;
}

.content-wrapper {
    padding-top: 0.75rem !important;
}

.app-page-shell {
    padding-top: 0 !important;
}

.sidebar {
    display: flex !important;
    flex-direction: column !important;
}

.sidebar .menu {
    display: flex !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    flex-direction: column !important;
}

.menu a.logout {
    margin-top: auto !important;
    margin-bottom: 0 !important;
}

@media (max-width: 1023px) {
    .content-wrapper {
        padding-top: 5.35rem !important;
    }
}

@media (min-width: 1024px) {
    .content-wrapper {
        padding-top: 0.75rem !important;
    }
}
