/* =========================================================
   Hospital Web Center — Modern Public Theme v2.0
   ========================================================= */

/* ---------- Design Tokens ---------- */
:root {
    --primary: #2563eb;
    --primary-600: #1d4ed8;
    --primary-700: #1e40af;
    --primary-50: #eff6ff;
    --accent: #06b6d4;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    --text: #0f172a;
    --text-muted: #64748b;
    --text-soft: #94a3b8;
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 4px 12px rgba(15, 23, 42, .08);
    --shadow-md: 0 10px 25px rgba(15, 23, 42, .10);
    --shadow-lg: 0 20px 45px rgba(15, 23, 42, .15);

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-pill: 999px;

    --gradient-primary: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
    --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --gradient-cool: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
    --gradient-soft: linear-gradient(180deg, #eff6ff 0%, #f8fafc 100%);

    --transition: 200ms cubic-bezier(.4,0,.2,1);
    --container: 1280px;

    --font-sans: 'Sarabun','Prompt','Segoe UI',sans-serif;
}

[data-theme="dark"] {
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-soft: #64748b;
    --bg: #0b1220;
    --surface: #111a2e;
    --surface-2: #182238;
    --border: #1e2a44;
    --border-strong: #334155;
    --primary-50: #16213a;
    --shadow: 0 4px 12px rgba(0, 0, 0, .35);
    --shadow-md: 0 10px 25px rgba(0, 0, 0, .45);
    --shadow-lg: 0 20px 45px rgba(0, 0, 0, .55);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-700); }

h1, h2, h3, h4 { font-family: 'Prompt', var(--font-sans); font-weight: 600; line-height: 1.3; color: var(--text); }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: #fff;
    padding: 8px 16px;
    z-index: 1000;
}
.skip-link:focus { top: 0; }

/* ---------- Navbar ---------- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--nav-bg, rgba(255, 255, 255, .85));
    color: var(--nav-tc, var(--text));
    border-bottom: 1px solid var(--border);
    transition: background var(--transition), border-color var(--transition);
}
[data-theme="dark"] .navbar { background: var(--nav-bg, rgba(17, 26, 46, .85)); }

/* Position variants */
.navbar.nav-pos-static { position: static; }

/* Height variants */
.navbar.nav-h-compact .nav-wrapper { padding-top: 8px; padding-bottom: 8px; }
.navbar.nav-h-large .nav-wrapper   { padding-top: 22px; padding-bottom: 22px; }

/* Shadow variants */
.navbar.nav-shadow-none   { border-bottom: none; box-shadow: none; }
.navbar.nav-shadow-subtle { box-shadow: 0 1px 4px rgba(15, 23, 42, .04); }
.navbar.nav-shadow-strong { box-shadow: 0 8px 24px rgba(15, 23, 42, .12); border-bottom: none; }

/* Blur (glass) */
.navbar.nav-blur {
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
}

/* Menu alignment */
.navbar.nav-align-start .nav-menu { margin-right: auto; margin-left: 16px; }
.navbar.nav-align-center .nav-menu { margin: 0 auto; }
.navbar.nav-align-end .nav-menu   { margin-left: auto; }

/* Divider in nav-menu */
.nav-divider {
    width: 1px;
    height: 22px;
    background: var(--border);
    margin: 0 6px;
    align-self: center;
}

/* =========================================================
   Dropdown Sub-menu (parent → children)
   ========================================================= */
.nav-has-children {
    position: relative;
}
.nav-has-children > .nav-parent {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.nav-caret {
    font-size: 10px;
    margin-left: 2px;
    transition: transform 200ms;
    opacity: .7;
}
.nav-has-children:hover .nav-caret,
.nav-has-children:focus-within .nav-caret,
.nav-has-children.open .nav-caret {
    transform: rotate(180deg);
    opacity: 1;
}

.nav-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 200ms, transform 200ms, visibility 0s linear 200ms;
    z-index: 200;
}
.nav-has-children:hover > .nav-dropdown,
.nav-has-children:focus-within > .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 200ms, transform 200ms, visibility 0s;
}

/* Hover bridge — กันเมาส์หลุดระหว่าง parent กับ dropdown */
.nav-has-children::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 12px;
    pointer-events: none;
}
.nav-has-children:hover::before { pointer-events: auto; }

.nav-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    color: var(--text);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    background: transparent;
    transition: all 150ms;
    white-space: nowrap;
}
.nav-dropdown a:hover {
    background: var(--primary-50);
    color: var(--primary);
}
.nav-dropdown a.active {
    background: var(--gradient-primary);
    color: #fff;
}
.nav-dropdown a.active:hover { color: #fff; }
.nav-dropdown a i {
    width: 18px;
    text-align: center;
    color: var(--primary);
    font-size: 13px;
}
.nav-dropdown a.active i,
.nav-dropdown a:hover i { color: inherit; }

.nav-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 8px;
}

/* On mobile (collapsed nav-menu) — dropdown shows inline */
@media (max-width: 960px) {
    .nav-has-children { width: 100%; }
    .nav-has-children > .nav-parent { width: 100%; justify-content: space-between; }
    .nav-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        background: var(--surface-2);
        margin: 4px 0 4px 16px;
        max-height: 0;
        overflow: hidden;
        padding: 0;
        transition: max-height 250ms, padding 250ms;
    }
    /* บน mobile ใช้ .open จาก JS เท่านั้น — ไม่ใช้ :focus-within
       เพราะ tap แล้ว link ได้ focus ค้าง → :focus-within เปิดทับ JS ที่ปิด */
    .nav-has-children.open > .nav-dropdown {
        max-height: 500px;
        padding: 6px;
    }
    .nav-has-children > .nav-parent { cursor: pointer; }
}

.nav-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    padding-bottom: 14px;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
}
.logo:hover { color: var(--primary); }

.logo-icon {
    font-size: 30px;
    filter: drop-shadow(0 2px 4px rgba(37, 99, 235, .25));
}
.logo-img {
    height: 42px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(37, 99, 235, .15));
}
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-text strong { font-size: 17px; font-weight: 700; }
.logo-text small { font-size: 11px; color: var(--text-muted); letter-spacing: 1px; }

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

.nav-menu a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
    transition: all var(--transition);
}
.nav-menu a:hover { color: var(--primary); background: var(--primary-50); }
.nav-menu a.active {
    color: #fff;
    background: var(--gradient-primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
}

.btn-admin {
    margin-left: 8px;
    background: var(--gradient-primary) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
}
.btn-admin:hover { transform: translateY(-1px); }

.theme-toggle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text);
    transition: all var(--transition);
}
.theme-toggle:hover { background: var(--primary-50); color: var(--primary); transform: rotate(15deg); }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
}
.nav-toggle span {
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all var(--transition);
}

