/* CNX Education Platform - Modern Premium UI Theme */

:root {
    --brand-primary: #0ea5e9;
    --brand-secondary: #10b981;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
    --card-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.03);
    --hover-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.12), 0 1px 10px rgba(15, 23, 42, 0.05);
    --input-focus: rgba(14, 165, 233, 0.15);
}

body {
    background: 
        radial-gradient(circle at 10% 20%, rgba(14, 165, 233, 0.08) 0%, transparent 40rem),
        radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.06) 0%, transparent 45rem),
        var(--bg-gradient);
    font-family: 'Plus Jakarta Sans', 'Noto Sans Thai', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    letter-spacing: -0.01em;
}

/* Beautiful Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.2);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.4);
}

/* Glassmorphism Panel */
.glass-panel {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 20px 50px -12px rgba(15, 23, 42, 0.06);
}

/* Smooth Soft Card styling */
.soft-card {
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 1.5rem;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.soft-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--hover-shadow);
    border-color: rgba(14, 165, 233, 0.2);
}

/* Navigation Links */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border-radius: 1rem;
    padding: 0.8rem 1rem;
    color: #94a3b8;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

/* Active Navigation State */
.nav-link-active {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border-radius: 1rem;
    padding: 0.8rem 1rem;
    color: #ffffff !important;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15) 0%, rgba(52, 211, 153, 0.1) 100%);
    border: 1px solid rgba(56, 189, 248, 0.25) !important;
    box-shadow: 0 10px 25px -5px rgba(14, 165, 233, 0.15);
    font-weight: 600;
}

/* Custom Interactive Metric Cards */
.metric-card {
    position: relative;
    overflow: hidden;
}
.metric-card::after {
    content: "";
    position: absolute;
    right: -2rem;
    top: -2rem;
    width: 8rem;
    height: 8rem;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(16, 185, 129, 0.12));
    transition: transform 0.4s ease;
}
.metric-card:hover::after {
    transform: scale(1.15);
}

/* Global Form Input Overrides for Modern Aesthetic */
.input-modern,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
    border: 1px solid rgba(203, 213, 225, 0.8);
    border-radius: 1rem;
    padding: 0.75rem 1rem;
    background: #ffffff;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #0f172a;
    font-size: 0.95rem;
}
.input-modern:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px var(--input-focus);
    background: #ffffff;
}

/* Responsive Beautiful Tables */
table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}
th {
    background-color: rgba(248, 250, 252, 0.8) !important;
    color: #475569;
    font-weight: 700;
    padding: 1rem 0.85rem !important;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 2px solid #e2e8f0;
}
th:first-child {
    border-top-left-radius: 1rem;
}
th:last-child {
    border-top-right-radius: 1rem;
}
td {
    padding: 1rem 0.85rem !important;
    vertical-align: middle;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
    background-color: #ffffff;
    transition: background-color 0.2s;
}
tr:hover td {
    background-color: #f8fafc;
}
tr:last-child td:first-child {
    border-bottom-left-radius: 1rem;
}
tr:last-child td:last-child {
    border-bottom-right-radius: 1rem;
}

/* Question Cards in Survey Form */
.question-card {
    border-left: 6px solid var(--brand-primary);
    transition: all 0.3s ease;
}
.question-card:hover {
    border-left-width: 8px;
    border-left-color: #10b981;
}

