/* =============================================
   AAI Page — Design System v3
   สำนักทรัพย์สินและจัดหารายได้
   Primary: #184724 | Accent: #f0a500
   ============================================= */
@import url('https://fonts.googleapis.com/css2?family=Kanit:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300&display=swap');

/* ─── Tokens ─── */
:root {
    --g900: #0b1e10;
    --g800: #184724;
    --g700: #1e5a2e;
    --g600: #276336;
    --g500: #3a8c50;
    --g400: #5aaa6e;
    --g200: #b8ddc2;
    --g100: #e4f3e8;
    --g50: #f2faf4;

    --gold: #f0a500;
    --gold-dark: #c07800;
    --gold-light: #fff3cc;

    --white: #ffffff;
    --text-900: #0d1f10;
    --text-600: #3d5e42;
    --text-400: #7a9a7f;

    --bdr: #c5deca;
    --bdr-light: #e2f0e5;

    --sh-sm: 0 1px 6px rgba(24, 71, 36, .08);
    --sh-md: 0 4px 18px rgba(24, 71, 36, .13);
    --sh-lg: 0 8px 36px rgba(24, 71, 36, .18);
    --sh-xl: 0 16px 56px rgba(24, 71, 36, .25);

    --r-sm: 8px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Kanit', sans-serif;
    background: var(--g50);
    color: var(--text-900);
    margin: 0;
}

/* =============================================
   CAROUSEL / HERO
   ============================================= */
.aai-hero {
    position: relative;
    width: 100%;
    overflow: hidden;
}

#myCarousel {
    height: 440px;
}

#myCarousel .carousel-item {
    height: 440px;
}

#myCarousel .carousel-item img {
    height: 440px;
    object-fit: cover;
    filter: brightness(.65) saturate(1.1);
}

.aai-hero-caption {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    pointer-events: none;
    padding: 0 5%;
}

.aai-hero-text {
    max-width: 680px;
    background: linear-gradient(135deg, rgba(10, 30, 14, .72) 0%, rgba(10, 30, 14, .38) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: var(--r-lg);
    padding: 2rem 2.5rem;
    pointer-events: auto;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: rgba(240, 165, 0, .18);
    border: 1px solid rgba(240, 165, 0, .5);
    color: var(--gold);
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: .2rem .8rem;
    margin-bottom: .75rem;
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: white;
    line-height: 1.3;
    margin: 0 0 .4rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}

.hero-sub {
    font-size: 1.1rem;
    font-weight: 400;
    color: rgba(255, 255, 255, .85);
    margin: 0 0 1rem;
}

.hero-divider {
    width: 60px;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--gold), var(--g400));
    margin-bottom: 1rem;
}

.hero-desc {
    font-size: .9rem;
    color: rgba(255, 255, 255, .75);
    margin: 0;
    line-height: 1.7;
}

.carousel-control-prev,
.carousel-control-next {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 50%;
    margin: auto 1.5rem;
    opacity: .85;
    transition: background .25s, transform .25s;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    background: rgba(255, 255, 255, .32);
    opacity: 1;
    transform: scale(1.08);
}

.carousel-indicators {
    bottom: 1.25rem;
}

.carousel-indicators [data-bs-target] {
    width: 28px;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .55);
    transition: background .3s, width .3s;
    border: none;
}

.carousel-indicators .active {
    background: var(--gold);
    width: 44px;
}

/* =============================================
   PAGE LAYOUT
   ============================================= */
.aai-layout {
    display: grid;
    grid-template-columns: 260px 1fr 320px;
    gap: 1.75rem;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
    align-items: start;
}

/* Sidebar always renders first in DOM but appears left visually */
.aai-sidebar-left {
    order: 0;
}

.aai-main {
    order: 1;
}

.aai-sidebar-right {
    order: 2;
}

