@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
    /* Premium Color Palette (Navy Blue & Medical Teal) */
    --primary: #0F2C59;
    --primary-light: #1A3E75;
    --primary-rgb: 15, 44, 89;
    --accent: #00A896;
    --accent-light: #02C3AE;
    --accent-dark: #008778;
    
    /* Semantic Colors */
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    
    /* Light Theme Surface Colors */
    --bg-base: #F8FAFC;
    --bg-surface: #FFFFFF;
    --bg-surface-alt: #F1F5F9;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --border-subtle: #E2E8F0;
    
    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.5);
    
    /* Shadows */
    --shadow-soft: 0 4px 20px -2px rgba(15, 44, 89, 0.05);
    --shadow-hover: 0 10px 30px -5px rgba(15, 44, 89, 0.1);
    
    /* Layout */
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 32px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    
    --font-thai: 'Sarabun', sans-serif;
    --font-latin: 'Inter', sans-serif;
}

[data-theme="dark"] {
    --primary: #38BDF8;
    --primary-light: #0284C7;
    --bg-base: #020617;
    --bg-surface: #0F172A;
    --bg-surface-alt: #1E293B;
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --border-subtle: #334155;
    
    --glass-bg: rgba(15, 23, 42, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
    
    --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 10px 30px -5px rgba(0, 0, 0, 0.6);
}

/* Base Reset & Typography */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
    font-family: var(--font-thai);
    background-color: var(--bg-base);
    color: var(--text-main);
    line-height: 1.7;
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.font-latin { font-family: var(--font-latin); }
h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.3; color: var(--primary); }
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3 { color: var(--bg-base); }
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; width: 100%; }

/* Navigation */
.navbar {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-soft);
}
.nav-container { display: flex; align-items: center; justify-content: space-between; height: 80px; max-width: 1440px !important; margin: 0 auto; padding: 0 32px; width: 100%; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-img { height: 48px; width: 48px; border-radius: 50%; background: #fff; object-fit: contain; flex-shrink: 0; }
.brand-text { white-space: nowrap; flex-shrink: 0; }
.brand-text h1 { font-size: 1.1rem; color: var(--primary); font-weight: 700; margin: 0; }
[data-theme="dark"] .brand-text h1 { color: #fff; }
.brand-text p { font-size: 0.75rem; color: var(--text-muted); margin: 0; }
.nav-menu { display: flex; gap: 4px; list-style: none; align-items: center; }
.nav-link {
    color: var(--text-muted); text-decoration: none; font-size: 0.9rem; font-weight: 500;
    padding: 8px 12px; border-radius: 30px; transition: var(--transition); cursor: pointer;
    white-space: nowrap;
}
.nav-link:hover, .nav-link.active { background: var(--primary); color: #fff; }
.theme-toggle { background: transparent; border: none; color: var(--text-main); font-size: 1.4rem; cursor: pointer; padding: 6px; border-radius: 50%; transition: var(--transition); margin-left: 8px; }
.theme-toggle:hover { background: var(--bg-surface-alt); }

/* Mobile Menu Toggle */
.mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.8rem;
    cursor: pointer;
    padding: 8px;
}

@media (max-width: 1024px) {
    .mobile-toggle { display: block; }
    .nav-menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 80px;
        left: 0;
        width: 100%;
        background: var(--bg-surface);
        padding: 20px;
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        z-index: 1000;
        align-items: flex-start;
        gap: 16px;
    }
    .nav-menu.active { display: flex; }
    .nav-dropdown .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        padding-left: 20px;
        display: none; /* Hide by default in mobile, or just show it */
    }
    .nav-dropdown:hover .dropdown-menu, .nav-dropdown.active .dropdown-menu {
        display: block;
    }
    .brand-text h1 { font-size: 1rem; white-space: normal; }
    .brand-text { white-space: normal; }
}

/* Views Wrapper */
.view-section { display: none; padding: 60px 0; animation: fadeUp 0.5s ease forwards; }
.view-section.active { display: block; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Premium Hero */
.hero {
    position: relative;
    background: linear-gradient(135deg, rgba(15,44,89,0.9) 0%, rgba(0,168,150,0.85) 100%), url('https://images.unsplash.com/photo-1576091160550-2173dba999ef?q=80&w=1920&auto=format&fit=crop') center/cover;
    border-radius: var(--radius-xl);
    padding: 100px 40px;
    text-align: center;
    color: #fff;
    margin-top: 32px;
    box-shadow: var(--shadow-hover);
    overflow: hidden;
}
.hero h2 { color: #fff; font-size: 2.2rem; margin-bottom: 12px; font-weight: 700; text-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.hero h3 { color: #ffffff !important; font-size: 1.35rem; margin-bottom: 8px; font-weight: 400; opacity: 0.95; text-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.hero p { font-size: 1.15rem; max-width: 800px; margin: 0 auto 24px; opacity: 0.9; font-weight: 600; color: #ffffff !important; text-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.hero-glass-search {
    background: rgba(255, 255, 255, 0.15); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 50px; padding: 8px 8px 8px 24px;
    display: flex; max-width: 600px; margin: 0 auto; align-items: center; box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}
.hero-glass-search input { background: transparent; border: none; color: #fff; font-size: 1rem; font-family: var(--font-thai); flex-grow: 1; outline: none; }
.hero-glass-search input::placeholder { color: rgba(255,255,255,0.7); }
.hero-glass-search button { background: var(--accent); color: #fff; border: none; padding: 12px 32px; border-radius: 40px; font-weight: 600; cursor: pointer; transition: var(--transition); }
.hero-glass-search button:hover { background: var(--accent-light); transform: scale(1.05); }

/* Quick Access Cards */
.quick-access { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 24px; margin-top: -40px; padding: 0 24px; position: relative; z-index: 10; }
.q-card {
    background: var(--glass-bg); backdrop-filter: blur(20px); border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg); padding: 32px; text-align: center; text-decoration: none; color: var(--text-main);
    box-shadow: var(--shadow-soft); transition: var(--transition); display: flex; flex-direction: column; align-items: center;
}
.q-card:hover { transform: translateY(-10px); box-shadow: var(--shadow-hover); border-color: var(--accent); }
.q-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 2rem; margin-bottom: 20px; transition: var(--transition); }
.q-card:hover .q-icon { background: var(--accent); transform: rotate(5deg) scale(1.1); }
.q-card h3 { font-size: 1.25rem; margin-bottom: 8px; color: var(--text-main); }
.q-card p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }

/* Dashboard Grids */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 32px; margin-top: 60px; }
@media (max-width: 968px) { .dash-grid { grid-template-columns: 1fr; } }