/* Status Type Badges */
.type-pill {
    border-radius: 999px;
    padding: 0.3rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* Custom Interactive Accordions (details/summary) */
details {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
details summary {
    user-select: none;
    transition: all 0.2s ease;
}
details[open] {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.02);
}
details summary::-webkit-details-marker {
    display: none;
}
details summary::after {
    content: "▼";
    float: right;
    font-size: 0.75rem;
    color: #64748b;
    transition: transform 0.2s ease;
}
details[open] summary::after {
    transform: rotate(180deg);
}

/* Dynamic Buttons */
button,
a.bg-slate-950 {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
button:hover,
a.bg-slate-950:hover {
    transform: translateY(-1px);
}
button:active,
a.bg-slate-950:active {
    transform: translateY(1px);
}

/* Charts sizing and responsiveness */
.chart-canvas {
    width: 100% !important;
    height: 280px !important;
}

@media (max-width: 768px) {
    .chart-canvas {
        height: 240px !important;
    }
}

/* Chiang Mai Education Office landing page */
.cnx-landing {
    --cnx-purple: #4a148c; /* Deeper purple */
    --cnx-purple-2: #8e24aa; /* Vibrant purple */
    --cnx-lavender: #f3e5f5; /* Light purple */
    --cnx-accent: #d500f9;
    --cnx-orange: #ff914d;
    min-height: 100vh;
    color: #281234;
    background:
        radial-gradient(circle at 12% 8%, rgba(142, 36, 170, 0.15), transparent 30rem),
        radial-gradient(circle at 88% 12%, rgba(213, 0, 249, 0.1), transparent 30rem),
        linear-gradient(180deg, #ffffff 0%, #faf5ff 50%, #f4e8fb 100%);
    overflow: hidden;
}

.cnx-topbar,
.cnx-hero,
.cnx-overview,
.cnx-indicator-section,
.cnx-entry-panel {
    width: min(1180px, calc(100% - 32px));
    margin-inline: auto;
}

.cnx-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 0;
}

.cnx-brand,
.cnx-nav {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cnx-brand {
    color: var(--cnx-purple);
    text-decoration: none;
}

.cnx-brand-text {
    min-width: 0;
}

.cnx-brand strong {
    display: block;
    font-size: clamp(16px, 1.6vw, 21px);
    font-weight: 900;
    line-height: 1.25;
}

.cnx-brand small,
.cnx-map-title small,
.cnx-indicator-card small,
.cnx-entry-panel span,
.cnx-section-head span {
    display: block;
    color: #8f5da5;
    font-weight: 800;
}

.cnx-seal-mini {
    display: block;
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    overflow: hidden;
}

.cnx-seal-mini svg,
.cnx-seal-mini img,
.cnx-seal-card svg,
.cnx-seal-card img,
.cnx-info-icon svg,
.cnx-indicator-icon svg {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cnx-nav {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cnx-nav a {
    color: #5f3578;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 999px;
}

.cnx-nav a:hover {
    background: rgba(124, 63, 152, 0.1);
}

.cnx-nav-login,
.cnx-primary-btn {
    background: linear-gradient(135deg, var(--cnx-purple), var(--cnx-purple-2));
    color: #ffffff !important;
    box-shadow: 0 10px 20px -10px rgba(142, 36, 170, 0.6);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cnx-nav-login:hover,
.cnx-primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -10px rgba(142, 36, 170, 0.8);
    background: linear-gradient(135deg, var(--cnx-purple-2), var(--cnx-accent));
}

.cnx-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    align-items: center;
    gap: 42px;
    padding: 34px 0 54px;
}

.cnx-kicker {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 18px;
    border: 1px solid rgba(124, 63, 152, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--cnx-purple-2);
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 900;
}

.cnx-hero h1 {
    max-width: 680px;
    color: var(--cnx-purple);
    font-size: clamp(34px, 4.4vw, 58px);
    font-weight: 950;
    line-height: 1.08;
    margin: 0 0 18px;
    letter-spacing: 0;
}

.cnx-hero p,
.cnx-section-head p,
.cnx-info-card p,
.cnx-entry-panel p,
.cnx-modal-panel p {
    color: #664977;
    font-size: 15px;
    line-height: 1.75;
}

.cnx-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 28px 0 20px;
}

.cnx-primary-btn,
.cnx-secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border-radius: 999px;
    padding: 12px 22px;
    font-weight: 900;
    text-decoration: none;
    font-size: 14px;
}

.cnx-secondary-btn {
    color: var(--cnx-purple);
    background: #ffffff;
    border: 1px solid rgba(124, 63, 152, 0.22);
}

.cnx-stat-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 26px;
}

.cnx-stat-strip span {
    border: 1px solid rgba(124, 63, 152, 0.14);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    padding: 14px;
    color: #6a407d;
    font-size: 12px;
    font-weight: 800;
}

.cnx-stat-strip strong {
    display: block;
    color: var(--cnx-purple);
    font-size: 24px;
    line-height: 1;
}

.cnx-hero-visual {
    position: relative;
    min-height: 580px;
}

.cnx-seal-card,
.cnx-map-card,
.cnx-info-card,
.cnx-indicator-card,
.cnx-entry-panel,
.cnx-modal-panel {
    border: 1px solid rgba(124, 63, 152, 0.16);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 24px 70px -36px rgba(75, 35, 97, 0.55);
    backdrop-filter: blur(18px);
}

.cnx-seal-card {
    position: absolute;
    z-index: 2;
    top: 8px;
    left: 8px;
    width: 210px;
    border-radius: 28px;
    padding: 16px;
    text-align: center;
}

.cnx-seal-card svg,
.cnx-seal-card img {
    width: 160px;
    height: 74px;
    margin: auto;
}

.cnx-seal-card span {
    display: block;
    margin-top: 8px;
    color: var(--cnx-purple);
    font-weight: 900;
}

.cnx-map-card {
    position: absolute;
    right: 0;
    top: 20px;
    width: min(520px, 92%);
    min-height: 0;
    border-radius: 34px;
    padding: 24px;
}

.cnx-map-title {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.cnx-map-title strong {
    color: var(--cnx-purple);
    font-size: 24px;
    font-weight: 950;
}

.cnx-map-svg {
    width: 100%;
    height: 400px;
}

.cnx-osm-wrap {
    position: relative;
    width: 100%;
    height: 360px;
    overflow: hidden;
    border: 1px solid rgba(124, 63, 152, 0.2);
    border-radius: 24px;
    background: #f5e8ff;
}

.cnx-map-note {
    display: grid;
    gap: 3px;
    margin-top: 10px;
    color: #6f4a80;
    font-size: 12px;
    line-height: 1.45;
}

.cnx-map-note strong {
    color: var(--cnx-purple);
}

.cnx-osm-frame,
.cnx-leaflet-map {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.cnx-osm-frame {
    filter: saturate(0.95) contrast(1.02);
}

.cnx-leaflet-map {
    z-index: 1;
}

.cnx-map-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--cnx-purple);
    font-weight: 900;
    background: #f5e8ff;
}

.cnx-leaflet-map.leaflet-container + .cnx-map-fallback {
    display: none;
}

.cnx-map-pin {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border: 3px solid #fff;
    border-radius: 999px;
    background: #7b1fa2;
    box-shadow: 0 8px 18px rgba(75, 35, 97, 0.35);
}

.cnx-map-pin.school {
    background: #ff914d;
}

.cnx-map-label {
    border: 1px solid rgba(75, 35, 97, 0.2) !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.92) !important;
    color: #4b2361 !important;
    max-width: 132px;
    padding: 3px 7px !important;
    box-shadow: 0 8px 18px rgba(75, 35, 97, 0.12) !important;
    font-family: Tahoma, Arial, sans-serif;
    font-size: 10px;
    font-weight: 900;
    line-height: 1.25;
    white-space: normal !important;
    text-align: center;
}