@media (max-width: 960px) {
    .nav-toggle { display: flex; }
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--surface);
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        gap: 6px;
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
        transform: translateY(-12px);
        opacity: 0;
        pointer-events: none;
        transition: all var(--transition);
    }
    .nav-menu.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
}

/* ---------- Main / Hero ---------- */
.main-content { padding: 32px 0 64px; }

.hero {
    background: var(--gradient-primary);
    color: #fff;
    padding: 64px 0;
    border-radius: var(--radius-lg);
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,.1) 0%, transparent 40%);
    pointer-events: none;
}
.hero-inner { position: relative; text-align: center; }
.hero h1 { color: #fff; font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 12px; }
.hero p { font-size: 1.05rem; opacity: .92; max-width: 640px; margin: 0 auto; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.card-header h2 {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
}

.card-body { padding: 8px 24px 24px; }

.btn-link {
    color: var(--primary);
    font-weight: 500;
    font-size: 14px;
}

/* ---------- Dashboard Grid ---------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}
.dashboard-grid .full-row { grid-column: 1 / -1; }
@media (max-width: 960px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* ---------- Announcement Items ---------- */
.announcement-item {
    position: relative;
    padding: 18px;
    margin-bottom: 12px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--info);
    transition: all var(--transition);
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0;
}
.announcement-item:hover {
    transform: translateX(4px);
    border-color: var(--primary);
    box-shadow: var(--shadow);
}
.announcement-item.urgent {
    border-left-color: var(--danger);
    background: linear-gradient(90deg, #fef2f2 0%, var(--surface) 30%);
}
[data-theme="dark"] .announcement-item.urgent { background: linear-gradient(90deg, #2a1414 0%, var(--surface) 30%); }
.announcement-item.high { border-left-color: var(--warning); }
.announcement-item.medium { border-left-color: var(--info); }
.announcement-item.low { border-left-color: var(--text-soft); }

.announcement-item h3 {
    font-size: 1.05rem;
    margin: 8px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
}
.announcement-item h3 a {
    color: inherit;
    word-break: break-word;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    min-width: 0;
}
.meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    word-break: break-word;
    max-width: 100%;
}
.excerpt {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.55;
}
.read-more { font-weight: 600; font-size: 14px; }
.read-more:hover { letter-spacing: .3px; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    margin-right: 6px;
}
.badge.pinned { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.priority-urgent { background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff; }
.priority-high { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.priority-medium { background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; }
.priority-low { background: var(--surface-2); color: var(--text-muted); }

/* ---------- News ---------- */
.news-item {
    display: flex;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.news-item:last-child { border-bottom: none; }
.news-img {
    width: 110px;
    height: 90px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.news-content h3 { font-size: 1rem; margin-bottom: 6px; }
.news-content p { font-size: 13px; color: var(--text-muted); }
.news-content .date { font-size: 12px; margin-bottom: 6px; }

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}
.news-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
}
.news-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.news-card-img {
    aspect-ratio: 16/9;
    background: var(--surface-2);
    object-fit: cover;
    width: 100%;
}
.news-card-body { padding: 18px; flex: 1; display: flex; flex-direction: column; }
.news-card-body h3 { font-size: 1.05rem; margin-bottom: 8px; }
.news-card-body p { font-size: 14px; color: var(--text-muted); flex: 1; }

/* ---------- Events ---------- */
.event-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.event-item:last-child { border-bottom: none; }

.event-date {
    background: var(--gradient-primary);
    color: #fff;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    text-align: center;
    min-width: 64px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .25);
    flex-shrink: 0;
}
.event-date .day { font-size: 22px; font-weight: 700; display: block; line-height: 1; }
.event-date .month { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; opacity: .9; }

.event-info h3 { font-size: 1rem; margin-bottom: 4px; }
.event-info p { font-size: 13px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; }

/* ---------- Quick Links / Departments ---------- */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.quick-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-weight: 500;
    transition: all var(--transition);
}
.quick-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    color: var(--primary);
}
.quick-link .icon { font-size: 22px; }

/* ---------- Stats ---------- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-pill {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition);
}
.stat-pill:hover { transform: translateY(-2px); }
.stat-pill .icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    display: grid; place-items: center;
    font-size: 22px;
    background: var(--gradient-primary);
    color: #fff;
}
.stat-pill .value { font-size: 1.4rem; font-weight: 700; line-height: 1; }
.stat-pill .label { font-size: 13px; color: var(--text-muted); }

/* ---------- Tables ---------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.data-table th, .data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.data-table th {
    background: var(--surface-2);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: .5px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: var(--surface-2); }

/* ---------- Buttons / Forms ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
}
.btn-primary { background: var(--gradient-primary); color: #fff; box-shadow: 0 4px 12px rgba(37, 99, 235, .25); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(37, 99, 235, .35); color: #fff; }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}
.form-control,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="time"],
input[type="search"], input[type="url"], input[type="tel"],
select, textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    transition: all var(--transition);
}
.form-control:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
textarea { min-height: 120px; resize: vertical; }

/* ---------- Page header ---------- */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
}
.page-header h1 { display: inline-flex; align-items: center; gap: 12px; }
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--text-muted); }

/* ---------- Search bar ---------- */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    align-items: center;
}
.search-bar input { flex: 1; }

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin: 32px 0;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    min-width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--gradient-primary); color: #fff; border-color: transparent; }

/* ---------- Flash messages ---------- */
.flash-wrap { padding-top: 16px; }
.flash {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    animation: slideDown .3s ease;
}
.flash-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash-error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.flash-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.flash-icon { font-size: 18px; }
.flash-msg { flex: 1; font-size: 14px; }
.flash-close { font-size: 22px; line-height: 1; opacity: .6; }
.flash-close:hover { opacity: 1; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Detail page ---------- */
.detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
    min-width: 0;
}
.detail-card h1 {
    font-size: 1.8rem;
    margin-bottom: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    -webkit-hyphens: auto;
    hyphens: auto;
}
.detail-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 0;
    margin-bottom: 24px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
}
.detail-content {
    font-size: 16px;
    line-height: 1.8;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}