.docs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; margin-top: 40px; }
@media (max-width: 1024px) { .docs-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .docs-grid { grid-template-columns: 1fr; } }

@keyframes blinkAnimation {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}
.blink-badge {
    animation: blinkAnimation 1.5s infinite;
    display: inline-block;
    box-shadow: 0 0 8px rgba(25, 118, 210, 0.4);
}
.dash-panel { background: var(--bg-surface); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-soft); border: 1px solid var(--border-subtle); }
.panel-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; border-bottom: 2px solid var(--bg-surface-alt); padding-bottom: 16px; }
.panel-header h3 { font-size: 1.3rem; margin: 0; }
.panel-header .material-icons-outlined { color: var(--accent); font-size: 1.8rem; }

/* Announcements List */
.news-split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 768px) { .news-split-grid { grid-template-columns: 1fr; } }

.news-list { list-style: none; }
.news-item { padding: 16px 0; border-bottom: 1px solid var(--border-subtle); display: flex; gap: 16px; align-items: flex-start; }
.news-item:last-child { border-bottom: none; }
.news-date { background: var(--bg-surface-alt); padding: 8px 12px; border-radius: 8px; text-align: center; min-width: 70px; }
.news-date span { display: block; font-weight: 700; color: var(--primary); font-size: 1.2rem; line-height: 1; }
.news-date small { font-size: 0.75rem; color: var(--text-muted); }
.news-content h4 { font-size: 1.05rem; margin-bottom: 4px; color: var(--text-main); }
.news-content p { font-size: 0.9rem; color: var(--text-muted); margin: 0; }

/* Forms Directory */
.forms-filter-bar { display: flex; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.search-box { flex-grow: 1; position: relative; }
.search-box input { width: 100%; padding: 16px 20px 16px 52px; border-radius: 30px; border: 1px solid var(--border-subtle); background: var(--bg-surface); font-size: 1rem; font-family: var(--font-thai); color: var(--text-main); box-shadow: var(--shadow-soft); transition: var(--transition); }
.search-box input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px rgba(0, 168, 150, 0.15); }
.search-box .material-icons-outlined { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.tab-filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.tab-btn { background: var(--bg-surface); border: 1px solid var(--border-subtle); padding: 12px 24px; border-radius: 30px; color: var(--text-muted); font-weight: 500; cursor: pointer; transition: var(--transition); white-space: nowrap; }
.tab-btn:hover { border-color: var(--primary); color: var(--primary); }
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 4px 12px rgba(15, 44, 89, 0.2); }