.cnx-map-label::before {
    display: none;
}

.cnx-leaflet-map .cnx-map-label {
    display: none !important;
}

.cnx-map-poi-list {
    position: absolute;
    z-index: 450;
    left: 12px;
    right: 12px;
    bottom: 22px;
    display: grid;
    gap: 5px;
    border: 1px solid rgba(75, 35, 97, 0.16);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.92);
    color: #4b2361;
    padding: 10px 12px;
    box-shadow: 0 12px 28px rgba(75, 35, 97, 0.12);
    font-size: 11px;
    font-weight: 800;
    pointer-events: none;
}

.cnx-map-poi-list strong {
    font-size: 12px;
}

.cnx-map-poi-list span {
    display: flex;
    align-items: center;
    gap: 7px;
}

.cnx-map-poi-list i {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #7b1fa2;
    box-shadow: 0 0 0 3px rgba(123, 31, 162, 0.12);
}

.cnx-map-poi-list i.school {
    background: #ff914d;
    box-shadow: 0 0 0 3px rgba(255, 145, 77, 0.16);
}

.cnx-osm-link {
    display: inline-flex;
    margin-top: 12px;
    color: var(--cnx-purple);
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
}

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

.cnx-overview {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 58px;
}

.cnx-info-card {
    border-radius: 24px;
    padding: 24px;
}