.detail-content img,
.detail-content video,
.detail-content iframe {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 16px 0;
    display: block;
}
.detail-content p { margin-bottom: 14px; }
.detail-content pre,
.detail-content code {
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 100%;
    overflow-x: auto;
    font-family: 'Cascadia Code', 'Consolas', monospace;
}
.detail-content pre {
    background: var(--surface-2);
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin: 14px 0;
}
.detail-content code {
    background: var(--surface-2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .92em;
}
.detail-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 14px 0;
}
.detail-content table th,
.detail-content table td {
    padding: 8px 12px;
    border: 1px solid var(--border);
}
.detail-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 8px 16px;
    margin: 14px 0;
    background: var(--surface-2);
    color: var(--text-muted);
    border-radius: 4px;
}
.detail-content a {
    word-break: break-all;
}
.detail-content ul,
.detail-content ol {
    padding-left: 24px;
    margin-bottom: 14px;
}
.hero-image {
    display: block;
    max-width: 100%;
    width: auto;
    height: auto;
    margin: 0 auto 24px;
    border-radius: var(--radius);
    background: #f1f5f9;
}

/* =========================================================
   Post Card Grid (announcements / news list)
   ========================================================= */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.post-card {
    --accent: var(--primary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 280ms cubic-bezier(.4,0,.2,1),
                box-shadow 280ms cubic-bezier(.4,0,.2,1),
                border-color 280ms cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text);
    position: relative;
    isolation: isolate;
}
.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
    color: var(--text);
}

/* Top image area */
.post-card-img {
    position: relative;
    aspect-ratio: 16 / 11;
    background: var(--surface-2);
    overflow: hidden;
}
.post-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 500ms cubic-bezier(.4,0,.2,1);
}
.post-card:hover .post-card-img img { transform: scale(1.06); }

.post-card-img-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: rgba(255,255,255,.85);
    font-size: 64px;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #000));
    position: relative;
}
.post-card-img-placeholder::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,.20) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,.12) 0%, transparent 40%);
}
.post-card-img-placeholder i { position: relative; z-index: 1; }

/* Tag overlay (top-left) */
.post-card-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255, 255, 255, .96);
    color: var(--text);
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .2px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .15);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    max-width: calc(100% - 24px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 2;
}
[data-theme="dark"] .post-card-tag { background: rgba(17, 26, 46, .96); color: var(--text); }

/* Pin icon (top-right) */
.post-card-pin {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, .4);
    z-index: 2;
}

/* Priority overlay (bottom-right of image) */
.post-card-priority {
    position: absolute;
    bottom: 12px;
    right: 12px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
    z-index: 2;
}
.post-card-priority.priority-urgent { background: linear-gradient(135deg, #ef4444, #b91c1c); animation: pulseUrgent 1.6s infinite; }
.post-card-priority.priority-high   { background: linear-gradient(135deg, #f59e0b, #d97706); }

@keyframes pulseUrgent {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}

/* Body */
.post-card-body {
    padding: 16px 18px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.post-card-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    min-height: 2.9em;
}
.post-card-badge {
    align-self: flex-start;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
}

.post-card-excerpt {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

/* Event-specific date badge (calendar tear-off, top-right) */
.event-date-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 56px;
    background: rgba(255, 255, 255, .98);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(15, 23, 42, .18);
    text-align: center;
    line-height: 1;
    z-index: 2;
}
[data-theme="dark"] .event-date-badge { background: rgba(17, 26, 46, .98); }

.event-date-badge .day {
    display: block;
    background: var(--accent);
    color: #fff;
    padding: 4px 0 5px;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
}
.event-date-badge .month {
    display: block;
    padding: 4px 0 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
}
.event-date-badge .year {
    display: block;
    padding: 0 0 5px;
    font-size: 10px;
    color: var(--text-muted);
}

.event-info-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.event-info-list span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.event-info-list i { width: 14px; color: var(--accent); }

/* Override: events grid should auto-fit ~3 cols */
.post-card--event:hover { transform: translateY(-4px); }

/* Footer */
.post-card-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}
.post-card-org {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}
.post-card-org-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 11px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}
.post-card-org-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}
.post-card-date {
    flex-shrink: 0;
    font-weight: 500;
}

/* Page header — meta on right */
.page-header-meta {
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    gap: 14px;
    align-items: center;
}

/* Fallback when color-mix unsupported */
@supports not (color: color-mix(in srgb, red, blue)) {
    .post-card-img-placeholder { background: var(--accent); }
}

/* ---------- Empty state ---------- */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
}
.empty-state i { font-size: 48px; opacity: .4; margin-bottom: 16px; }
.empty-state h3 { color: var(--text); margin-bottom: 8px; }

/* ---------- Footer (single-line, ultra-compact) ---------- */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: 32px;
    color: var(--text-muted);
    font-size: 12px;
}
.footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 24px;
    flex-wrap: wrap;
}
.footer-brand { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.footer-brand img { height: 20px; width: auto; max-width: 80px; }
.footer-brand .logo-icon { font-size: 16px; }
.footer-brand strong { font-weight: 600; }
.footer-contact { color: var(--text-muted); }
.footer-contact i { margin-right: 2px; opacity: .7; }
.footer-sep { margin: 0 8px; opacity: .4; }
.footer-meta { color: var(--text-muted); opacity: .7; font-size: 11px; }

@media (max-width: 720px) {
    .footer-row { gap: 8px; padding: 8px 16px; flex-direction: column; text-align: center; }
    .news-item { flex-direction: column; }
    .news-img { width: 100%; height: 180px; }
}

/* ---------- Back to top ---------- */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: var(--shadow-md);
    display: grid;
    place-items: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: all var(--transition);
    z-index: 50;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.back-to-top:hover { transform: translateY(-2px) scale(1.05); }

/* ---------- Animations ---------- */
.fade-in { animation: fadeIn .5s ease both; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Section title ---------- */
.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

/* ---------- Login card ---------- */
.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: var(--gradient-primary);
    padding: 24px;
    position: relative;
    overflow: hidden;
}
.login-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 10% 10%, rgba(255,255,255,.18) 0%, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(255,255,255,.12) 0%, transparent 40%);
    pointer-events: none;
}
.login-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .icon { font-size: 48px; }
.login-logo h2 { margin-top: 8px; }
.login-card h2 { text-align: center; }

/* =========================================================
   Home Sections (Page Builder output) — managed by Muuri
   .home-sections = position relative · items position absolute
   width จาก class col-w-N (1..12)
   ========================================================= */
.home-sections {
    position: relative;
    padding: 8px 0 24px;
}

/* =========================================================
   Container Queries — content adapts to its section's width
   ========================================================= */