.forms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.form-card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-soft); transition: var(--transition); display: flex; flex-direction: column; justify-content: space-between; }
.form-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); border-color: var(--accent-light); }
.badge { display: inline-block; padding: 6px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; margin-bottom: 16px; }
.badge-initial { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-continue { background: rgba(15, 44, 89, 0.1); color: var(--primary); }
.badge-urgent { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-final { background: rgba(100, 116, 139, 0.1); color: var(--text-muted); }
.form-card h4 { font-size: 1.1rem; margin-bottom: 12px; color: var(--text-main); }
.form-card p { font-size: 0.9rem; color: var(--text-muted); flex-grow: 1; margin-bottom: 24px; }
.form-actions { display: flex; gap: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 12px; font-weight: 600; cursor: pointer; transition: var(--transition); text-decoration: none; border: none; font-family: var(--font-thai); font-size: 0.95rem; }
.btn-primary { background: var(--primary); color: #fff; flex-grow: 1; }
.btn-primary:hover { background: var(--primary-light); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(15,44,89,0.2); }
.btn-icon { background: var(--bg-surface-alt); color: var(--text-main); padding: 12px; width: 46px; border: 1px solid var(--border-subtle); }
.btn-icon:hover { background: var(--border-subtle); }

/* About & Sidebar Layout */
.about-layout { display: grid; grid-template-columns: 280px 1fr; gap: 40px; align-items: start; }
@media (max-width: 900px) { .about-layout { grid-template-columns: 1fr; } }
.sidebar-nav { position: sticky; top: 100px; background: var(--bg-surface); padding: 24px; border-radius: var(--radius-lg); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-soft); }
.sidebar-nav ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.sidebar-link { display: block; padding: 12px 16px; color: var(--text-muted); text-decoration: none; font-weight: 500; border-radius: 8px; transition: var(--transition); border-left: 3px solid transparent; }
.sidebar-link:hover, .sidebar-link.active { background: var(--bg-surface-alt); color: var(--primary); border-left-color: var(--accent); }
.about-content section { scroll-margin-top: 100px; margin-bottom: 60px; background: var(--bg-surface); padding: 40px; border-radius: var(--radius-lg); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-soft); }
.about-content h2 { margin-bottom: 24px; font-size: 1.8rem; border-bottom: 2px solid var(--bg-surface-alt); padding-bottom: 12px; }

/* Committee Grid */
.committee-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.member-card { text-align: center; padding: 24px; border-radius: var(--radius-md); background: var(--bg-surface-alt); }
.avatar { width: 80px; height: 80px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 2rem; margin: 0 auto 16px; font-weight: 700; }
.member-card h4 { font-size: 1.05rem; margin-bottom: 4px; }
.member-card p { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

/* Systems Gateway (Coming Soon) */
.gateway-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 32px; }
.sys-card { background: var(--bg-surface); border-radius: var(--radius-lg); border: 1px solid var(--border-subtle); overflow: hidden; box-shadow: var(--shadow-soft); transition: var(--transition); }
.sys-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }
.sys-cover { height: 160px; background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%); display: flex; align-items: center; justify-content: center; position: relative; }
.sys-cover .material-icons-outlined { font-size: 4rem; color: rgba(255,255,255,0.9); }
.coming-soon-tag { position: absolute; top: 16px; right: 16px; background: rgba(255,255,255,0.9); color: var(--primary); padding: 6px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: 700; font-family: var(--font-latin); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.sys-body { padding: 32px; }
.sys-body h3 { font-size: 1.4rem; margin-bottom: 12px; }
.sys-body p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 24px; }
.btn-disabled { background: var(--bg-surface-alt); color: var(--text-muted); cursor: not-allowed; }