.cnx-info-icon,
.cnx-indicator-icon {
    display: grid;
    place-items: center;
    color: var(--cnx-purple);
    background: linear-gradient(135deg, #ffffff, var(--cnx-lavender));
    border: 1px solid rgba(142, 36, 170, 0.2);
    box-shadow: 0 4px 15px -5px rgba(142, 36, 170, 0.15);
    transition: all 0.3s ease;
}

.cnx-info-icon {
    width: 60px;
    height: 60px;
    border-radius: 20px;
    margin-bottom: 16px;
}

.cnx-info-icon svg,
.cnx-indicator-icon svg {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0px 2px 4px rgba(142, 36, 170, 0.2));
}

.cnx-info-card h2 {
    color: var(--cnx-purple);
    font-size: 18px;
    font-weight: 950;
    margin-bottom: 8px;
}

.cnx-indicator-section {
    padding: 34px 0 56px;
}

.cnx-section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
}

.cnx-section-head h2,
.cnx-entry-panel h2,
.cnx-modal-panel h2 {
    color: var(--cnx-purple);
    font-size: clamp(24px, 3.2vw, 36px);
    font-weight: 950;
    line-height: 1.15;
    margin: 0;
}

.cnx-section-head p {
    max-width: 520px;
    margin: 0;
}

.cnx-category-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0 18px;
}

.cnx-category-row span {
    flex: 0 0 auto;
    border: 1px solid rgba(124, 63, 152, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: #6c3e82;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 900;
}

.cnx-indicator-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}

.cnx-indicator-card {
    position: relative;
    min-height: 200px;
    border-radius: 24px;
    padding: 20px;
    text-align: left;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(142, 36, 170, 0.15);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cnx-indicator-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(142, 36, 170, 0.4);
    box-shadow: 0 20px 40px -15px rgba(142, 36, 170, 0.25);
    background: #ffffff;
}