/* Department card */
.dept-card {
    --dept-color: var(--primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    text-decoration: none;
    color: var(--text);
    text-align: center;
    transition: transform 200ms cubic-bezier(.4,0,.2,1),
                box-shadow 200ms cubic-bezier(.4,0,.2,1),
                border-color 200ms;
    position: relative;
    overflow: hidden;
}
.dept-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: var(--dept-color);
    opacity: .8;
}
.dept-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(15,23,42,.12);
    border-color: var(--dept-color);
    color: var(--text);
}
.dept-card-icon {
    font-size: 36px;
    line-height: 1;
    margin-top: 6px;
    transition: transform 200ms;
}
.dept-card:hover .dept-card-icon { transform: scale(1.15); }
.dept-card-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    word-break: break-word;
}
.dept-card-en {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: .3px;
}

/* Department grid: 1/2/3/4/5/6 cols ตามขนาด section */
@container section (min-width: 1080px) {
    .dept-grid { grid-template-columns: repeat(6, 1fr) !important; }
}
@container section (min-width: 810px) and (max-width: 1079.99px) {
    .dept-grid { grid-template-columns: repeat(5, 1fr) !important; }
}
@container section (min-width: 600px) and (max-width: 809.99px) {
    .dept-grid { grid-template-columns: repeat(4, 1fr) !important; }
}
@container section (min-width: 440px) and (max-width: 599.99px) {
    .dept-grid { grid-template-columns: repeat(3, 1fr) !important; }
}
@container section (min-width: 300px) and (max-width: 439.99px) {
    .dept-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@container section (max-width: 299.99px) {
    .dept-grid { grid-template-columns: 1fr !important; }
}

/* Post-grid (announcements/events/news): 1/2/3/4 cards ตามขนาด section */
@container section (min-width: 1080px) {
    .post-grid--announcements,
    .post-grid--events,
    .post-grid--news { grid-template-columns: repeat(4, 1fr) !important; }
}
@container section (min-width: 810px) and (max-width: 1079.99px) {
    .post-grid--announcements,
    .post-grid--events,
    .post-grid--news { grid-template-columns: repeat(3, 1fr) !important; }
}
@container section (min-width: 540px) and (max-width: 809.99px) {
    .post-grid--announcements,
    .post-grid--events,
    .post-grid--news { grid-template-columns: repeat(2, 1fr) !important; }
}
@container section (max-width: 539.99px) {
    .post-grid--announcements,
    .post-grid--events,
    .post-grid--news { grid-template-columns: 1fr !important; }
}
@container section (max-width: 720px) {
    .card-header { padding: 14px 16px; }
    .card-body { padding: 14px 16px; }
    .card-header h2 { font-size: .98rem; }

    /* Hero ย่อ font + padding */
    .hero { padding: 32px 18px !important; }
    .hero h1 { font-size: clamp(1.2rem, 4vw, 1.6rem) !important; }
    .hero p { font-size: .9rem !important; }

    /* Grids ย่อ min-width ลง */
    .url-grid { grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)) !important; }
    .links-grid { grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)) !important; }
    .stats-row { grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)) !important; }

    /* News/Post cards ย่อ */
    .post-card-body { padding: 12px 14px; }
    .post-card-title { font-size: .92rem; }

    /* Announcement items กระชับ */
    .announcement-item { padding: 12px 14px; }
    .announcement-item h3 { font-size: .98rem; }
    .meta { gap: 8px; font-size: 12px; }

    /* Event item — ซ่อน description ถ้าแคบ */
    .event-item p:nth-of-type(n+3) { display: none; }
}

@container section (max-width: 520px) {
    .card-header { padding: 10px 12px; }
    .card-body { padding: 10px 12px; }
    .card-header h2 { font-size: .9rem; }

    .hero { padding: 24px 14px !important; }
    .hero h1 { font-size: 1.15rem !important; }
    .hero p { font-size: .82rem !important; }

    /* บังคับ 1-2 column grid */
    .url-grid { grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)) !important; }
    .links-grid { grid-template-columns: 1fr 1fr !important; }
    .stats-row { grid-template-columns: 1fr 1fr !important; }
    .news-grid { grid-template-columns: 1fr !important; }

    .news-card-img { aspect-ratio: 16/9; }

    /* Hide เนื้อหาที่ไม่จำเป็น */
    .meta .views,
    .post-card-org-name,
    .read-more { display: none; }

    /* URL card — ซ่อน description, แสดงแค่ icon + title */
    .url-info small { display: none; }
    .url-card { padding: 10px 12px; gap: 10px; }
    .url-icon { width: 32px; height: 32px; }
}

@container section (max-width: 380px) {
    /* เล็กมาก — แสดงแค่ส่วนสำคัญที่สุด */
    .card-header { padding: 8px 10px; }
    .card-body { padding: 8px 10px; }
    .card-header .btn-link { display: none; }

    .hero { padding: 20px 12px !important; }
    .hero h1 { font-size: 1rem !important; }
    .hero p { display: none !important; }

    /* บังคับ 1 column ทุกอย่าง */
    .url-grid,
    .links-grid,
    .stats-row,
    .news-grid,
    .announcement-grid { grid-template-columns: 1fr !important; }

    /* Stats — แสดง icon เล็กลง */
    .stat-pill { padding: 12px; gap: 10px; }
    .stat-pill .icon { width: 36px; height: 36px; font-size: 16px; }
    .stat-pill .value { font-size: 1.1rem; }
    .stat-pill .label { font-size: 11px; }

    /* Event date ย่อ */
    .event-date { min-width: 48px; padding: 6px 8px; }
    .event-date .day { font-size: 18px; }
}

/* Mobile: Gridstack จะ handle 1-column ผ่าน columnOpts breakpoint แล้ว */

/* =========================================================
   Section-specific overrides สำหรับ Muuri grid (col-w + grid_h)
   ========================================================= */

/* ---- เมื่อ user set grid_h (มี --grid-h-px) → ให้ section "fill" cell ---- */
.muuri-item-content[style*="--grid-h-px"] .slider-section,
.muuri-item-content[style*="--grid-h-px"] .slider-section > .slider-viewport {
    height: 100%;
    aspect-ratio: auto !important;   /* เลิก lock aspect ratio เมื่อ user บังคับความสูง */
}
.muuri-item-content[style*="--grid-h-px"] .slider-section {
    display: flex;
    flex-direction: column;
}
.muuri-item-content[style*="--grid-h-px"] .slider-section > .slider-header { flex: 0 0 auto; }
.muuri-item-content[style*="--grid-h-px"] .slider-section > .slider-viewport { flex: 1 1 auto; min-height: 0; }