/* Contact Section */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
@media (max-width: 768px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-info { background: var(--bg-surface); padding: 40px; border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); border: 1px solid var(--border-subtle); }
.c-item { display: flex; gap: 16px; margin-bottom: 24px; }
.c-icon { width: 48px; height: 48px; border-radius: 12px; background: rgba(0, 168, 150, 0.1); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.c-text h4 { font-size: 1rem; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.c-text p { font-size: 1.1rem; color: var(--text-main); font-weight: 600; margin: 0; }
.map-wrap iframe { width: 100%; height: 100%; min-height: 400px; border-radius: var(--radius-lg); border: none; box-shadow: var(--shadow-soft); }

/* Footer */
footer { background: var(--bg-surface); border-top: 1px solid var(--border-subtle); padding: 40px 0; margin-top: auto; text-align: center; }
footer p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 8px; }

/* ==========================================
   Modern Clean Form Discovery & Filter Bar
   (Anti-Clutter & Mobile-First Ergonomics)
   ========================================== */
.filter-dashboard-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: 0 4px 20px -2px rgba(15, 44, 89, 0.06);
    position: relative;
    transition: var(--transition);
}

[data-theme="dark"] .filter-dashboard-card {
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
    border-color: var(--border-subtle);
}

.filter-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-header-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.filter-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(15, 44, 89, 0.08), rgba(0, 168, 150, 0.15));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

.filter-icon-badge .material-icons-outlined {
    font-size: 24px;
}

.filter-heading {
    margin: 0 0 2px 0;
    font-size: 1.15rem;
    color: var(--text-main);
    font-weight: 700;
}

.filter-subheading {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.btn-filter-reset {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-subtle);
    padding: 8px 16px;
    border-radius: 10px;
    color: var(--text-muted);
    font-family: var(--font-thai);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-filter-reset:hover {
    background: #FEE2E2;
    border-color: #FCA5A5;
    color: #DC2626;
    transform: translateY(-1px);
}

[data-theme="dark"] .btn-filter-reset:hover {
    background: rgba(220, 38, 38, 0.2);
    border-color: #DC2626;
    color: #FCA5A5;
}

/* Tier 1: Phase Pills */
.filter-phase-section {
    margin-bottom: 20px;
}

.filter-phase-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 10px;
}

[data-theme="dark"] .filter-phase-label {
    color: var(--primary);
}

.phase-pills-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.phase-pills-bar::-webkit-scrollbar {
    height: 4px;
}
.phase-pills-bar::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 4px;
}

.phase-pill {
    white-space: nowrap;
    background: var(--bg-surface-alt);
    border: 1.5px solid var(--border-subtle);
    border-radius: 30px;
    padding: 8px 16px;
    font-family: var(--font-thai);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    flex-shrink: 0;
}

.phase-pill:hover {
    border-color: var(--accent);
    color: var(--accent-dark);
    background: var(--bg-surface);
    transform: translateY(-1px);
}

.phase-pill.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-color: var(--primary);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(15, 44, 89, 0.25);
}

[data-theme="dark"] .phase-pill.active {
    background: linear-gradient(135deg, #0284C7, #0369A1);
    border-color: #38BDF8;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

/* Tier 2: Search + Role Chips + Advanced Toggle */
.filter-controls-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--bg-surface-alt);
    padding: 14px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.filter-search-box {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1.5px solid var(--border-subtle);
    border-radius: 12px;
    padding: 8px 14px;
    flex: 1 1 260px;
    min-width: 220px;
    transition: var(--transition);
}

.filter-search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 168, 150, 0.15);
}

.filter-search-box .search-icon {
    color: var(--text-muted);
    font-size: 20px;
    margin-right: 8px;
}

.filter-search-box input {
    border: none;
    outline: none;
    width: 100%;
    background: transparent;
    font-family: var(--font-thai);
    font-size: 0.92rem;
    color: var(--text-main);
}

.filter-researcher-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-group-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}

.role-chips-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.role-chip {
    cursor: pointer;
    user-select: none;
    position: relative;
    display: inline-flex;
}

.role-chip input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.role-chip .chip-pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 13px;
    border-radius: 20px;
    border: 1.5px solid var(--border-subtle);
    background: var(--bg-surface);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.role-chip:hover .chip-pill {
    border-color: var(--accent);
    background: var(--bg-surface-alt);
}

.role-chip input[type="checkbox"]:checked + .chip-pill {
    background: rgba(0, 168, 150, 0.12);
    border-color: var(--accent);
    color: var(--accent-dark);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 168, 150, 0.15);
}

