:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --ink: #0f172a;
  --ink-muted: #475569;
  --border: #cbd5e1;
  --brand: #047857;
  --brand-dark: #065f46;
  --brand-soft: #ecfdf5;
  --brand-border: #6ee7b7;
  --warn-bg: #fffbeb;
  --warn-border: #f59e0b;
  --warn-ink: #92400e;
  --danger-bg: #fef2f2;
  --danger-border: #ef4444;
  --danger-ink: #991b1b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08);
  --font: "Noto Sans Thai", "Sarabun", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--brand); }
:focus-visible { outline: 3px solid #0284c7; outline-offset: 2px; border-radius: 4px; }
.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--brand-dark);
  color: #fff; padding: 10px 16px; z-index: 999; text-decoration: none; font-weight: 600;
}
.skip-link:focus { left: 8px; top: 8px; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Independent Disclosure Bar */
.disclosure-bar {
  background: #0f172a;
  color: #f8fafc;
  font-size: .85rem;
  padding: 6px 0;
  text-align: center;
}
.disclosure-bar a { color: #6ee7b7; }

/* Header & Nav */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 60px;
  flex-wrap: nowrap;
  padding: 8px 16px;
}
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--brand-dark);
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
  display: block;
}
.brand-badge {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid var(--brand-border);
  font-size: .72rem;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
}
.nav-toggle {
  display: none;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
}
.main-nav { display: flex; flex-wrap: nowrap; gap: 2px; align-items: center; }
.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 8px;
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  border-radius: 8px;
  white-space: nowrap;
}
.main-nav a:hover, .main-nav a[aria-current="page"] {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

/* Breadcrumbs */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: .88rem;
  color: var(--ink-muted);
  margin: 14px 0 10px;
  padding: 0;
  list-style: none;
}
.breadcrumb li + li::before { content: "/"; margin-right: 6px; color: var(--border); }

/* Hero & Answer-First */
.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin: 12px 0 20px;
}
.hero-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; align-items: center; }
.hero-media img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  border: 1px solid var(--border);
}
.article-figure {
  max-width: 720px;
  margin: 22px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.article-figure img {
  width: 100%;
  height: auto;
  display: block;
}
.article-figure figcaption {
  padding: 10px 14px;
  font-size: .88rem;
  color: var(--ink-muted);
  text-align: center;
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
}
h1 { font-size: clamp(1.45rem, 2.5vw, 2rem); line-height: 1.3; margin: 0 0 12px; color: var(--ink); }
h2 { font-size: 1.3rem; line-height: 1.35; margin: 24px 0 12px; color: var(--ink); }
h3 { font-size: 1.08rem; line-height: 1.4; margin: 16px 0 8px; }
.answer-first {
  background: var(--brand-soft);
  border-left: 4px solid var(--brand);
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 1.02rem;
  margin-bottom: 14px;
}
.meta-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: .85rem;
  color: var(--ink-muted);
  margin-top: 10px;
}

/* Alerts & Archetype Boxes */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 14px 0;
}
.alert-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-ink); }
.alert-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-ink); }
.alert-info { background: #eff6ff; border-color: #93c5fd; color: #1e3a8a; }
.legacy-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.legacy-banner[hidden] { display: none; }

.do-dont-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.do-box { background: var(--brand-soft); border: 1px solid var(--brand-border); border-radius: var(--radius); padding: 14px 16px; }
.dont-box { background: var(--danger-bg); border: 1px solid var(--danger-border); border-radius: var(--radius); padding: 14px 16px; }
.do-box h2, .dont-box h2 { margin-top: 0; font-size: 1.1rem; }

/* Interactive Tools & Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin: 16px 0;
}
.wizard-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 14px; }
.field label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 6px; }
.field select, .field input {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #94a3b8;
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font);
  background: #fff;
  color: var(--ink);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: .95rem;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-secondary { background: var(--surface-alt); color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { background: #e2e8f0; color: var(--ink); }
.btn-sm { min-height: 44px; padding: 6px 12px; font-size: .88rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.ic { width: 1.05em; height: 1.05em; flex-shrink: 0; display: inline-block; vertical-align: -0.16em; }
.ic-lg { width: 1.25em; height: 1.25em; flex-shrink: 0; display: inline-block; vertical-align: -0.22em; }
.h-ic { display: inline-flex; align-items: center; gap: 8px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  font-family: var(--font);
}
.chip.is-active, .chip[aria-pressed="true"] {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* Package Cards */
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin: 16px 0; }
.pkg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  box-shadow: var(--shadow);
}
.pkg-card.is-held { background: #fafafa; border-style: dashed; }
.pkg-badges { display: flex; flex-wrap: wrap; gap: 6px; font-size: .78rem; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface-alt);
}
.badge-verified { background: var(--brand-soft); border-color: var(--brand-border); color: var(--brand-dark); }
.badge-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-ink); }
.badge-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-ink); }

.pkg-title { font-size: 1.05rem; font-weight: 700; margin: 0; line-height: 1.4; }
.pkg-price {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
}
.pkg-price-sub { font-size: .84rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.pkg-specs { margin: 0; padding-left: 18px; font-size: .9rem; color: var(--ink); }
.ussd-box {
  background: #0f172a;
  color: #f8fafc;
  border-radius: 8px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.08rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: .02em;
  user-select: all;
}
.pkg-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pkg-actions .btn { flex: 1 1 auto; }
.feedback-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--surface-alt);
  padding-top: 8px;
  font-size: .82rem;
  color: var(--ink-muted);
}

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin: 14px 0; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--surface-alt); vertical-align: top; }
th { background: var(--surface-alt); font-weight: 700; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* FAQ details */
details.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 10px;
}
details.faq-item summary {
  font-weight: 700;
  cursor: pointer;
  min-height: 32px;
  display: flex;
  align-items: center;
}

/* Sticky Compare Bar & Troubleshooter CTA */
.compare-bar {
  position: fixed;
  bottom: 12px;
  right: 12px;
  left: 12px;
  max-width: 760px;
  margin: 0 auto;
  background: #0f172a;
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .25);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 50;
}
.compare-bar.is-visible { display: flex; flex-wrap: wrap; }

/* Consent Banner (Zero-CLS fixed overlay) */
.consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #0f172a;
  color: #f8fafc;
  border-top: 2px solid var(--brand);
  padding: 14px 16px;
  z-index: 60;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, .2);
}
.consent-banner[hidden] { display: none; }
.consent-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.consent-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Footer */
.site-footer {
  background: #0f172a;
  color: #cbd5e1;
  margin-top: 40px;
  padding: 32px 0 70px;
  font-size: .9rem;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.site-footer h2, .site-footer h3 { color: #fff; font-size: 1rem; margin-top: 0; }
.site-footer a { color: #6ee7b7; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 6px; }

@media (max-width: 960px) {
  .header-inner { flex-wrap: wrap; }
  .hero-grid, .do-dont-grid { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; align-items: center; }
  .main-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-top: 8px; }
  .main-nav.is-open { display: flex; }
}