/* ---- Image section: ถ้า user ไม่ set grid_h → ขนาดตาม intrinsic + max-height กัน hero รูปใหญ่ล้น ---- */
.image-section-frame {
    aspect-ratio: 16/9;
}
.muuri-item-content:not([style*="--grid-h-px"]) .image-section .image-section-frame {
    max-height: 600px;
}
.muuri-item-content[style*="--grid-h-px"] .image-section .image-section-frame {
    aspect-ratio: auto;
}

/* ---- Calendar: toolbar wrap + ปุ่มเล็กลงใน narrow cells ---- */
@container section (max-width: 360px) {
    .calendar-section .cal-toolbar {
        flex-wrap: wrap;
        gap: 4px;
    }
    .calendar-section .cal-nav,
    .calendar-section .cal-today {
        padding: 4px 8px;
        font-size: 12px;
    }
    .calendar-section .cal-cell {
        font-size: 11px;
        padding: 2px;
    }
    .calendar-section .cal-week-row { font-size: 10px; }
}

/* ---- Clock: ปรับ --clk-fs ให้เล็กลงใน narrow cells ---- */
@container section (max-width: 380px) {
    .clock-section { --clk-fs: 2.4rem !important; }
    .clock-section { padding: 12px 14px; }
}
@container section (max-width: 280px) {
    .clock-section { --clk-fs: 1.8rem !important; }
    .clock-section .clock-date { font-size: 12px; }
}

/* =============================================================
   Narrow-cell guards — สำหรับ section ที่ resize เป็น col-w-3/4 (25-33%)
   ป้องกัน grid/flex overflow + ลด padding/font-size ใน narrow cells
   ============================================================= */

/* Embedded HTML safety — custom_page + custom_html อาจมี table/iframe ที่ overflow */
.custom-page-section,
.custom-html-section {
    max-width: 100%;
    overflow-x: auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.custom-page-section img,
.custom-html-section img,
.custom-page-section video,
.custom-html-section video,
.custom-page-section iframe,
.custom-html-section iframe {
    max-width: 100%;
    height: auto;
}
.custom-page-section table,
.custom-html-section table {
    max-width: 100%;
    display: block;
    overflow-x: auto;
}

/* Stats row — fold to 1 col when section narrow */
@container section (max-width: 360px) {
    .stats-row { grid-template-columns: 1fr !important; gap: 8px; }
    .stat-pill { padding: 10px 12px; }
}

/* Links grids (.url-grid + .links-grid) — fold to 1-2 cols */
@container section (max-width: 380px) {
    .url-grid, .links-grid { grid-template-columns: 1fr !important; gap: 8px; }
}
@container section (min-width: 380.01px) and (max-width: 540px) {
    .url-grid, .links-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Executives grid */
@container section (max-width: 360px) {
    .exec-grid { grid-template-columns: 1fr !important; }
}

/* Hero — ลด padding/font-size ใน narrow cells */
@container section (max-width: 480px) {
    .hero { padding: 24px 18px; }
    .hero h1 { font-size: 1.3rem; }
    .hero p { font-size: .85rem; }
}
@container section (max-width: 320px) {
    .hero { padding: 18px 12px; }
    .hero h1 { font-size: 1.05rem; }
    .hero p { font-size: .78rem; }
}

/* Promo card (appointment / room_booking) — fold to 1 col + smaller in narrow */
@container section (max-width: 540px) {
    .promo-card {
        grid-template-columns: 1fr !important;
        gap: 12px;
        padding: 22px 16px 20px;
        text-align: center;
    }
    .promo-icon { margin: 0 auto; width: 60px; height: 60px; font-size: 28px; }
    .promo-features { justify-content: center; }
    .promo-cta { width: 100%; justify-content: center; }
    .promo-badge { position: static; display: inline-block; margin-bottom: 6px; }
}
@container section (max-width: 320px) {
    .promo-card { padding: 18px 14px 16px; }
    .promo-title { font-size: 1.1rem; }
    .promo-subtitle { font-size: .85rem; }
    .promo-features { gap: 4px; }
    .promo-feature { font-size: .7rem; padding: 3px 8px; }
}

/* Slider coverflow — narrow cells ให้ slide ใหญ่กว่าเดิม + ตัด margin overlap */
@container section (max-width: 400px) {
    .slider-section[data-variant="coverflow"] .slider-slide {
        flex: 0 0 88%;
        margin: 0 -2%;
    }
}

/* Calendar — extra narrow (col-w-3 ที่ <250px) */
@container section (max-width: 250px) {
    .calendar-section .cal-cell { font-size: 9px; padding: 1px 0; }
    .calendar-section .cal-toolbar { gap: 2px; }
}

/* Announcements / events post-grid — บังคับ 1 col ใน narrow */
@container section (max-width: 420px) {
    .post-grid { grid-template-columns: 1fr !important; }
}

/* Departments — มี container queries อยู่แล้ว ก็ต่อด้วย narrowest */
@container section (max-width: 240px) {
    .dept-grid { grid-template-columns: 1fr !important; gap: 6px; }
    .dept-card { padding: 10px 8px; font-size: .82rem; }
}

/* ---- Card-body scroll ใน fixed-height cells ---- */
.muuri-item-content[style*="--grid-h-px"] > .section-body > .card,
.muuri-item-content[style*="--grid-h-px"] > .section-body > section.card {
    height: 100%;
    display: flex;
    flex-direction: column;
}
.muuri-item-content[style*="--grid-h-px"] > .section-body > .card > .card-header,
.muuri-item-content[style*="--grid-h-px"] > .section-body > section.card > .card-header { flex: 0 0 auto; }
.muuri-item-content[style*="--grid-h-px"] > .section-body > .card > .card-body,
.muuri-item-content[style*="--grid-h-px"] > .section-body > section.card > .card-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* =========================================================
   Section design wrapper — apply per-section design config
   ========================================================= */
.section-wrap {
    width: 100%;
    /* เปิด container queries — content ภายในปรับตามความกว้างของ section เอง */
    container-type: inline-size;
    container-name: section;
    min-width: 0;
}

/* Width constraints — center the inner section */
.section-wrap.sw-sm > * { max-width: 720px;  margin-left: auto; margin-right: auto; }
.section-wrap.sw-md > * { max-width: 960px;  margin-left: auto; margin-right: auto; }
.section-wrap.sw-lg > * { max-width: 1200px; margin-left: auto; margin-right: auto; }
.section-wrap.sw-xl > * { max-width: 1400px; margin-left: auto; margin-right: auto; }

/* Fonts */
.section-wrap.sf-sarabun, .section-wrap.sf-sarabun * { font-family: 'Sarabun', sans-serif; }
.section-wrap.sf-prompt,  .section-wrap.sf-prompt h1,
.section-wrap.sf-prompt h2, .section-wrap.sf-prompt h3,
.section-wrap.sf-prompt   { font-family: 'Prompt', sans-serif; }
.section-wrap.sf-kanit,   .section-wrap.sf-kanit *   { font-family: 'Kanit', sans-serif; }
.section-wrap.sf-mitr,    .section-wrap.sf-mitr *    { font-family: 'Mitr', sans-serif; }
.section-wrap.sf-noto-thai, .section-wrap.sf-noto-thai * { font-family: 'Noto Sans Thai', sans-serif; }
.section-wrap.sf-ibm-plex, .section-wrap.sf-ibm-plex * { font-family: 'IBM Plex Sans Thai', sans-serif; }
.section-wrap.sf-serif,   .section-wrap.sf-serif *   { font-family: 'Sarabun', 'Times New Roman', serif; }

/* Title size variants */
.section-wrap.sts-sm h1 { font-size: 1.6rem; }
.section-wrap.sts-sm h2 { font-size: 1rem; }
.section-wrap.sts-sm h3 { font-size: .95rem; }

.section-wrap.sts-lg h1 { font-size: 2.4rem; }
.section-wrap.sts-lg h2 { font-size: 1.5rem; }
.section-wrap.sts-lg h3 { font-size: 1.25rem; }

.section-wrap.sts-xl h1 { font-size: 3rem; line-height: 1.2; }
.section-wrap.sts-xl h2 { font-size: 1.85rem; }
.section-wrap.sts-xl h3 { font-size: 1.4rem; }

/* Padding overrides */
.section-wrap.sp-none .card-body,
.section-wrap.sp-none .card-header { padding: 0; }
.section-wrap.sp-sm .card-body { padding: 12px 16px; }
.section-wrap.sp-sm .card-header { padding: 12px 16px; }
.section-wrap.sp-lg .card-body { padding: 32px; }
.section-wrap.sp-lg .card-header { padding: 28px 32px; }
.section-wrap.sp-xl .card-body { padding: 48px; }
.section-wrap.sp-xl .card-header { padding: 36px 48px; }

/* Alignment */
.section-wrap.sa-center { text-align: center; }
.section-wrap.sa-center .card-header { justify-content: center; }
.section-wrap.sa-right  { text-align: right; }
.section-wrap.sa-right  .card-header { justify-content: flex-end; }

/* Background color override */
.section-wrap.has-bg > .card,
.section-wrap.has-bg > section.card,
.section-wrap.has-bg > section { background: var(--design-bg) !important; }

/* Radius override */
.section-wrap[style*="--design-radius"] > .card,
.section-wrap[style*="--design-radius"] > section.card,
.section-wrap[style*="--design-radius"] > section { border-radius: var(--design-radius) !important; }

/* Make radius cascade to images at corners (for hero with rounded corners) */
.section-wrap[style*="--design-radius"] .hero { border-radius: var(--design-radius); overflow: hidden; }

/* Section content stretches to fill Gridstack cell height */
.grid-stack-item-content > .card,
.grid-stack-item-content > section.card,
.grid-stack-item-content > section.hero,
.grid-stack-item-content > section,
.grid-stack-item-content > .home-section {
    height: 100%;
    box-sizing: border-box;
}

/* =========================================================
   URL Bar — ฟีเจอร์หลัก (Internal / External Links)
   ========================================================= */
.url-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.url-card {
    --accent: var(--primary);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    text-decoration: none;
}
.url-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, transparent));
    opacity: 0;
    transition: opacity var(--transition);
    z-index: 0;
}
.url-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(15, 23, 42, .15);
    border-color: var(--accent);
    color: #fff;
}
.url-card:hover::before { opacity: 1; }
.url-card > * { position: relative; z-index: 1; }

