:root {
  --bg: #F5F9FC;
  --surface: #FFFFFF;
  --navy: #082B49;
  --blue: #0879D1;
  --ice: #EAF5FC;
  --red: #C9152B;
  --dred: #9E1021;
  --text: #17324D;
  --muted: #60788C;
  --line: #D7E5EF;
  --ok: #1B7A4A;
  --amber: #C4841D;
  --orange: #D97706;
  --shadow: 0 10px 30px rgba(8, 43, 73, .06);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans Thai", "IBM Plex Sans", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
a { color: var(--blue); text-decoration: none; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 12px 28px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.logo {
  display: flex; align-items: center; flex: 0 0 auto; line-height: 0;
  color: var(--navy);
}
.logo img {
  display: block;
  height: 72px;
  width: auto;
  max-width: 260px;
}
.nav { display: none; gap: 22px; margin: 0 auto; }
.nav a { color: var(--muted); font-size: 14px; }
.nav a:hover { color: var(--navy); }
.livebox { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.live { color: var(--ok); font-weight: 600; font-size: 12px; letter-spacing: .08em; display: inline-flex; align-items: center; gap: 6px; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(27,122,74,.15); }
.live.delayed { color: var(--amber); }
.live.delayed i { background: var(--amber); box-shadow: none; }
.more-menu { position: relative; }
.more-menu summary { cursor: pointer; list-style: none; color: var(--navy); font-size: 13px; }
.more-menu div {
  position: absolute; right: 0; top: 28px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 8px; min-width: 160px; box-shadow: var(--shadow); display: grid;
}
.more-menu a, .more-menu button {
  border: 0; background: none; text-align: left; padding: 8px 10px; color: var(--text); font: inherit; cursor: pointer;
}
.mobile-select { display: none; padding: 12px 20px 0; }
.mobile-select select {
  width: 100%; margin-top: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font: inherit;
}
.shell { max-width: 1180px; margin: 0 auto; padding: 28px 28px 64px; }
.hero { padding: 8px 0 28px; }
.eyebrow { margin: 0 0 8px; color: var(--muted); font-size: 13px; letter-spacing: .08em; }
.hero h1 { margin: 0; font-size: 32px; font-weight: 600; letter-spacing: -.02em; }
.station, .level-label, .meta, .note, .sub, .fine { color: var(--muted); margin: 4px 0 0; font-size: 14px; font-weight: 400; }
.hero-grid { display: grid; gap: 28px; align-items: end; }
.level { margin: 18px 0 0; display: flex; align-items: baseline; gap: 8px; }
.level .num { font-family: "IBM Plex Sans", sans-serif; font-size: 56px; font-weight: 600; line-height: 1; letter-spacing: -.04em; }
.level .unit { color: var(--muted); font-size: 20px; }
.delta { margin: 6px 0 14px; font-size: 15px; }
.trend-down { color: var(--ok); }
.trend-up { color: var(--red); }
.risk-chip {
  display: inline-block; border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 600;
}
.tone-ok { color: var(--ok); background: #e7f6ee; }
.tone-warn { color: #8a5a00; background: #fff4d6; }
.tone-mid { color: #9a4d00; background: #ffedd5; }
.tone-alert { color: #fff; background: var(--red); }
.tone-crit { color: #fff; background: var(--dred); }
.kpis { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }
.kpis span { display: block; color: var(--muted); font-size: 12px; }
.kpis strong { display: block; font-size: 20px; font-weight: 600; font-family: "IBM Plex Sans", sans-serif; }
.kpis em { color: var(--muted); font-style: normal; font-size: 13px; }
.map-stage { margin: 8px 0 32px; }
.map-head { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 12px; flex-wrap: wrap; }
.map-head h2, .block h2, .mini h2 { margin: 0; font-size: 22px; font-weight: 600; }
.horizon { display: flex; gap: 6px; flex-wrap: wrap; }
.horizon button {
  border: 0; background: transparent; color: var(--muted); padding: 6px 10px; border-radius: 999px; font: inherit; cursor: pointer; white-space: nowrap;
}
.horizon button.on { background: var(--navy); color: #fff; }
.horizon button.pending { opacity: .55; }
.horizon button:disabled { opacity: .35; cursor: not-allowed; }
.horizon-select-wrap { display: none; }
.place-bar {
  display: grid; grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(120px, 1fr));
  gap: 8px; margin: 0 0 10px;
}
.place-bar select, .search-wrap input, .horizon-select-wrap select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: #fff; font: inherit; color: var(--text);
}
.search-wrap { position: relative; }
#search-hits {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 40; margin: 4px 0 0; padding: 6px;
  list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 240px; overflow: auto;
}
#search-hits button {
  width: 100%; border: 0; background: none; text-align: left; padding: 8px 10px;
  font: inherit; cursor: pointer; border-radius: 8px; color: var(--text);
}
#search-hits button:hover { background: var(--ice); }
.map-canvas {
  position: relative; background: #dceef8;
  border-radius: 16px; min-height: 560px; overflow: hidden;
}
#risk-map { width: 100%; height: 560px; display: block; z-index: 1; }
#risk-map .leaflet-control-zoom { border: 0; box-shadow: var(--shadow); }
.map-home {
  position: absolute; left: 12px; top: 84px; z-index: 500;
  border: 0; background: #fff; color: var(--navy); border-radius: 10px;
  padding: 8px 10px; font: inherit; font-size: 13px; cursor: pointer; box-shadow: var(--shadow);
}
.horizon-banner {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  z-index: 500; background: rgba(255,255,255,.94); color: var(--navy);
  border-radius: 999px; padding: 8px 14px; font-size: 13px; box-shadow: var(--shadow);
  max-width: min(420px, 86%); text-align: center;
}
.glass-legend {
  position: absolute; left: 12px; bottom: 12px; margin: 0; padding: 10px 12px;
  list-style: none; background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-radius: 12px; display: grid; gap: 5px; font-size: 11px; line-height: 1.35; z-index: 500;
  pointer-events: none; max-width: min(320px, 72%);
}
.glass-legend li:first-child { font-weight: 600; color: var(--navy); margin-bottom: 2px; font-size: 12px; }
.glass-legend strong { font-weight: 600; color: var(--navy); }
.glass-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; flex-shrink: 0; }
.glass-legend i.tone-crit { background: var(--dred); }
.glass-legend i.tone-alert { background: var(--red); }
.glass-legend i.tone-mid { background: var(--orange); }
.glass-legend i.tone-warn { background: #E3B341; }
.glass-legend i.tone-ok { background: var(--ok); }
.glass-legend i.tone-none { background: #c5d4e0; }
.glass-legend i.tone-nodata { background: #e8eef3; border: 1px solid #94a3b8; box-sizing: border-box; }
.legend-empty { color: var(--muted); }
.glass-detail {
  position: absolute; right: 12px; top: 12px; width: min(280px, 86%);
  background: rgba(255,255,255,.94); backdrop-filter: blur(12px);
  border-radius: 14px; padding: 14px; box-shadow: var(--shadow); z-index: 500;
}
.detail-close { position: absolute; right: 10px; top: 8px; border: 0; background: none; font: inherit; cursor: pointer; color: var(--muted); }
.detail-grid { display: grid; gap: 6px; margin: 10px 0; }
.detail-grid div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.detail-grid span { color: var(--muted); }
.detail-grid em { font-style: normal; color: var(--muted); font-size: 11px; }
.detail-kind { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.glass-detail h3 { margin: 0; font-size: 16px; }
.glass-detail p { margin: 4px 0; font-size: 13px; color: var(--muted); }
.glass-detail .big { font-size: 28px; color: var(--navy); font-family: "IBM Plex Sans", sans-serif; font-weight: 600; }
.map-foot { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.duo { display: grid; gap: 40px; margin: 0 0 40px; }
.block, .mini { padding: 0; }
.timeline { list-style: none; margin: 18px 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 18px 16px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -23px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--line);
}
.timeline .focus24::before { background: var(--blue); box-shadow: 0 0 0 4px rgba(8,121,209,.12); }
.timeline span { display: block; color: var(--muted); font-size: 12px; }
.timeline strong { font-size: 22px; font-weight: 600; font-family: "IBM Plex Sans", sans-serif; }
.focus24 strong { font-size: 28px; color: var(--navy); }
.bars { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 14px; }
.bars div { display: flex; justify-content: space-between; font-size: 14px; }
.bars em { font-style: normal; color: var(--muted); font-family: "IBM Plex Sans", sans-serif; }
.bars b { display: block; height: 6px; background: #dceaf4; border-radius: 99px; margin-top: 6px; }
.bars i { display: block; height: 6px; background: var(--blue); border-radius: 99px; }
#chart { width: 100%; background: transparent; }
.empty { color: var(--muted); font-size: 14px; }
.error-line { font-size: 14px; }
.network { list-style: none; margin: 12px 0 0; padding: 0; }
.network li { position: relative; padding: 0 0 16px 18px; }
.network li::before { content: ""; position: absolute; left: 3px; top: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.network li:not(:last-child)::after { content: ""; position: absolute; left: 6px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.network a { display: flex; gap: 10px; align-items: center; color: inherit; flex-wrap: wrap; }
.network em { margin-left: auto; font-style: normal; font-family: "IBM Plex Sans", sans-serif; }
.quiet { align-items: start; }
.mini .ver { font-size: 28px; margin: 8px 0; font-family: "IBM Plex Sans", sans-serif; }
.sources { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 8px; }
.sources i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 8px; }
.extra { margin-top: 8px; color: var(--muted); }
.extra summary { cursor: pointer; font-size: 14px; }
.text-btn, .btn {
  border: 0; background: none; color: var(--blue); padding: 0; font: inherit; cursor: pointer;
}
.btn.primary, .actions .btn {
  background: var(--navy); color: #fff; border-radius: 10px; padding: 8px 12px; margin-right: 8px;
}
.weight-form { display: grid; gap: 8px; max-width: 320px; }
.weight-form input { padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.pairs { list-style: none; padding: 0; display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.foot { max-width: 1180px; margin: 0 auto; padding: 8px 28px 40px; color: var(--muted); font-size: 13px; }
.foot-brand { display: inline-flex; align-items: center; margin: 0 0 12px; line-height: 0; }
.foot-brand img { display: block; height: 56px; width: auto; max-width: 220px; }
.auth-logo { justify-content: center; margin: 0 0 8px; }
.auth-logo img { height: 88px; max-width: 320px; }
dialog { border: 0; border-radius: 16px; padding: 20px; width: min(480px, 92vw); box-shadow: var(--shadow); }
#why-body dt { color: var(--muted); }
#why-body dd { margin: 0 0 8px; font-weight: 600; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth-card { width: min(400px, 100%); background: #fff; border-radius: 16px; padding: 28px; display: grid; gap: 12px; box-shadow: var(--shadow); }
.auth-card input { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.kicker { margin: 0; letter-spacing: .14em; color: var(--muted); font-size: 12px; }
.note.warn { color: var(--red); }
.foot-links { margin: 0 0 10px; }
.foot-links a { color: var(--blue); }
.foot-disclaimer {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  max-width: 72ch;
}

/* Site-wide development disclaimer banner */
.site-dev-banner {
  background: #9E1021;
  color: #fff;
  padding: 10px 16px;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.site-dev-banner strong {
  font-weight: 700;
}
.site-dev-banner a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.method-disclaimer {
  margin: 18px 0 0;
  padding: 14px 16px;
  background: #fff5f6;
  border: 1px solid #f0b6be;
  border-left: 4px solid #C9152B;
  border-radius: 0 12px 12px 0;
  color: var(--navy);
  font-size: 14px;
  line-height: 1.6;
}
.method-disclaimer h2 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #9E1021;
}

/* Methodology / documentation page */
.page-method .method-shell { max-width: 820px; }
.method-hero { padding: 8px 0 20px; }
.method-lead { margin: 10px 0 0; font-size: 17px; color: var(--muted); }
.method-callout {
  margin: 18px 0 0;
  padding: 12px 14px;
  background: var(--ice);
  border-left: 3px solid var(--blue);
  border-radius: 0 10px 10px 0;
  color: var(--navy);
  font-size: 14px;
}
.method-toc {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 0 0 24px; padding: 0;
}
.method-toc a {
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}
.method-toc a:hover { color: var(--navy); border-color: #b9d0e0; }
.method-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  margin: 0 0 16px;
  box-shadow: var(--shadow);
}
.method-card h2 {
  margin: 0 0 12px;
  font-size: 20px;
  color: var(--navy);
}
.method-card h3 {
  margin: 18px 0 8px;
  font-size: 15px;
  color: var(--navy);
}
.method-card p { margin: 0 0 10px; }
.method-list { margin: 0 0 12px; padding-left: 1.2em; }
.method-list li { margin: 0 0 6px; }
.method-mono {
  font-family: "IBM Plex Sans", monospace;
  font-size: 14px;
  word-break: break-all;
}
.method-card code {
  font-family: "IBM Plex Sans", monospace;
  font-size: 0.92em;
  background: var(--ice);
  padding: 1px 6px;
  border-radius: 6px;
}
.method-pipeline {
  list-style: none;
  margin: 12px 0 16px;
  padding: 0;
  display: grid;
  gap: 0;
}
.method-pipeline li {
  position: relative;
  padding: 12px 12px 12px 18px;
  border-left: 2px solid var(--line);
  margin-left: 8px;
}
.method-pipeline li::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 16px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
}
.method-pipeline li:last-child { border-left-color: transparent; }
.method-pipeline span { display: block; font-weight: 600; color: var(--navy); }
.method-pipeline small { color: var(--muted); font-size: 13px; }
.method-limits { border-color: #e5c9a0; background: #fffaf3; }
.page-method .mobile-select { display: none !important; }

@media (max-width: 899px) {
  .page-method .topbar .livebox .text-btn { font-size: 13px; }
  .method-card { padding: 16px; border-radius: 14px; }
  .method-hero h1 { font-size: 24px; }
}

@media (min-width: 900px) {
  .nav { display: flex; }
  .hero-grid { grid-template-columns: 1.1fr .9fr; }
  .duo { grid-template-columns: 1.1fr .9fr; }
  .mobile-select { display: none !important; }
}

@media (max-width: 899px) {
  .topbar { padding: 8px 14px; }
  .logo img { height: 46px; max-width: 176px; }
  .foot-brand img { height: 42px; max-width: 168px; }
  .nav { display: none; }
  .mobile-select { display: block; }
  .shell { padding: 16px 16px 48px; }
  .hero h1 { font-size: 26px; }
  .level .num { font-size: 44px; }
  .map-canvas, #risk-map { min-height: 380px; height: 380px; }
  .horizon { display: none; }
  .horizon-select-wrap { display: grid; width: 100%; font-size: 13px; color: var(--muted); }
  .place-bar { grid-template-columns: 1fr; }
  .map-home { top: 12px; left: auto; right: 12px; }
  .glass-legend { left: 8px; bottom: 8px; padding: 8px 10px; }
  .glass-detail {
    position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: 100%;
    max-height: 42vh; overflow: auto; border-radius: 16px 16px 0 0;
    z-index: 40;
  }
}