.cnx-indicator-card:hover .cnx-indicator-icon {
    background: linear-gradient(135deg, var(--cnx-lavender), #ffffff);
    transform: scale(1.1) rotate(5deg);
    color: var(--cnx-accent);
}

.cnx-indicator-no {
    color: var(--cnx-purple-2);
    background: var(--cnx-lavender);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 900;
}

.cnx-indicator-icon {
    width: 56px;
    height: 56px;
    border-radius: 20px;
    margin: 16px 0;
}

.cnx-indicator-card strong {
    display: -webkit-box;
    min-height: 60px;
    color: #321742;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.42;
    overflow: hidden;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.cnx-indicator-card small {
    margin-top: 10px;
    font-size: 11px;
}

.cnx-entry-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-radius: 30px;
    padding: 28px;
    margin-bottom: 56px;
}

.cnx-entry-panel p {
    margin: 8px 0 0;
}

.cnx-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(74, 20, 140, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.cnx-modal.is-open {
    display: flex;
}

.cnx-modal-panel {
    position: relative;
    width: min(680px, 100%);
    border-radius: 32px;
    padding: 40px;
    background: #ffffff;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cnx-modal-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.cnx-modal-detail-grid div {
    border: 1px solid rgba(124, 63, 152, 0.16);
    border-radius: 18px;
    background: #fbf7ff;
    padding: 14px;
}

.cnx-modal-detail-grid span {
    display: block;
    color: #8f5da5;
    font-size: 12px;
    font-weight: 900;
    margin-bottom: 6px;
}

.cnx-modal-detail-grid strong {
    display: block;
    color: #321742;
    font-size: 14px;
    line-height: 1.65;
}

.cnx-modal.is-open .cnx-modal-panel {
    transform: scale(1);
    opacity: 1;
}

.cnx-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: #f7ecff;
    color: var(--cnx-purple);
    font-size: 26px;
    line-height: 1;
}

.cnx-modal-badge {
    display: inline-flex;
    border-radius: 999px;
    background: var(--cnx-lavender);
    color: var(--cnx-purple-2);
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 900;
    margin-bottom: 16px;
}

.cnx-modal-panel a {
    display: inline-flex;
    margin-top: 18px;
    border-radius: 999px;
    background: var(--cnx-purple);
    color: #fff;
    padding: 12px 18px;
    font-weight: 900;
    text-decoration: none;
}

@media (max-width: 1024px) {
    .cnx-hero,
    .cnx-overview {
        grid-template-columns: 1fr;
    }

    .cnx-hero-visual {
        min-height: 560px;
    }

    .cnx-indicator-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .cnx-topbar,
    .cnx-section-head,
    .cnx-entry-panel {
        align-items: flex-start;
        flex-direction: column;
    }

    .cnx-nav {
        justify-content: flex-start;
    }

    .cnx-hero {
        padding-top: 18px;
    }

    .cnx-stat-strip,
    .cnx-indicator-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cnx-hero-visual {
        min-height: auto;
    }

    .cnx-map-card {
        position: relative;
        inset: auto;
        width: 100%;
    }

    .cnx-map-card {
        margin-top: 16px;
        min-height: auto;
    }

    .cnx-map-svg {
        height: 330px;
    }

    .cnx-osm-wrap {
        height: 340px;
    }

    .cnx-indicator-card {
        min-height: 178px;
        padding: 14px;
    }
}

@media (max-width: 440px) {
    .cnx-stat-strip,
    .cnx-indicator-grid {
        grid-template-columns: 1fr;
    }
}

/* Portal-style polish inspired by the reference academic system */
.cnx-landing {
    background:
        repeating-linear-gradient(135deg, rgba(124, 58, 237, 0.035) 0 10px, transparent 10px 22px),
        radial-gradient(circle at 12% 8%, rgba(142, 36, 170, 0.12), transparent 30rem),
        radial-gradient(circle at 90% 18%, rgba(99, 102, 241, 0.12), transparent 32rem),
        linear-gradient(180deg, #ffffff 0%, #fbf8ff 48%, #f4efff 100%);
}

.cnx-topbar,
.cnx-hero,
.cnx-overview,
.cnx-portal-grid,
.cnx-indicator-section,
.cnx-entry-panel {
    width: min(1220px, calc(100% - 32px));
}

.cnx-topbar {
    border-bottom: 1px solid rgba(124, 63, 152, 0.08);
}

.cnx-hero {
    gap: 34px;
    padding: 28px 0 22px;
}

.cnx-hero h1 {
    max-width: 560px;
    font-size: clamp(26px, 3.1vw, 40px);
    line-height: 1.16;
}

.cnx-hero p {
    max-width: 620px;
    font-size: 14px;
    line-height: 1.8;
}

.cnx-kicker {
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(75, 35, 97, 0.05);
}

.cnx-hero-visual {
    min-height: 610px;
}

.cnx-map-card {
    width: min(540px, 96%);
}

.cnx-portal-grid {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 280px;
    gap: 18px;
    align-items: start;
    margin: 8px auto 34px;
}

.cnx-portal-card {
    border: 1px solid rgba(124, 63, 152, 0.14);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 45px rgba(75, 35, 97, 0.08);
    overflow: hidden;
}

.cnx-portal-card h2,
.cnx-card-head {
    margin: 0;
    background: linear-gradient(135deg, #eef2ff, #f5e8ff);
    color: #2d1950;
    border-bottom: 1px solid rgba(124, 63, 152, 0.12);
    padding: 16px 18px;
    font-size: 17px;
    font-weight: 950;
}

.cnx-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cnx-card-head h2 {
    padding: 0;
    border: 0;
    background: transparent;
}

.cnx-card-head a {
    flex: 0 0 auto;
    border: 1px solid rgba(124, 63, 152, 0.22);
    border-radius: 999px;
    color: #6b21a8;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
}

.cnx-stat-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 18px;
    border-bottom: 1px solid #f2e7ff;
    color: #4f3d5f;
    font-size: 14px;
    font-weight: 800;
}

.cnx-stat-row strong {
    color: #4b148c;
    font-size: 18px;
    font-weight: 950;
    white-space: nowrap;
}

.cnx-stat-row small {
    color: #7b668e;
    font-size: 11px;
    font-weight: 800;
}

.cnx-stat-total {
    display: block;
    margin: 16px 18px 18px;
    border: 1px dashed rgba(124, 63, 152, 0.35);
    border-radius: 18px;
    background: #f7f0ff;
    color: #4b148c;
    padding: 16px;
    text-align: center;
    text-decoration: none;
}

.cnx-stat-total span,
.cnx-stat-total strong {
    display: block;
}

.cnx-stat-total strong {
    margin-top: 4px;
    font-size: 26px;
    font-weight: 950;
}

.cnx-stat-total em {
    display: block;
    margin-top: 6px;
    color: #6e5a7f;
    font-size: 12px;
    font-style: normal;
    font-weight: 900;
}

.cnx-notice-item {
    display: flex;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid #f2e7ff;
}

.cnx-notice-item span {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: #fee2f3;
    position: relative;
}

.cnx-notice-item span::after {
    content: "";
    position: absolute;
    inset: 11px;
    border-radius: 999px;
    background: #d946ef;
}

.cnx-notice-item strong {
    color: #2d1950;
    font-weight: 950;
}

.cnx-notice-item p {
    margin: 5px 0 0;
    color: #6e5a7f;
    font-size: 13px;
    line-height: 1.65;
}

.cnx-menu-card {
    padding-bottom: 10px;
}

.cnx-menu-card a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #554164;
    text-decoration: none;
    padding: 13px 18px;
    border-bottom: 1px solid #f2e7ff;
    font-weight: 800;
}

.cnx-menu-card a::before {
    content: "›";
    color: #8b5cf6;
    font-size: 20px;
    line-height: 1;
}

.cnx-menu-card a:hover {
    color: #4b148c;
    background: #fbf7ff;
}

@media (max-width: 1024px) {
    .cnx-portal-grid {
        grid-template-columns: 1fr;
    }
}

/* Full portal sections for the Chiang Mai education landing page */
.cnx-feature-showcase,
.cnx-process-section,
.cnx-site-footer {
    width: min(1220px, calc(100% - 32px));
    margin-left: auto;
    margin-right: auto;
}

.cnx-feature-showcase {
    margin: 14px auto 34px;
}

.cnx-section-head-compact {
    margin-bottom: 16px;
}

.cnx-feature-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.cnx-feature-card {
    min-height: 178px;
    padding: 18px;
    border: 1px solid rgba(124, 63, 152, 0.14);
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(251, 247, 255, 0.94)),
        #ffffff;
    box-shadow: 0 18px 42px rgba(75, 35, 97, 0.07);
    color: #3b175f;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.cnx-feature-card:hover {
    transform: translateY(-3px);
    border-color: rgba(124, 63, 152, 0.32);
    box-shadow: 0 24px 52px rgba(75, 35, 97, 0.12);
}