.url-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #fff;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 4px 10px color-mix(in srgb, var(--accent) 35%, transparent);
}
.url-card:hover .url-icon {
    background: rgba(255, 255, 255, .25);
    box-shadow: none;
}

.url-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}
.url-info strong {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.url-info small {
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
}
.url-card:hover .url-info small { color: rgba(255, 255, 255, .85); }

.url-arrow {
    opacity: 0;
    transform: translateX(-4px);
    transition: all var(--transition);
    color: #fff;
}
.url-card:hover .url-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Fallback for browsers without color-mix support */
@supports not (color: color-mix(in srgb, red, blue)) {
    .url-card::before { background: var(--accent); }
}

/* ---------- Filter bar ---------- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.filter-chip {
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
}
.filter-chip:hover { color: var(--primary); border-color: var(--primary); }
.filter-chip.active { background: var(--gradient-primary); color: #fff; border-color: transparent; }

/* =============================================================
   Promo card section — Appointment / Room booking CTA
   ============================================================= */
.promo-card-section {
    width: 100%;
}
.promo-card {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 22px;
    align-items: center;
    padding: 28px 28px;
    border-radius: 18px;
    color: #fff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .12);
    overflow: hidden;
}
.promo-card::before {
    content: ''; position: absolute; inset: 0;
    background-image:
        radial-gradient(circle at 12% 20%, rgba(255,255,255,.18), transparent 45%),
        radial-gradient(circle at 88% 80%, rgba(255,255,255,.10), transparent 50%);
    pointer-events: none;
}
.promo-badge {
    position: absolute; top: 14px; left: 18px;
    padding: 4px 12px;
    background: rgba(255,255,255,.20);
    border: 1px solid rgba(255,255,255,.30);
    border-radius: 999px;
    font-size: .75rem; font-weight: 500;
    backdrop-filter: blur(4px);
}
.promo-icon {
    flex-shrink: 0;
    width: 78px; height: 78px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 18px;
    font-size: 38px; color: #fff;
    backdrop-filter: blur(4px);
    z-index: 1;
}
.promo-body { z-index: 1; min-width: 0; }
.promo-title {
    margin: 0 0 4px;
    font-size: clamp(1.3rem, 2.6vw, 1.7rem);
    font-weight: 700;
    color: #fff;
}
.promo-subtitle {
    margin: 0 0 10px;
    font-size: .98rem;
    opacity: .96;
    color: #fff;
}
.promo-desc {
    margin: 8px 0 10px;
    font-size: .9rem;
    opacity: .92;
    line-height: 1.55;
}
.promo-features {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: 10px;
}
.promo-feature {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px;
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 999px;
    font-size: .78rem; color: #fff;
    backdrop-filter: blur(4px);
}
.promo-action { z-index: 1; flex-shrink: 0; }
.promo-cta {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 24px;
    background: #fff;
    color: #0d9488;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: .95rem;
    transition: all .15s;
    box-shadow: 0 4px 12px rgba(0,0,0,.18);
    white-space: nowrap;
}
.promo-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,.24);
    color: #0f766e;
}
.promo-cta-disabled {
    background: rgba(255,255,255,.20);
    color: rgba(255,255,255,.7);
    cursor: not-allowed;
    border: 1px solid rgba(255,255,255,.25);
}
.promo-cta-disabled:hover { transform: none; box-shadow: none; }