@media (max-width: 1200px) {
    .aai-layout {
        grid-template-columns: 220px 1fr;
        gap: 1.25rem;
    }
    .aai-sidebar {
        position: static !important;
    }
}

/* =============================================
   LEFT SIDEBAR
   ============================================= */
.aai-sidebar {
    position: sticky;
    top: 16px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sb-card {
    background: var(--white);
    border-radius: var(--r-md);
    box-shadow: var(--sh-md);
    border: 1px solid var(--bdr);
    overflow: hidden;
    transition: box-shadow .3s;
}

.sb-card:hover {
    box-shadow: var(--sh-lg);
}

.sb-card-head {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .85rem 1rem;
    background: linear-gradient(120deg, var(--g800) 0%, var(--g600) 100%);
    color: white;
}

.sb-head-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    flex-shrink: 0;
}

.sb-head-title {
    font-size: .88rem;
    font-weight: 600;
    line-height: 1.3;
}

.sb-body {
    padding: .5rem;
}

.sb-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem .8rem;
    border-radius: var(--r-sm);
    color: var(--text-600);
    font-size: .85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background .2s, color .2s, border-color .2s, transform .2s;
}

.sb-link:hover {
    background: var(--g100);
    color: var(--g800);
    border-left-color: var(--g500);
    transform: translateX(3px);
    text-decoration: none;
}

.sb-link-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--g100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    color: var(--g700);
    flex-shrink: 0;
    transition: background .2s, color .2s;
}

.sb-link:hover .sb-link-icon {
    background: var(--g800);
    color: white;
}

/* Online booking CTA */
.sb-booking-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin: .5rem;
    padding: .7rem 1rem;
    border-radius: var(--r-sm);
    background: linear-gradient(135deg, var(--g700), var(--g500));
    color: white !important;
    font-weight: 600;
    font-size: .85rem;
    text-decoration: none;
    box-shadow: 0 3px 10px rgba(24, 71, 36, .3);
    transition: filter .2s, transform .2s, box-shadow .2s;
}

.sb-booking-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(24, 71, 36, .35);
    text-decoration: none;
    color: white !important;
}

/* Contact card */
.sb-contact {
    padding: .75rem 1rem;
}

.sb-contact-row {
    display: flex;
    gap: .5rem;
    font-size: .8rem;
    color: var(--text-600);
    line-height: 1.55;
    margin-bottom: .55rem;
}

.sb-contact-row:last-child {
    margin-bottom: 0;
}

.sb-contact-row i {
    color: var(--g600);
    flex-shrink: 0;
    margin-top: .15rem;
    width: 14px;
}

/* Quick links */
.sb-quick-links {
    padding: .6rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.sb-ql-item {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    border-radius: var(--r-sm);
    overflow: hidden;
    box-shadow: var(--sh-sm);
    transition: transform .25s, box-shadow .25s;
    cursor: pointer;
    border: 1px solid var(--bdr-light);
}

.sb-ql-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--sh-md);
}

.sb-ql-item img {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    display: block;
}

/* =============================================
   MAIN CONTENT
   ============================================= */
.aai-main {
    min-width: 0;
}

/* ── Section intro banner ── */
.aai-intro {
    background: linear-gradient(135deg, var(--g900) 0%, var(--g700) 50%, var(--g500) 100%);
    border-radius: var(--r-lg);
    padding: 1.75rem 2rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--sh-lg);
}

.aai-intro::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .04);
    pointer-events: none;
}

.aai-intro::after {
    content: '';
    position: absolute;
    bottom: -60%;
    right: 8%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(240, 165, 0, .08);
    pointer-events: none;
}

.intro-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .14);
    border: 1.5px solid rgba(255, 255, 255, .22);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    flex-shrink: 0;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
}

.intro-text {
    flex: 1;
    min-width: 0;
}

.intro-eyebrow {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: .2rem;
}

.intro-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: white;
    margin: 0 0 .25rem;
    line-height: 1.35;
}

