:root {
  --brand: #ff6600;
  --brand-dark: #e05500;
  --brand-soft: #fff3eb;
  --ink: #1d2433;
  --ink-2: #4a5468;
  --muted: #6b7486;
  --line: #e6e9ef;
  --bg: #f5f7fa;
  --card: #fff;
  --ok: #128a4b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --font: "Noto Sans Thai", "Leelawadee UI", Tahoma, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.65; color: var(--ink); background: var(--bg); }
img { max-width: 100%; height: auto; }
a { color: #0b5cad; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .6em; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small, small { font-size: .85rem; }

/* ---------- header / footer ---------- */
.site-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 700; font-size: 1.15rem; }
.logo:hover { text-decoration: none; }
.logo b, .footer-brand b { color: var(--brand); }
.main-nav { display: flex; gap: 4px; }
.main-nav a { color: var(--ink-2); padding: 8px 10px; border-radius: 8px; font-size: .95rem; }
.main-nav a:hover { background: var(--bg); text-decoration: none; }
.nav-toggle { display: none; }

/* มือถือ: ปุ่ม ☰ เปิด/ปิดเมนูแบบเลื่อนลงใต้ header */
@media (max-width: 759px) {
  .nav-toggle { display: flex; flex-direction: column; justify-content: center; gap: 5px; width: 44px; height: 44px; padding: 0 10px; background: none; border: 0; border-radius: 10px; cursor: pointer; }
  .nav-toggle:hover { background: var(--bg); }
  .nav-toggle span { display: block; height: 2px; border-radius: 2px; background: var(--ink); transition: transform .2s, opacity .2s; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .main-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; gap: 0; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 12px 24px rgba(16, 24, 40, .1); padding: 6px 0; }
  .main-nav.is-open { display: flex; }
  .main-nav a { padding: 13px 20px; border-radius: 0; font-size: 1rem; color: var(--ink); }
  .main-nav a + a { border-top: 1px solid var(--line); }
}

.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 12px 0 0; margin: 0; font-size: .85rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin-right: 4px; }