@media (max-width: 720px) {
    .promo-card {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 26px 20px 24px;
        text-align: center;
    }
    .promo-icon { margin: 0 auto; width: 64px; height: 64px; font-size: 32px; }
    .promo-features { justify-content: center; }
    .promo-cta { width: 100%; justify-content: center; }
    .promo-badge { position: static; display: inline-block; margin-bottom: 4px; }
}

/* =============================================================
   Mini form section — Appointment / Room booking (กรอกย่อบนหน้าแรก)
   ============================================================= */
.mini-form-section { width: 100%; }
.mini-form-card {
    position: relative;
    padding: 20px 22px 18px;
    border-radius: 16px;
    color: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .12);
    overflow: hidden;
}
.mini-form-card::before {
    content: ''; position: absolute; inset: 0;
    background-image:
        radial-gradient(circle at 12% 0%, rgba(255,255,255,.18), transparent 50%),
        radial-gradient(circle at 88% 100%, rgba(255,255,255,.10), transparent 55%);
    pointer-events: none;
}
.mini-form-head {
    position: relative; z-index: 1;
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 14px;
}
.mini-form-icon {
    flex-shrink: 0;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.20);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 12px;
    font-size: 20px; color: #fff;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.mini-form-titles { min-width: 0; flex: 1; }
.mini-form-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.mini-form-sub {
    margin: 2px 0 0;
    font-size: .82rem;
    opacity: .92;
    color: #fff;
    line-height: 1.35;
}
.mini-form {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; gap: 8px;
}
.mini-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.mini-form input, .mini-form select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(255,255,255,.4);
    border-radius: 10px;
    font-family: inherit;
    font-size: .9rem;
    color: #0f172a;
    transition: box-shadow .15s, border-color .15s;
}
.mini-form input::placeholder { color: #94a3b8; }
.mini-form input:focus, .mini-form select:focus {
    outline: none;
    background: #fff;
    border-color: rgba(255,255,255,.9);
    box-shadow: 0 0 0 3px rgba(255,255,255,.25);
}
.mini-form input:invalid:not(:placeholder-shown) {
    border-color: #fca5a5;
}
.mini-form-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%;
    padding: 11px 16px;
    margin-top: 4px;
    background: #fff;
    color: #0d9488;
    text-decoration: none;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 600;
    font-size: .95rem;
    cursor: pointer;
    transition: all .15s;
    box-shadow: 0 4px 12px rgba(0,0,0,.16);
}
.mini-form-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,0,0,.22);
    color: #0f766e;
}
.mini-form-locked {
    position: relative; z-index: 1;
    padding: 10px 14px;
    background: rgba(255,255,255,.16);
    border: 1px dashed rgba(255,255,255,.30);
    border-radius: 10px;
    text-align: center;
    font-size: .9rem;
}
.mini-form-locked i { margin-right: 6px; opacity: .85; }

@media (max-width: 520px) {
    .mini-form-card { padding: 18px 16px 16px; }
    .mini-form-row { grid-template-columns: 1fr; }
    .mini-form-title { font-size: 1rem; }
    .mini-form-sub { font-size: .78rem; }
}

/* =============================================================
   Responsive Slider Section
   Variants: arrow_dots / autoplay / thumbnail / fade / coverflow / hero_fullscreen
   ============================================================= */
.slider-section {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    user-select: none;
}
.slider-section.slider-empty { -webkit-user-select: auto; user-select: auto; }

.slider-header {
    margin-bottom: 14px;
}
.slider-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 4px;
}
.slider-subtitle {
    color: var(--text-muted);
    margin: 0;
    font-size: .95rem;
}

.slider-viewport {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
    border-radius: 14px;
    background: var(--surface-2);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
}
.slider-track {
    display: flex;
    width: 100%;             /* lock track to viewport width — slides overflow track and viewport clips them */
    min-width: 0;            /* prevent flex children from forcing parent wider */
    height: 100%;
    transition: transform 500ms cubic-bezier(.45, 0, .15, 1);
    will-change: transform;
}
.slider-section[data-variant="fade"] .slider-track { transition: none; }

.slider-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    position: relative;
    display: block;
    color: inherit;
    text-decoration: none;
    overflow: hidden;
}
.slider-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    -webkit-user-drag: none;
}

/* Auto-ratio mode: viewport adapts to image */
.slider-section[data-variant] .slider-viewport:not([style*="aspect-ratio"]) .slider-slide img {
    height: auto;
    object-fit: contain;
}

.slider-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 18px 24px 22px;
    background: linear-gradient(to top, rgba(0, 0, 0, .75) 0%, rgba(0, 0, 0, .35) 60%, transparent 100%);
    color: #fff;
    pointer-events: none;
}
.slider-caption h3 {
    margin: 0 0 4px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}
.slider-caption p {
    margin: 0;
    font-size: .95rem;
    opacity: .92;
}

/* ===== Arrows ===== */
.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, .92);
    color: #1e293b;
    font-size: 16px;
    cursor: pointer;
    display: grid;
    place-items: center;
    z-index: 5;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
    transition: all 200ms;
}
.slider-arrow:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
}
.slider-arrow:active { transform: translateY(-50%) scale(.96); }
.slider-arrow:disabled { opacity: .4; cursor: not-allowed; }
.slider-arrow-prev { left: 14px; }
.slider-arrow-next { right: 14px; }

/* ===== Dots ===== */
.slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    background: var(--border-strong, #cbd5e1);
    cursor: pointer;
    padding: 0;
    transition: all 200ms;
}
.slider-dot:hover { background: var(--primary); transform: scale(1.2); }
.slider-dot.active {
    background: var(--primary);
    width: 28px;
    border-radius: 999px;
}