.intro-hint {
    font-size: .82rem;
    color: rgba(255, 255, 255, .68);
    margin: 0;
    display: flex;
    align-items: center;
    gap: .35rem;
}

/* ── Stats row ── */
.aai-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .85rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--r-md);
    padding: 1rem 1.1rem;
    border: 1px solid var(--bdr);
    box-shadow: var(--sh-sm);
    display: flex;
    align-items: center;
    gap: .8rem;
    transition: transform .25s, box-shadow .25s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--sh-md);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.stat-icon.green {
    background: var(--g100);
    color: var(--g700);
}

.stat-icon.gold {
    background: var(--gold-light);
    color: var(--gold-dark);
}

.stat-icon.blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.stat-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-900);
    line-height: 1;
}

.stat-label {
    font-size: .75rem;
    color: var(--text-400);
    margin-top: .1rem;
}

/* ── Outer Accordion ── */
.services-accordion {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.service-panel {
    background: var(--white);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-md);
    border: 1px solid var(--bdr);
    overflow: hidden;
    transition: box-shadow .3s, transform .3s;
}

.service-panel:hover {
    box-shadow: var(--sh-lg);
}

/* Gold top bar on active panel */
.service-panel.active-panel {
    border-top: 3px solid var(--gold);
}

.service-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.15rem 1.4rem;
    background: linear-gradient(115deg, var(--g900) 0%, var(--g700) 55%, var(--g500) 100%);
    border: none;
    cursor: pointer;
    text-align: left;
    color: white;
    position: relative;
    overflow: hidden;
    transition: filter .2s;
}

.service-toggle::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, rgba(255, 255, 255, .06) 0%, transparent 65%);
    pointer-events: none;
}

.service-toggle:hover {
    filter: brightness(1.08);
}

.svc-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 15px;
    background: rgba(255, 255, 255, .14);
    border: 1.5px solid rgba(255, 255, 255, .24);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
}

.svc-text {
    flex: 1;
    min-width: 0;
}

.svc-eyebrow {
    font-size: .68rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--gold);
    font-weight: 600;
    margin-bottom: .15rem;
    display: flex;
    align-items: center;
    gap: .3rem;
}

.svc-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: white;
    line-height: 1.35;
    display: block;
}

.svc-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .4rem;
    flex-shrink: 0;
}

.svc-badge {
    display: inline-flex;
    align-items: center;
    gap: .28rem;
    padding: .18rem .6rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .28);
    color: white;
    white-space: nowrap;
}

.svc-badge.active::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    display: block;
    box-shadow: 0 0 6px #4ade80;
}

.svc-chevron {
    font-size: .9rem;
    opacity: .8;
    transition: transform .38s cubic-bezier(.4, 0, .2, 1);
}

.service-toggle[aria-expanded="true"] .svc-chevron {
    transform: rotate(180deg);
}

.service-toggle[aria-expanded="false"] .svc-chevron {
    transform: rotate(0deg);
}

/* Panel body */
.service-body {
    padding: 1.1rem 1.1rem 1.4rem;
    background: linear-gradient(180deg, #f6fcf7 0%, var(--white) 60%);
}

/* ── Inner Accordion ── */
.inner-accordion {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.inner-panel {
    background: var(--white);
    border-radius: var(--r-md);
    border: 1px solid var(--bdr);
    overflow: hidden;
    box-shadow: var(--sh-sm);
    transition: box-shadow .22s;
}

.inner-panel:hover {
    box-shadow: var(--sh-md);
}

.inner-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .8rem 1rem;
    background: linear-gradient(105deg, var(--g100) 0%, var(--white) 100%);
    border: none;
    cursor: pointer;
    text-align: left;
    color: var(--text-900);
    border-left: 4px solid var(--g500);
    transition: background .2s, border-color .2s;
}

.inner-toggle:hover {
    background: linear-gradient(105deg, #cce8d3 0%, #f0f9f2 100%);
    border-left-color: var(--g600);
}

.inner-toggle[aria-expanded="true"] {
    background: linear-gradient(105deg, var(--g800) 0%, var(--g600) 100%);
    color: white;
    border-left-color: var(--gold);
}

.inner-toggle[aria-expanded="true"] .inner-icon {
    background: rgba(255, 255, 255, .18);
    color: white;
}

.inner-toggle[aria-expanded="true"] .inner-title {
    color: white;
}

.inner-toggle[aria-expanded="true"] .inner-sub {
    color: rgba(255, 255, 255, .65);
}

.inner-toggle[aria-expanded="true"] .inner-chevron {
    color: white;
    transform: rotate(180deg);
}

.inner-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--g100);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--g700);
    font-size: .95rem;
    flex-shrink: 0;
    transition: background .2s, color .2s;
}