.site-footer { background: #111827; color: #c7cdd8; margin-top: 48px; padding: 36px 0 90px; font-size: .92rem; }
.site-footer a { color: #e5e7eb; }
.footer-grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1.4fr; } .site-footer { padding-bottom: 36px; } }
.footer-brand { font-size: 1.2rem; font-weight: 700; color: #fff; margin-bottom: .4em; }
.footer-h { color: #fff; font-weight: 600; margin-bottom: .4em; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 4px; }
.copyright { border-top: 1px solid #2a3344; margin-top: 24px; padding-top: 16px; font-size: .82rem; color: #8b94a5; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: .95rem; border: 1px solid transparent; cursor: pointer; white-space: nowrap; font-family: inherit; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: #cfd5df; }
.btn-lg { padding: 13px 22px; font-size: 1.02rem; }
.btn-sm { padding: 7px 14px; font-size: .88rem; }
.btn-block { display: flex; width: 100%; }

/* ---------- cards / layout ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card-head { margin-bottom: 12px; }
.card-head h2 { margin-bottom: .2em; }
.layout-2col { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); margin-top: 20px; }
@media (min-width: 960px) { .layout-2col { grid-template-columns: minmax(0, 1fr) 320px; } .sticky-side { position: sticky; top: 76px; } }
.section { margin-top: 32px; }
.section > h2 { margin-bottom: 14px; }

/* ---------- hero ---------- */
.route-hero, .page-hero { background: linear-gradient(180deg, #fff 0%, var(--brand-soft) 100%); border-bottom: 1px solid var(--line); padding: 20px 0 24px; }
.route-hero h1, .page-hero h1 { margin-bottom: .35em; }
.lead { color: var(--ink-2); max-width: 820px; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0 18px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.stats div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.stats dt { font-size: .8rem; color: var(--muted); }
.stats dd { margin: 0; font-weight: 700; font-size: 1.08rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.date-pick { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--ink-2); }
.date-pick input { font: inherit; font-size: .95rem; padding: 9px 10px; border: 1px solid #cfd5df; border-radius: 10px; background: #fff; color: var(--ink); min-height: 46px; }
.card-head .date-pick { margin-top: 4px; }
@media (max-width: 560px) { .hero-actions .date-pick { width: 100%; justify-content: space-between; } .hero-actions .date-pick input { flex: 1; } }
@media (max-width: 560px) { .hero-actions .btn { width: 100%; white-space: normal; } }

/* ---------- timetable ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font: inherit; font-size: .9rem; cursor: pointer; color: var(--ink-2); }
.chip span { color: var(--muted); font-size: .8rem; margin-left: 2px; }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.is-active span { color: #cbd2dd; }
.chips-label { font-size: .85rem; color: var(--muted); align-self: center; margin-right: 2px; }
.trip-group + .trip-group { margin-top: 18px; }
.group-book { margin-left: auto; }
.map-link { text-decoration: none; font-size: .9em; }
.map-link:hover { text-decoration: none; filter: brightness(.8); }
.t-op small.drop a { color: inherit; text-decoration: underline; text-decoration-color: #cfd5df; }
.stop-list li { margin-bottom: 6px; }
.near { display: block; color: #8a5a00; font-size: .8rem; }

/* ---------- เลือกจุดขึ้นรถ ---------- */
.choose { width: min(560px, calc(100vw - 32px)); border: 0; border-radius: var(--radius); padding: 18px 20px 20px; box-shadow: 0 20px 60px rgba(16, 24, 40, .25); color: var(--ink); }
.choose::backdrop { background: rgba(17, 24, 39, .55); }
.choose-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.choose-head h2 { margin: 0; }
.choose-close { font: inherit; font-size: 1.6rem; line-height: 1; background: none; border: 0; cursor: pointer; color: var(--muted); padding: 4px 8px; }
.choose-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; }
.choose-list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); }
.choose-list a:hover { border-color: var(--brand); background: var(--brand-soft); text-decoration: none; }
.choose-text strong { display: block; }
.choose-text small { color: var(--muted); }
.group-title { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; background: #fafbfc; border: 1px solid var(--line); border-radius: 10px; }
.group-stops { flex: 1; min-width: 0; }
.group-stops h3 { font-size: 1rem; margin: 0; }
.group-stops p { margin: 2px 0 0; font-size: .95rem; font-weight: 600; }
.group-stops .muted { font-weight: 400; }
.group-title .group-book { align-self: center; }
.pin { color: var(--brand); font-size: .7rem; line-height: 1.9; }
.trips { list-style: none; margin: 0; padding: 0; }
.trip { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "time buy" "op op"; gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
@media (min-width: 720px) { .trip { grid-template-columns: 190px minmax(0, 1fr) auto; grid-template-areas: "time op buy"; } }
.trip[hidden] { display: none; }
.t-time { grid-area: time; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.t-time strong { font-size: 1.15rem; }
.t-time small { width: 100%; }
.arrow { color: var(--muted); }
.t-time sup { color: var(--brand); font-weight: 700; font-size: .7rem; }
.t-op { grid-area: op; display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.t-op img { border-radius: 8px; border: 1px solid var(--line); flex: none; }
.t-op a { font-weight: 600; color: var(--ink); }
.t-op small { display: block; }
.tags { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 4px; vertical-align: middle; }
.tag { font-size: .74rem; padding: 1px 8px; border-radius: 999px; background: #eef1f6; color: var(--ink-2); }
.tag-bus { background: #e8f1ff; color: #1d4f99; }
.tag-van { background: #e9f8ef; color: #136c3c; }
.tag-minibus { background: #fff1e5; color: #a24600; }
.tag-mixed { background: #f3ecff; color: #5b3a9e; }
.t-buy { grid-area: buy; display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.price { font-weight: 700; font-size: 1.1rem; }

/* ---------- lists ---------- */
.op-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.op-list li { display: flex; gap: 10px; align-items: center; }
.op-list img { border-radius: 10px; border: 1px solid var(--line); flex: none; }
.op-list small { display: block; }
.two-lists { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .two-lists { grid-template-columns: 1fr 1fr; } }
ul.plain { padding-left: 18px; margin: 0; }
ul.plain li { margin-bottom: 4px; }
.route-links { list-style: none; padding: 0; margin: 0; }
.route-links li a { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); color: var(--ink); }
.route-links li a:hover { color: var(--brand-dark); text-decoration: none; }
.route-links small { color: var(--muted); white-space: nowrap; }
.h-side { font-size: 1.02rem; }
.more-link { margin: 10px 0 0; font-size: .92rem; font-weight: 600; }
.side-title { font-weight: 700; margin-bottom: 2px; }
.side-price strong { color: var(--brand-dark); font-size: 1.3rem; }
.link-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.link-grid a { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }
.link-grid a:hover { border-color: var(--brand); text-decoration: none; }
.link-grid small { color: var(--muted); white-space: nowrap; }
.province-grid a { align-items: center; }
.province-grid strong { display: block; font-weight: 600; }
.province-grid span small { display: block; white-space: normal; }
.section > h2 small { font-size: .85rem; font-weight: 400; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.data th, table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { font-size: .8rem; color: var(--muted); font-weight: 600; background: #fafbfc; }
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; }

/* ---------- faq ---------- */
.faq details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; position: relative; padding-right: 24px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 0; top: 0; color: var(--muted); font-size: 1.2rem; line-height: 1.4; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 8px 0 0; color: var(--ink-2); }

/* ---------- search box ---------- */
.sbox { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 12px; box-shadow: var(--shadow); margin: 20px 0; color: var(--ink); }
.sbox-title { font-size: 1.1rem; }
.sbox-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.sbox-tabs button { font: inherit; font-size: .92rem; background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; color: var(--muted); cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.sbox-tabs button.is-active { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }
.sbox-fields { display: grid; grid-template-columns: 1fr; gap: 10px; position: relative; }
@media (min-width: 760px) { .sbox-fields { grid-template-columns: 1fr 40px 1fr 170px 140px; align-items: end; } }
.sbox-field input[type="date"] { min-height: 46px; }
.sbox-field { position: relative; }
.sbox-field label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 2px; }
.sbox-field input { width: 100%; font: inherit; font-size: 1rem; padding: 11px 12px; border: 1px solid #cfd5df; border-radius: 10px; background: #fff; color: var(--ink); }
.sbox-field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 102, 0, .15); }
.sbox-swap { font: inherit; font-size: 1.1rem; height: 46px; border: 1px solid var(--line); background: #fff; border-radius: 10px; cursor: pointer; color: var(--ink-2); }
@media (max-width: 759px) { .sbox-swap { position: absolute; right: 8px; top: 52px; width: 40px; height: 34px; z-index: 2; } }
.sbox-go { height: 46px; font-size: 1rem; }
.sbox-go.is-disabled { opacity: .55; }
.sbox-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 40; list-style: none; margin: 4px 0 0; padding: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(16, 24, 40, .14); max-height: 320px; overflow-y: auto; }
.sbox-list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.sbox-list li small { color: var(--muted); white-space: nowrap; }
.sbox-list li.is-active, .sbox-list li:hover { background: var(--brand-soft); }
.sbox-list li.sbox-empty { color: var(--muted); cursor: default; background: none; }
.sbox .sbox-hint { font-size: .86rem; color: var(--muted); margin: 10px 0 0; }
.linkish { font: inherit; background: none; border: 0; padding: 0; color: #0b5cad; cursor: pointer; }
[data-panel="busx"] { min-height: 220px; }
.home-hero { background: linear-gradient(135deg, #ff6600 0%, #ff8a3d 100%); color: #fff; padding: 36px 0 28px; }
.home-hero h1 { color: #fff; }
.home-hero p { color: #fff3ea; max-width: 720px; }
.home-hero .sbox { margin-bottom: 0; }

/* ---------- misc ---------- */
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.region { margin-bottom: 18px; }
.region h3 { font-size: .95rem; color: var(--muted); margin-bottom: 8px; }
.nearby { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.nearby ul { padding-left: 18px; margin: 0; }
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.4em; }
.gallery { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.gallery li { position: relative; }
.gallery img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: #eef1f6; }
.gallery span { position: absolute; left: 8px; bottom: 8px; background: rgba(17, 24, 39, .72); color: #fff; font-size: .75rem; padding: 1px 8px; border-radius: 999px; }
.op-list img.op-cover { width: 96px; height: 72px; object-fit: cover; }
.op-head { display: flex; gap: 16px; align-items: center; }
.op-head img { border-radius: 14px; border: 1px solid var(--line); background: #fff; }
.notice { background: #fffbea; border: 1px solid #f6e3a1; border-radius: 10px; padding: 10px 14px; font-size: .88rem; color: #6b5a14; }

/* ---------- mobile sticky CTA ---------- */
.mobile-cta { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(16, 24, 40, .08); }
.mobile-cta small { display: block; color: var(--muted); line-height: 1.2; }
.mobile-cta strong { color: var(--brand-dark); }
@media (min-width: 960px) { .mobile-cta { display: none; } }