/* ===== Thumbnails ===== */
.slider-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x mandatory;
}
.slider-thumbs::-webkit-scrollbar { height: 6px; }
.slider-thumbs::-webkit-scrollbar-thumb { background: var(--border-strong, #cbd5e1); border-radius: 3px; }
.slider-thumb {
    flex: 0 0 96px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    border: 3px solid transparent;
    background: var(--surface-2);
    cursor: pointer;
    padding: 0;
    transition: all 200ms;
    scroll-snap-align: start;
    opacity: .6;
}
.slider-thumb:hover { opacity: .85; }
.slider-thumb.active { border-color: var(--primary); opacity: 1; box-shadow: 0 4px 12px rgba(37, 99, 235, .25); }
.slider-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }

/* ===== Variant: fade ===== */
.slider-section[data-variant="fade"] .slider-track {
    position: relative;
    display: block;
    height: 100%;
}
.slider-section[data-variant="fade"] .slider-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    flex: none;
    opacity: 0;
    transition: opacity 600ms ease-in-out;
    pointer-events: none;
}
.slider-section[data-variant="fade"] .slider-slide.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 1;
}

/* ===== Variant: coverflow (3D side perspective) ===== */
.slider-section[data-variant="coverflow"] {
    overflow: hidden;        /* clip rotated slides ที่ขอบ — กัน track ดัน section ขยายออก */
}
.slider-section[data-variant="coverflow"] .slider-viewport {
    background: transparent;
    box-shadow: none;
    perspective: 1200px;
    overflow: visible;
}
.slider-section[data-variant="coverflow"] .slider-track {
    transform-style: preserve-3d;
    align-items: center;
    height: 100%;
    transition: transform 500ms cubic-bezier(.45, 0, .15, 1);
}
.slider-section[data-variant="coverflow"] .slider-slide {
    flex: 0 0 60%;
    margin: 0 -8%;
    transition: transform 500ms cubic-bezier(.45, 0, .15, 1), opacity 400ms;
    transform-origin: center center;
    transform: rotateY(35deg) scale(.78);
    opacity: .55;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .25);
}
.slider-section[data-variant="coverflow"] .slider-slide.active {
    transform: rotateY(0) scale(1);
    opacity: 1;
    z-index: 2;
}
.slider-section[data-variant="coverflow"] .slider-slide.cf-prev {
    transform: rotateY(35deg) scale(.78);
}
.slider-section[data-variant="coverflow"] .slider-slide.cf-next {
    transform: rotateY(-35deg) scale(.78);
}

/* ===== Variant: hero fullscreen ===== */
.slider-section.slider-fullscreen .slider-viewport {
    height: 100vh;
    height: 100dvh;
    min-height: 480px;
    border-radius: 0;
}
.slider-section.slider-fullscreen .slider-caption {
    padding: 32px 48px 56px;
}
.slider-section.slider-fullscreen .slider-caption h3 {
    font-size: clamp(1.6rem, 4vw, 2.8rem);
}
.slider-section.slider-fullscreen .slider-caption p {
    font-size: clamp(.95rem, 1.5vw, 1.2rem);
    max-width: 720px;
}

/* ===== Touch / swipe affordance ===== */
.slider-viewport.is-dragging .slider-track {
    transition: none;
    cursor: grabbing;
}

/* ===== Responsive: mobile (≤720px) ===== */
@media (max-width: 720px) {
    .slider-arrow {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    .slider-arrow-prev { left: 8px; }
    .slider-arrow-next { right: 8px; }
    .slider-section.slider-arrows-hide-mobile .slider-arrow { display: none; }
    .slider-caption { padding: 12px 16px 14px; }
    .slider-caption h3 { font-size: 1.05rem; }
    .slider-caption p { font-size: .85rem; }
    .slider-thumb { flex: 0 0 72px; height: 48px; }
    .slider-section[data-variant="coverflow"] .slider-slide {
        flex: 0 0 80%;
        margin: 0 -4%;
    }
    .slider-section.slider-fullscreen .slider-viewport {
        min-height: 360px;
    }
    .slider-section.slider-fullscreen .slider-caption {
        padding: 16px 20px 28px;
    }
}

/* ===== Responsive: tablet (721–960px) ===== */
@media (min-width: 721px) and (max-width: 960px) {
    .slider-arrow { width: 40px; height: 40px; }
    .slider-section[data-variant="coverflow"] .slider-slide {
        flex: 0 0 70%;
        margin: 0 -6%;
    }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
    .slider-track,
    .slider-slide,
    .slider-arrow,
    .slider-dot,
    .slider-thumb { transition: none !important; }
}

/* =============================================================
   Executives Section (ผู้บริหาร)
   ============================================================= */
.executives-section .card-subtitle {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: .9rem;
    font-weight: 400;
}

.exec-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px 18px 20px;
    transition: all 220ms ease;
    position: relative;
    overflow: hidden;
}
.exec-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--accent, #2563eb);
    transform: scaleX(.3);
    transform-origin: center;
    transition: transform 300ms ease;
}
.exec-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, .12);
    border-color: var(--accent, #2563eb);
}
.exec-card:hover::before { transform: scaleX(1); }

.exec-photo {
    width: 140px;
    height: 140px;
    margin-bottom: 14px;
    overflow: hidden;
    background: var(--surface-2);
    border: 3px solid var(--surface);
    box-shadow: 0 4px 12px rgba(15, 23, 42, .08);
    position: relative;
    flex-shrink: 0;
}
.exec-shape-circle .exec-photo { border-radius: 50%; }
.exec-shape-square .exec-photo { border-radius: 12px; }
.exec-shape-portrait .exec-photo {
    width: 150px;
    height: 200px;
    border-radius: 12px;
}
.exec-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.exec-photo-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--text-soft);
    font-size: 48px;
}

.exec-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.exec-name {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    color: var(--text);
    line-height: 1.3;
}
.exec-position {
    font-size: .9rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}
.exec-dept {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--dept-color, #2563eb);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    margin-top: 4px;
}
.exec-bio {
    font-size: .85rem;
    color: var(--text-muted);
    margin: 8px 0 0;
    line-height: 1.5;
}
.exec-contact {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.exec-contact a {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text-muted);
    text-decoration: none;
    transition: all 180ms;
}
.exec-contact a:hover {
    background: var(--accent, #2563eb);
    color: #fff;
    transform: scale(1.1);
}

/* Responsive */
@media (max-width: 720px) {
    .exec-photo { width: 110px; height: 110px; }
    .exec-shape-portrait .exec-photo { width: 120px; height: 160px; }
    .exec-card { padding: 18px 14px; }
}