.inner-text {
    flex: 1;
    min-width: 0;
}

.inner-title {
    display: block;
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-900);
    transition: color .2s;
}

.inner-sub {
    display: block;
    font-size: .73rem;
    color: var(--text-400);
    margin-top: .08rem;
    transition: color .2s;
}

.inner-chevron {
    font-size: .82rem;
    color: var(--text-400);
    transition: transform .32s cubic-bezier(.4, 0, .2, 1), color .2s;
}

.inner-body {
    padding: .2rem .9rem .9rem;
    overflow-x: auto;
}

/* ── Tables — Responsive scroll-wrapper ── */

/* Outer container */
.table-wrap {
    position: relative;
    width: 100%;
    border-radius: var(--r-md);
    margin-top: .85rem;
    box-shadow: var(--sh-md);
    border: 1px solid var(--bdr);
    background: var(--white);
    overflow: hidden;
}

/* Inner scrollable area */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--g400) var(--g100);
}

.table-scroll::-webkit-scrollbar {
    height: 5px;
}

.table-scroll::-webkit-scrollbar-track {
    background: var(--g100);
}

.table-scroll::-webkit-scrollbar-thumb {
    background: var(--g400);
    border-radius: 4px;
}

/* Right-edge gradient fade when table overflows */
.table-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 52px;
    height: 100%;
    border-radius: 0 var(--r-md) var(--r-md) 0;
    background: linear-gradient(to left,
        rgba(255, 255, 255, .92) 0%,
        rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s ease;
    z-index: 3;
}

.table-wrap.is-scrollable::after {
    opacity: 1;
}

.table-wrap.scrolled-end::after {
    opacity: 0 !important;
}

/* Scroll hint bar — shown between caption and table header */
.table-scroll-hint {
    display: none;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .28rem .9rem;
    background: linear-gradient(90deg, var(--g100) 0%, #c8e6cf 100%);
    border-bottom: 1px solid var(--bdr);
    font-size: .72rem;
    font-weight: 500;
    color: var(--g700);
    letter-spacing: .04em;
    user-select: none;
}

.table-scroll-hint i {
    font-size: .68rem;
    animation: hint-slide 1.5s ease-in-out infinite;
}

@keyframes hint-slide {
    0%, 100% { transform: translateX(0); opacity: .6; }
    40%       { transform: translateX(-5px); opacity: 1; }
    70%       { transform: translateX(5px); opacity: 1; }
}

.table-wrap.is-scrollable .table-scroll-hint {
    display: flex;
}

.table-wrap.scrolled-end .table-scroll-hint {
    display: none;
}


table.fee-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 620px;
    font-family: 'Kanit', sans-serif;
    table-layout: auto;
}