[data-theme="dark"] .role-chip input[type="checkbox"]:checked + .chip-pill {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-toggle-advanced {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-surface);
    border: 1.5px solid var(--border-subtle);
    padding: 8px 14px;
    border-radius: 12px;
    font-family: var(--font-thai);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    margin-left: auto;
}

.btn-toggle-advanced:hover, .btn-toggle-advanced.active {
    border-color: var(--accent);
    color: var(--accent-dark);
    background: rgba(0, 168, 150, 0.06);
}

.btn-toggle-advanced .chevron-icon {
    font-size: 18px;
    transition: transform 0.2s ease;
}

.adv-count-badge {
    background: var(--accent);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 7px;
    line-height: 1.4;
}

/* Tier 3: Advanced Drawer */
.filter-advanced-drawer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--border-subtle);
    animation: fadeInDown 0.25s ease-out;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.advanced-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.adv-field-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.adv-field-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
}

.adv-field-label .material-icons-outlined {
    font-size: 18px;
    color: var(--accent);
}

.adv-field-select {
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1.5px solid var(--border-subtle);
    background: var(--bg-surface-alt);
    font-family: var(--font-thai);
    font-size: 0.88rem;
    color: var(--text-main);
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.adv-field-select:hover, .adv-field-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 168, 150, 0.12);
}

.mta-toggle-group {
    display: flex;
    gap: 8px;
}

.mta-radio-chip {
    flex: 1;
    position: relative;
    cursor: pointer;
    user-select: none;
}

.mta-radio-chip input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.mta-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1.5px solid var(--border-subtle);
    background: var(--bg-surface-alt);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    transition: all 0.2s ease;
    text-align: center;
}

.mta-radio-chip:hover .mta-pill {
    border-color: var(--accent);
}

.mta-radio-chip input[type="radio"]:checked + .mta-pill {
    background: rgba(0, 168, 150, 0.12);
    border-color: var(--accent);
    color: var(--accent-dark);
    font-weight: 600;
}

/* Status bar */
.filter-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.88rem;
}

.filter-results-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
    font-weight: 500;
}

.filter-quick-tips {
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* ==========================================
   Category Section Headers & Upgraded Topic Cards
   ========================================== */
.topic-category-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    margin-top: 24px;
    margin-bottom: 8px;
    background: linear-gradient(90deg, rgba(15, 44, 89, 0.05), transparent);
    border-left: 4px solid var(--primary);
    border-radius: 0 12px 12px 0;
    flex-wrap: wrap;
    gap: 10px;
}

[data-theme="dark"] .topic-category-header {
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.08), transparent);
    border-left-color: var(--primary);
}

.cat-badge-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cat-header-icon {
    font-size: 22px;
    color: var(--primary);
}

.cat-header-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
}

.cat-counter-chip {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
}

/* Modern Form Cards */
.form-card.modern-topic-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.form-card.modern-topic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.form-card.modern-topic-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent-light);
}

.form-card.modern-topic-card:hover::before {
    opacity: 1;
}

.topic-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.topic-icon-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #EEF4FB, #E0EEFA);
    border: 1px solid #D0E1F9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

[data-theme="dark"] .topic-icon-avatar {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.3);
    color: var(--primary);
}

.topic-icon-avatar .material-icons-outlined {
    font-size: 24px;
}

.topic-tag-group .badge {
    margin-bottom: 0;
    padding: 5px 12px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    border-radius: 20px;
}

.topic-title {
    margin: 0 0 6px 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.4;
}

.topic-desc {
    margin: 0 0 14px 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.topic-conditions-box {
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 18px;
}

.conditions-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.conditions-title .material-icons-outlined {
    font-size: 16px;
    color: var(--accent);
}

.conditions-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.conditions-list li {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 0.84rem;
    line-height: 1.45;
    color: var(--text-main);
}

.bullet-dot {
    color: var(--accent);
    font-weight: bold;
    line-height: 1.2;
}

.topic-card-footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
}

.btn-topic-open {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--primary);
    color: #ffffff;
    font-family: var(--font-thai);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 44, 89, 0.15);
}

.btn-topic-open:hover {
    background: var(--accent);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 168, 150, 0.25);
}