.cnx-feature-card span {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: #fff7ff;
    color: #6b21a8;
    border: 1px solid #ecd9ff;
}

.cnx-feature-card svg {
    width: 28px;
    height: 28px;
}

.cnx-feature-card strong {
    font-size: 17px;
    font-weight: 950;
    line-height: 1.35;
}

.cnx-feature-card small {
    color: #6e5a7f;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.65;
}

.cnx-process-section {
    margin: 0 auto 34px;
    padding: 24px;
    border: 1px solid rgba(124, 63, 152, 0.14);
    border-radius: 26px;
    background:
        radial-gradient(circle at 12% 20%, rgba(192, 132, 252, 0.22), transparent 20rem),
        linear-gradient(135deg, #4b148c 0%, #7e22ce 58%, #a855f7 100%);
    color: #ffffff;
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    gap: 24px;
    align-items: center;
    box-shadow: 0 24px 55px rgba(75, 35, 97, 0.16);
}

.cnx-process-copy span {
    display: inline-flex;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 12px;
    font-weight: 900;
}

.cnx-process-copy h2 {
    margin: 14px 0 10px;
    font-size: clamp(24px, 2.6vw, 36px);
    line-height: 1.2;
    letter-spacing: 0;
}

.cnx-process-copy p {
    margin: 0;
    color: #f3e8ff;
    font-size: 14px;
    line-height: 1.8;
}

.cnx-process-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.cnx-process-list article {
    display: flex;
    gap: 12px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
}

.cnx-process-list b {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #ffffff;
    color: #6b21a8;
    font-size: 16px;
    font-weight: 950;
}

.cnx-process-list strong {
    display: block;
    color: #ffffff;
    font-size: 15px;
    font-weight: 950;
}

.cnx-process-list p {
    margin: 5px 0 0;
    color: #f6eaff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.65;
}

.cnx-site-footer {
    margin-top: 28px;
    padding: 20px 0 28px;
    border-top: 1px solid rgba(124, 63, 152, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    color: #4b148c;
}

.cnx-footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cnx-footer-brand strong {
    display: block;
    font-size: 16px;
    font-weight: 950;
}

.cnx-footer-brand small {
    display: block;
    margin-top: 2px;
    color: #8b5a9d;
    font-size: 12px;
    font-weight: 800;
}

.cnx-site-footer nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.cnx-site-footer nav a {
    border: 1px solid rgba(124, 63, 152, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    color: #5b21b6;
    padding: 8px 12px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 900;
}

.cnx-site-footer nav a:hover {
    background: #f4e8ff;
}

.cnx-hero h1 {
    max-width: 560px;
    font-size: clamp(26px, 3.1vw, 40px);
    line-height: 1.16;
}

@media (max-width: 1024px) {
    .cnx-feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cnx-process-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .cnx-feature-grid,
    .cnx-process-list {
        grid-template-columns: 1fr;
    }

    .cnx-process-section {
        padding: 18px;
        border-radius: 22px;
    }

    .cnx-site-footer {
        display: block;
    }

    .cnx-site-footer nav {
        justify-content: flex-start;
        margin-top: 14px;
    }
}

@media (max-width: 720px) {
    html,
    body,
    .cnx-landing {
        max-width: 100%;
        overflow-x: hidden;
    }

    .cnx-topbar,
    .cnx-hero,
    .cnx-overview,
    .cnx-portal-grid,
    .cnx-indicator-section,
    .cnx-entry-panel,
    .cnx-feature-showcase,
    .cnx-process-section,
    .cnx-site-footer {
        width: min(1220px, calc(100% - 24px));
    }

    .cnx-brand {
        gap: 10px;
        width: 100%;
    }

    .cnx-seal-mini {
        width: 52px;
        height: 52px;
    }

    .cnx-brand strong {
        font-size: 16px;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }

    .cnx-brand small {
        font-size: 11px;
    }

    .cnx-nav {
        width: 100%;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 3px;
        scrollbar-width: none;
    }

    .cnx-nav::-webkit-scrollbar {
        display: none;
    }

    .cnx-nav a {
        flex: 0 0 auto;
        padding: 8px 10px;
        font-size: 12px;
    }

    .cnx-hero {
        gap: 18px;
        padding-top: 22px;
    }

    .cnx-hero-copy,
    .cnx-hero-visual,
    .cnx-map-card {
        min-width: 0;
        max-width: 100%;
    }

    .cnx-kicker {
        max-width: 340px;
        white-space: normal;
        overflow-wrap: anywhere;
        font-size: 12px;
    }

    .cnx-hero h1 {
        max-width: 340px;
        font-size: 25px;
        line-height: 1.18;
        overflow-wrap: anywhere;
        word-break: break-all;
    }

    .cnx-hero p {
        max-width: 340px;
        font-size: 13px;
        line-height: 1.75;
        overflow-wrap: anywhere;
    }

    .cnx-hero-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
        max-width: 320px;
    }

    .cnx-primary-btn,
    .cnx-secondary-btn {
        width: 100%;
        max-width: 320px;
        box-sizing: border-box;
        padding-left: 14px;
        padding-right: 14px;
    }

    .cnx-stat-strip {
        gap: 10px;
    }

    .cnx-map-card {
        width: 100%;
        padding: 16px;
        border-radius: 22px;
    }

    .cnx-map-title {
        display: block;
    }

    .cnx-map-title small {
        margin-top: 3px;
        overflow-wrap: anywhere;
    }

    .cnx-osm-wrap,
    .cnx-leaflet-map {
        width: 100%;
        max-width: 100%;
    }

    .cnx-map-poi-list {
        left: 8px;
        right: 8px;
        font-size: 10px;
    }
}