caption.fee-cap {
    caption-side: top;
    padding: 12px 16px 8px;
    font-size: .95em;
    font-weight: 700;
    color: var(--g900);
    text-align: center;
    line-height: 1.6;
    background: linear-gradient(135deg, var(--g100), #d9eedd);
    border-bottom: 2px solid var(--bdr);
}

caption.fee-cap .cap-sub {
    display: block;
    font-size: .74em;
    font-weight: 400;
    color: var(--text-400);
    font-style: italic;
    margin-top: 2px;
}

table.fee-table th,
table.fee-table td {
    padding: 10px 13px;
    border-bottom: 1px solid var(--bdr);
    font-size: .85em;
    line-height: 1.5;
    vertical-align: middle;
}

table.fee-table th {
    background: linear-gradient(135deg, var(--g800), var(--g600));
    color: white;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    letter-spacing: .02em;
    border-bottom: 2px solid var(--g900);
}

table.fee-table td:not(:last-child),
table.fee-table th:not(:last-child) {
    border-right: 1px solid var(--bdr);
}

table.fee-table tr:nth-child(even) td {
    background: #f3faf5;
}

table.fee-table tr:nth-child(odd) td {
    background: var(--white);
}

table.fee-table tr.open-gallery:hover td {
    background: #ccecd6;
    cursor: pointer;
    transition: background .15s;
}

table.fee-table td:nth-child(2),
table.fee-table td:nth-child(3),
table.fee-table td:nth-child(4) {
    text-align: center;
    font-weight: 600;
    color: var(--g800);
}

table.fee-table tbody tr th {
    background: var(--g100);
    color: var(--g900);
    font-weight: 500;
    font-size: .8em;
    text-align: left;
    border-top: 2px solid var(--bdr);
}

table.fee-table tr.gallery-row td:first-child {
    position: relative;
}

table.fee-table tr.gallery-row td:first-child::before {
    content: '🖼 ';
    font-size: .7em;
    opacity: .5;
}

table.fee-table tr.gallery-row:hover td:first-child::before {
    opacity: 1;
}

.hidden-gallery {
    display: none;
}

/* =============================================
   TABLE — CARD LAYOUT (mobile ≤ 600px)
   Each <tr> → card, each <td> → label+value row
   ============================================= */
@media (max-width: 600px) {

    /* No need for horizontal scroll on card layout */
    .table-scroll {
        overflow-x: visible;
    }

    /* Hide the fade-right overlay on card layout */
    .table-wrap::after {
        display: none;
    }

    /* Table becomes a block stack */
    table.fee-table {
        display: block;
        min-width: 0;
        width: 100%;
        border-collapse: collapse;
    }

    /* Caption: keep as proper full-width header */
    table.fee-table caption.fee-cap {
        display: block;
        width: 100%;
        padding: .85rem 1rem .6rem;
        text-align: center;
        font-size: .88rem;
        font-weight: 700;
        color: var(--g900);
        background: linear-gradient(135deg, var(--g100), #d9eedd);
        border-bottom: 2px solid var(--bdr);
        line-height: 1.55;
        box-sizing: border-box;
    }

    table.fee-table caption.fee-cap .cap-sub {
        display: block;
        font-size: .72rem;
        font-weight: 400;
        color: var(--text-400);
        font-style: italic;
        margin-top: 3px;
        line-height: 1.4;
    }

    /* Hide scroll hint — not needed on card layout */
    .table-scroll-hint {
        display: none !important;
    }

    /* Hide original header row */
    table.fee-table thead {
        display: none;
    }

    table.fee-table tbody {
        display: flex;
        flex-direction: column;
        gap: .65rem;
        padding: .6rem;
    }

    /* Each row → Card */
    table.fee-table tbody tr {
        display: block;
        background: var(--white);
        border-radius: var(--r-md);
        border: 1px solid var(--bdr);
        box-shadow: var(--sh-sm);
        overflow: hidden;
        transition: box-shadow .2s;
    }

    table.fee-table tbody tr:hover {
        box-shadow: var(--sh-md);
    }

    /* Gallery rows: subtle teal left border + cursor */
    table.fee-table tbody tr.gallery-row {
        border-left: 3px solid var(--g500);
        cursor: pointer;
    }

    table.fee-table tbody tr.gallery-row:active {
        background: var(--g100);
    }

    /* Hide first-cell gallery emoji (card layout has its own badge) */
    table.fee-table tr.gallery-row td:first-child::before {
        display: none;
    }

    /* Footnote row (th colspan) → styled as a note box */
    table.fee-table tbody tr:has(th[colspan]) {
        border: none;
        box-shadow: none;
        background: transparent;
    }

    table.fee-table tbody tr th[colspan] {
        display: block;
        width: 100%;
        box-sizing: border-box;
        padding: .6rem .85rem;
        font-size: .72rem;
        font-weight: 500;
        color: var(--text-600);
        background: linear-gradient(90deg, #fffbec, #fff8e1);
        border-left: 3px solid var(--gold);
        border-radius: var(--r-sm);
        border-top: none;
        line-height: 1.65;
        /* ─── Critical: override the inherited nowrap ─── */
        white-space: normal;
        word-break: break-word;
        text-align: left;
        letter-spacing: 0;
        overflow: visible;
    }


    /* Even/odd striping removed (card design doesn't need it) */
    table.fee-table tr:nth-child(even) td,
    table.fee-table tr:nth-child(odd)  td {
        background: transparent;
    }

    /* Each cell → label + value row */
    table.fee-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: .75rem;
        padding: .65rem .85rem;
        border-bottom: 1px solid var(--bdr-light);
        border-right: none;
        font-size: .84rem;
        line-height: 1.55;
        min-height: 0;
    }

    table.fee-table tbody td:last-child {
        border-bottom: none;
    }

    /* Label (from data-label attribute) — left side */
    table.fee-table tbody td::before {
        content: attr(data-label);
        font-size: .72rem;
        font-weight: 600;
        color: var(--g700);
        text-transform: none;
        white-space: nowrap;
        flex-shrink: 0;
        padding-top: .05rem;
        min-width: 100px;
    }

    /* Value — right side */
    table.fee-table tbody td > *:not(.hidden-gallery),
    table.fee-table tbody td {
        text-align: right;
    }

    /* Gallery camera badge on gallery rows */
    table.fee-table tbody tr.gallery-row::before {
        content: '📷 กดเพื่อดูรูปภาพ';
        display: block;
        padding: .35rem .85rem;
        font-size: .7rem;
        color: var(--g600);
        font-weight: 500;
        background: var(--g50);
        border-bottom: 1px solid var(--bdr-light);
        letter-spacing: .02em;
    }

    /* First td: room name — make it a card header */
    table.fee-table tbody td:first-child {
        background: linear-gradient(105deg, var(--g100) 0%, var(--white) 100%);
        border-left: 4px solid var(--g600);
        font-weight: 600;
        font-size: .88rem;
        color: var(--g900);
        padding: .75rem .85rem;
        align-items: center;
        border-bottom: 2px solid var(--bdr);
    }

    /* Hide label for first-child (room name is self-evident) */
    table.fee-table tbody td:first-child::before {
        display: none;
    }

    /* Price columns — value aligned right, bold green */
    table.fee-table tbody td:nth-child(2)::after,
    table.fee-table tbody td:nth-child(3)::after,
    table.fee-table tbody td:nth-child(4)::after {
        content: ' บาท';
        font-size: .7em;
        color: var(--text-400);
        font-weight: 400;
    }

    /* Override the nth-child centering to right-align in card layout */
    table.fee-table td:nth-child(2),
    table.fee-table td:nth-child(3),
    table.fee-table td:nth-child(4) {
        text-align: right;
        justify-content: space-between;
        font-weight: 700;
        color: var(--g800);
        font-size: .88rem;
    }
}


/* =============================================
   RESPONSIVE
   ============================================= */

/* ── Move Right Sidebar to bottom on Tablet/Small Desktop ── */
@media (min-width: 769px) and (max-width: 1200px) {
    .aai-sidebar-right {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
        margin-top: 1rem;
    }
    
    /* Fix quick links image stretching/clipping when taking up 50% width */
    .sb-ql-item {
        max-height: none !important;
        height: auto !important;
    }
    .sb-ql-item img {
        height: auto !important;
        max-height: none !important;
        object-fit: contain !important;
        width: 100% !important;
        background: transparent !important;
    }
}

/* ── 1024px: Tablet landscape ── */
@media (max-width: 1024px) {
    .aai-layout {
        grid-template-columns: 210px 1fr;
        gap: 1.2rem;
        padding: 1.5rem 1.25rem 3rem;
    }

    .aai-intro {
        padding: 1.4rem 1.6rem;
        gap: 1.2rem;
    }

    .intro-title {
        font-size: 1.2rem;
    }

    .aai-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: .7rem;
    }

    .stat-num {
        font-size: 1.3rem;
    }
}

/* ── 768px: Tablet portrait → single column ── */
@media (max-width: 768px) {

    /* Layout → single column; sidebar moves below accordion */
    .aai-layout {
        grid-template-columns: 1fr;
        padding: 1rem .85rem 2.5rem;
        gap: 1rem;
    }

    .aai-sidebar {
        position: static;
        order: 2; /* sidebar below main content on mobile */
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: .75rem;
    }

    .aai-main {
        order: 1; /* main content first */
    }

    /* Quick link images removed manual height constraint */
    /* Hero */
    #myCarousel,
    #myCarousel .carousel-item,
    #myCarousel .carousel-item img {
        height: 300px;
    }

    .aai-hero-caption {
        padding: 0 3%;
        align-items: flex-end;
        padding-bottom: 2rem;
    }

    .aai-hero-text {
        max-width: 100%;
        padding: 1.1rem 1.25rem;
    }

    .hero-title {
        font-size: 1.35rem;
    }

    .hero-sub {
        font-size: .88rem;
        margin-bottom: .5rem;
    }

    .hero-desc {
        font-size: .8rem;
        display: none; /* hide on tablet to save space */
    }

    /* Intro banner */
    .aai-intro {
        flex-direction: row;
        padding: 1.1rem 1.2rem;
        gap: .9rem;
    }

    .intro-icon {
        width: 46px;
        height: 46px;
        font-size: 1.3rem;
        border-radius: 14px;
    }

    .intro-title {
        font-size: 1.05rem;
    }

    .intro-eyebrow {
        font-size: .66rem;
    }

    /* Stats */
    .aai-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: .6rem;
    }

    .stat-card {
        padding: .75rem .85rem;
        gap: .6rem;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: .95rem;
    }

    .stat-num {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: .7rem;
    }

    /* Outer accordion button */
    .service-toggle {
        padding: .9rem 1rem;
        gap: .75rem;
    }

    .svc-icon-wrap {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
        border-radius: 12px;
    }

    .svc-title {
        font-size: .9rem;
    }

    .svc-eyebrow {
        font-size: .62rem;
    }

    .svc-meta {
        display: none;
    }

    /* Inner accordion */
    .inner-toggle {
        padding: .7rem .85rem;
        gap: .65rem;
    }

    .inner-icon {
        width: 30px;
        height: 30px;
        font-size: .85rem;
    }

    .inner-title {
        font-size: .84rem;
    }

    .inner-sub {
        font-size: .68rem;
    }

    /* Table: allow horizontal scroll, smaller font */
    .inner-body {
        padding: .15rem .6rem .8rem;
    }

    .table-wrap {
        border-radius: var(--r-sm);
    }

    table.fee-table th,
    table.fee-table td {
        padding: 8px 10px;
        font-size: .78em;
    }

    caption.fee-cap {
        font-size: .82em;
        padding: 10px 12px 6px;
    }
}