.btn-topic-open .arrow-icon {
    font-size: 16px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.btn-topic-open:hover .arrow-icon {
    opacity: 1;
    transform: translateX(3px);
}

/* Empty State Card */
.topics-empty-card {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 24px;
    background: var(--bg-surface);
    border: 1.5px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.empty-icon-box {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bg-surface-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-icon-box .material-icons-outlined {
    font-size: 32px;
}

/* ================= ========================= */
/* Tooltip / Glossary Popup Styling             */
/* =========================================== */
.abbr-tooltip {
    position: relative;
    border-bottom: 1.5px dashed var(--accent);
    cursor: help;
    color: inherit;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
}

.abbr-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #0F2C59;
    color: #FFFFFF;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: normal;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease-in-out;
    z-index: 1000;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    pointer-events: none;
}

.abbr-tooltip::before {
    content: '';
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #0F2C59 transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease-in-out;
    z-index: 1000;
    pointer-events: none;
}

.abbr-tooltip:hover::after,
.abbr-tooltip:focus::after,
.abbr-tooltip:active::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.abbr-tooltip:hover::before,
.abbr-tooltip:focus::before,
.abbr-tooltip:active::before {
    opacity: 1;
    visibility: visible;
}


/* Utilities */
.loading-skeleton { background: linear-gradient(90deg, var(--bg-surface-alt) 25%, var(--border-subtle) 50%, var(--bg-surface-alt) 75%); background-size: 200% 100%; animation: loading 1.5s infinite; border-radius: 8px; height: 20px; width: 100%; }
@keyframes loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Dropdown Styles */
.nav-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    min-width: 220px;
    padding: 10px 0;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.nav-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu a {
    display: block;
    padding: 10px 20px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.dropdown-menu a:hover {
    background: var(--bg-surface-alt);
    color: var(--primary);
    padding-left: 25px;
}


/* ==========================================
   Disabled system link (app.js bindSystemLinks: system off / not yet public)
   ========================================== */
.btn.sys-link-disabled {
    background: var(--bg-surface-alt);
    color: var(--text-muted);
    border: 1px dashed var(--border-subtle);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
    font-weight: 600;
}
.btn.sys-link-disabled .material-icons-outlined { font-size: 18px; }

/* ==========================================
   GCP / HSP online training (#gcp-training in VIEW: FORMS)
   ========================================== */
#gcp-training { scroll-margin-top: 100px; margin-top: 40px; }
.gcp-panel { padding: 20px; }
.gcp-panel .panel-header h3 { color: var(--text-main); } /* beats the dark-mode h3 colour rule near the top */
.gcp-rules { margin-bottom: 20px; }
.gcp-order-note {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 12px 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}
.gcp-order-note .material-icons-outlined { font-size: 18px; color: var(--accent); }
.gcp-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.gcp-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-soft);
}
.gcp-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.gcp-step {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}
[data-theme="dark"] .gcp-step { color: #0F172A; }
.gcp-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.gcp-tag { padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; }
.gcp-type--gcp { background: rgba(0, 168, 150, 0.12); color: #00796B; }
.gcp-type--hsp { background: rgba(109, 40, 217, 0.12); color: #6D28D9; }
.gcp-level--easy { background: rgba(4, 120, 87, 0.12); color: #047857; }
.gcp-level--mid { background: rgba(180, 83, 9, 0.12); color: #B45309; }
.gcp-level--hard { background: rgba(185, 28, 28, 0.12); color: #B91C1C; }
[data-theme="dark"] .gcp-type--gcp { color: #5EEAD4; }
[data-theme="dark"] .gcp-type--hsp { color: #C4B5FD; }
[data-theme="dark"] .gcp-level--easy { color: #6EE7B7; }
[data-theme="dark"] .gcp-level--mid { color: #FCD34D; }
[data-theme="dark"] .gcp-level--hard { color: #FCA5A5; }
.gcp-title { margin: 0 0 4px 0; font-size: 1.05rem; color: var(--text-main); line-height: 1.4; }
.gcp-org { margin: 0 0 10px 0; font-size: 0.86rem; color: var(--text-muted); }
.gcp-facts {
    list-style: disc;
    margin: 0 0 16px 0;
    padding-left: 18px;
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--text-main);
    flex-grow: 1;
}
.gcp-fact-warn { color: #B45309; font-weight: 700; }
[data-theme="dark"] .gcp-fact-warn { color: #FCD34D; }
.gcp-open { margin-top: auto; }
[data-theme="dark"] .gcp-open { color: #0F172A; }
.gcp-footnote { margin: 16px 0 0 0; font-size: 0.8rem; color: var(--text-muted); }

/* Pointers to #gcp-training */
.gcp-chip { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; color: var(--accent-dark); border-color: var(--accent); }
.gcp-chip .material-icons-outlined { font-size: 16px; }
.gcp-chip:hover { background: var(--accent); color: #ffffff; }
.gcp-inline-link {
    display: inline-flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #E65100; /* the process step box is light in both themes */
    text-decoration: underline;
}
.gcp-inline-link .material-icons-outlined { font-size: 18px; }

@media (min-width: 640px) {
    .gcp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
    .gcp-panel { padding: 32px; }
}
@media (min-width: 1200px) {
    .gcp-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Auto-Fill "coming soon" strip in All Forms (System 01 on hold) */
.autofill-soon-strip {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; margin-bottom: 20px;
    border: 1px dashed var(--border-subtle); border-radius: 12px;
    background: var(--bg-surface-alt); color: var(--text-secondary); font-size: 0.9rem;
}
.autofill-soon-strip .material-icons-outlined { color: var(--accent); font-size: 20px; flex-shrink: 0; }

/* Home: services by user group */
.audience-section { margin: 8px 0 32px; }
.audience-heading { font-size: 1.15rem; color: var(--primary); margin: 0 0 14px; }
.audience-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 900px) { .audience-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .audience-grid { grid-template-columns: 1fr; } }
.audience-tile {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px;
    background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 12px;
    color: var(--text-main); text-decoration: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.audience-tile:hover, .audience-tile:focus-visible { border-color: var(--accent); box-shadow: 0 4px 12px rgba(15, 44, 89, 0.08); }
.audience-tile .material-icons-outlined { font-size: 26px; color: var(--accent); flex-shrink: 0; }
.audience-text { display: flex; flex-direction: column; line-height: 1.35; }
.audience-text small { color: var(--text-muted); font-size: 0.82rem; }

/* Deep-link targets sit below the sticky nav */
#gcp-training, #systems-office, #systems-legacy { scroll-margin-top: 96px; }

/* Breadcrumb / back bar on inner views */
.breadcrumb-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 20px; font-size: 0.9rem; color: var(--text-muted); }
.breadcrumb-bar[hidden] { display: none; }
.breadcrumb-back { display: inline-flex; align-items: center; gap: 4px; color: var(--primary); font-weight: 600; text-decoration: none; padding: 6px 12px 6px 8px; border-radius: 999px; background: var(--bg-surface-alt); }
.breadcrumb-back:hover, .breadcrumb-back:focus-visible { background: var(--border-subtle); }
.breadcrumb-back .material-icons-outlined { font-size: 18px; }

/* Footer: official identity (copied from docs/INSTITUTION_IDENTITY.md) */
.site-footer { margin-top: 60px; padding: 32px 20px; text-align: center; color: var(--text-muted); font-size: 0.88rem; line-height: 1.7; border-top: 1px solid var(--border-subtle); }
.site-footer p { margin: 0 0 8px; }
.site-footer strong { color: var(--text-main); }
.site-footer-small { font-size: 0.8rem; }

.calendar-open-link { margin: 10px 0 0; text-align: right; font-size: 0.88rem; }
.calendar-open-link a { color: var(--primary); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.calendar-open-link .material-icons-outlined { font-size: 16px; }

/* Hero + quick access on small screens (title was 6 lines, search button overflowed at 390 px) */
.hero h2 { font-size: clamp(1.35rem, 1rem + 1.8vw, 2.2rem); line-height: 1.35; }
.hero h3 { font-size: clamp(0.95rem, 0.85rem + 0.6vw, 1.35rem); }
.hero-glass-search input { min-width: 0; }
@media (max-width: 640px) {
    .hero { padding: 56px 18px 72px; }
    .hero-glass-search { padding: 6px 6px 6px 16px; }
    .hero-glass-search button { padding: 10px 16px; flex-shrink: 0; }
    .quick-access { grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 8px; }
    .q-card { padding: 16px 10px; }
    .q-icon { width: 44px; height: 44px; font-size: 1.4rem; margin-bottom: 10px; }
    .q-card h3 { font-size: 0.98rem; }
    .q-card p { font-size: 0.78rem; }
}
@media (max-width: 1500px) { .brand-text p { display: none; } }

/* Grid items must be allowed to shrink, otherwise the fee table widens the whole home grid on phones */
.dash-grid > *, .news-split-grid > * { min-width: 0; }
@media (max-width: 768px) { .glass-panel table { display: block; overflow-x: auto; } }