/* ── 576px: Mobile ── */
@media (max-width: 576px) {

    /* Layout */
    .aai-layout {
        padding: .75rem .65rem 2rem;
    }

    /* Sidebar: single column on phone */
    .aai-sidebar {
        grid-template-columns: 1fr;
    }

    /* Quick link images removed manual height constraint */
    /* Hero */
    #myCarousel,
    #myCarousel .carousel-item,
    #myCarousel .carousel-item img {
        height: 240px;
    }

    .aai-hero-caption {
        padding: 0 4%;
        padding-bottom: 1.5rem;
    }

    .aai-hero-text {
        padding: .9rem 1rem;
    }

    .hero-badge {
        font-size: .65rem;
        padding: .15rem .6rem;
        margin-bottom: .5rem;
    }

    .hero-title {
        font-size: 1.1rem;
        margin-bottom: .25rem;
    }

    .hero-sub {
        font-size: .8rem;
        margin-bottom: .4rem;
    }

    .hero-divider {
        margin-bottom: .6rem;
        width: 40px;
    }

    /* Intro banner */
    .aai-intro {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
        gap: .75rem;
    }

    .intro-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
        border-radius: 11px;
    }

    .intro-title {
        font-size: .95rem;
    }

    .intro-hint {
        font-size: .75rem;
    }

    /* Stats: 2 col on phone */
    .aai-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: .55rem;
    }

    .stat-card {
        padding: .65rem .75rem;
    }

    /* Outer accordion */
    .service-toggle {
        padding: .8rem .9rem;
        gap: .6rem;
    }

    .svc-icon-wrap {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        border-radius: 10px;
    }

    .svc-title {
        font-size: .85rem;
        line-height: 1.3;
    }

    .svc-eyebrow {
        display: none;
    }

    .service-body {
        padding: .8rem .8rem 1rem;
    }

    /* Inner accordion */
    .inner-panel {
        border-radius: var(--r-sm);
    }

    .inner-toggle {
        padding: .65rem .8rem;
        gap: .55rem;
        border-left-width: 3px;
    }

    .inner-icon {
        width: 28px;
        height: 28px;
        font-size: .78rem;
        border-radius: 7px;
    }

    .inner-title {
        font-size: .8rem;
    }

    .inner-sub {
        font-size: .64rem;
        /* hide sub-label on tiny phones to reduce clutter */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 220px;
    }

    /* Tables */
    table.fee-table th,
    table.fee-table td {
        padding: 7px 8px;
        font-size: .73em;
        white-space: normal;
        word-break: break-word;
    }

    table.fee-table th {
        white-space: nowrap;
        font-size: .7em;
    }

    caption.fee-cap {
        font-size: .76em;
        padding: 8px 10px 5px;
    }

    caption.fee-cap .cap-sub {
        font-size: .68em;
    }
}

/* ── 400px: Very small phones ── */
@media (max-width: 400px) {

    .aai-layout {
        padding: .5rem .5rem 1.5rem;
    }

    #myCarousel,
    #myCarousel .carousel-item,
    #myCarousel .carousel-item img {
        height: 200px;
    }

    .hero-title {
        font-size: .95rem;
    }

    .hero-sub {
        display: none;
    }

    .aai-stats {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: row;
        align-items: center;
        padding: .6rem .75rem;
    }

    .service-toggle {
        padding: .75rem .8rem;
    }

    .svc-icon-wrap {
        width: 32px;
        height: 32px;
        font-size: .9rem;
        border-radius: 9px;
    }

    .svc-title {
        font-size: .8rem;
    }

    table.fee-table th,
    table.fee-table td {
        padding: 6px 7px;
        font-size: .68em;
    }
}

/* =============================================
   MISC / LEGACY COMPAT
   ============================================= */
.calendar-container {
    background: var(--white);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .08);
    margin-top: 20px;
}

/* old carousel class still used in carousel.php */
.carousel-section {
    display: block;
}