:root {
  --primary: #0b3d37;
  --accent: #28b487;
  --teal: #0e7c72;
  --bg: #f7f9f6;
  --surface: #ffffff;
  --ink: #1f2e2a;
  --muted: #5d6d68;
  --line: #dce6e1;
  --soft: #eef5f1;
  --positive: #177a4d;
  --warning: #a66a14;
  --risk: #a23b3b;
  --shadow: 0 18px 42px rgba(11, 61, 55, 0.1);
  font-family: "Noto Sans Thai", Inter, Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); line-height: 1.65; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 10px;
  z-index: 99;
  padding: 10px 14px;
  background: var(--primary);
  color: #fff;
}
.skip-link:focus { left: 10px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
  min-height: 74px;
  padding: 12px clamp(18px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(247, 249, 246, 0.94);
  backdrop-filter: blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--primary); font-weight: 900; letter-spacing: 0; }
.brand img { width: 38px; height: 38px; }
.site-nav { display: flex; justify-content: center; gap: 22px; color: var(--muted); font-size: 14px; font-weight: 800; }
.site-nav a:hover, .text-link:hover { color: var(--primary); }
.header-actions { display: flex; align-items: center; gap: 14px; }
.menu-button { display: none; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid var(--primary);
  border-radius: 7px;
  font-weight: 900;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--primary); color: #fff; }
.button.secondary { background: var(--surface); color: var(--primary); }
.button.ghost { border-color: var(--line); background: transparent; color: var(--primary); }
.button.small { min-height: 40px; padding: 8px 13px; font-size: 14px; }
.button[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, .95fr);
  gap: clamp(28px, 5vw, 70px);
  align-items: center;
  min-height: 720px;
  padding: clamp(42px, 7vw, 82px) clamp(18px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(11,61,55,.075) 1px, transparent 1px),
    linear-gradient(0deg, rgba(11,61,55,.075) 1px, transparent 1px),
    var(--bg);
  background-size: 48px 48px;
}
.eyebrow { margin: 0 0 12px; color: var(--teal); font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: 0; }
h1, h2, h3, p, li, th, td { overflow-wrap: anywhere; }
h1 { margin: 0; max-width: 780px; color: var(--primary); font-size: clamp(42px, 6vw, 76px); line-height: 1.06; letter-spacing: 0; }
h2 { margin: 0; color: var(--primary); font-size: clamp(28px, 4vw, 46px); line-height: 1.16; letter-spacing: 0; }
h3 { margin: 0; color: var(--primary); font-size: 20px; line-height: 1.32; }
.lead { max-width: 760px; margin: 22px 0 0; color: #31433e; font-size: clamp(18px, 2vw, 22px); }
.hero-actions, .row-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.dashboard-mock, .panel, .card, .form-shell, .result-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.94);
  box-shadow: var(--shadow);
}
.dashboard-mock { padding: 22px; }
.dash-head, .metric-row, .risk-row, .result-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.dash-head { padding-bottom: 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-weight: 900; }
.verdict { color: var(--warning); font-weight: 900; }
.metric-row { padding: 18px 0; }
.metric { flex: 1; min-height: 98px; padding: 15px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfa; }
.metric span, .small-label { display: block; color: var(--muted); font-size: 13px; font-weight: 800; }
.metric strong { display: block; margin-top: 6px; color: var(--primary); font-size: 32px; line-height: 1.05; }
.mini-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.mini-grid .metric { min-height: 78px; box-shadow: none; }
.risk-row { flex-wrap: wrap; margin-top: 14px; padding: 13px; border: 1px solid #eadfcf; border-radius: 8px; background: #fff8ee; }
.badge { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 10px; border-radius: 999px; background: var(--soft); color: var(--primary); font-size: 12px; font-weight: 900; }
.badge.green { background: #dff5eb; color: var(--positive); }
.badge.amber { background: #f5e2c4; color: var(--warning); }
.badge.red { background: #f5dada; color: var(--risk); }
.type-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  margin-top: 10px;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-style: normal;
  font-weight: 950;
  letter-spacing: 0;
}
.type-badge.calculated { background: #dff5eb; color: var(--positive); }
.type-badge.estimated { background: #e4f3f2; color: var(--teal); }
.type-badge.ai { background: #f5e2c4; color: var(--warning); }

.section { padding: clamp(56px, 8vw, 96px) clamp(18px, 5vw, 72px); }
.section.alt { background: var(--soft); }
.section.dark { background: var(--primary); color: #fff; }
.section.dark h2, .section.dark h3, .section.dark .eyebrow { color: #fff; }
.section-head { max-width: 850px; margin-bottom: 28px; }
.section-head p:not(.eyebrow) { color: var(--muted); font-size: 17px; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.card { min-height: 150px; padding: 20px; box-shadow: none; }
.card p { color: var(--muted); margin: 10px 0 0; }
.card .status { margin-bottom: 12px; }
.link-card { display: block; }
.link-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.product-grid { display: grid; grid-template-columns: 1.35fr repeat(3, minmax(0, 1fr)); gap: 14px; }
.primary-product { border: 2px solid var(--accent); background: linear-gradient(180deg, #fff, #f4fbf8); }
.primary-product h3 { font-size: 28px; }

.trust-bar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.trust-item { padding: 20px clamp(18px, 4vw, 38px); background: var(--surface); }
.trust-item strong { color: var(--primary); }
.trust-item span { display: block; color: var(--muted); font-size: 14px; }

.steps { counter-reset: step; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.steps li { counter-increment: step; padding: 20px; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; background: rgba(255,255,255,.08); }
.steps li:before { content: "0" counter(step); color: var(--accent); font-weight: 900; }
.steps p { color: rgba(255,255,255,.75); }

.route-hero { padding: 64px clamp(18px, 5vw, 72px) 34px; border-bottom: 1px solid var(--line); background: var(--bg); }
.route-hero .lead { max-width: 880px; }
.breadcrumb { margin-bottom: 16px; color: var(--muted); font-size: 13px; font-weight: 800; }

.form-shell, .result-shell { padding: 22px; }
.wizard { display: grid; gap: 18px; }
.form-step { display: none; }
.form-step.active { display: block; }
.details-block {
  margin-top: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}
.details-block summary {
  color: var(--primary);
  cursor: pointer;
  font-weight: 900;
}
.details-block p { margin: 10px 0 0; color: var(--muted); }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin: 16px 0; }
.field-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
label { display: block; color: var(--primary); font-size: 14px; font-weight: 900; }
input, select, textarea {
  width: 100%;
  margin-top: 7px;
  padding: 12px 13px;
  border: 1px solid #cbd8d2;
  border-radius: 7px;
  background: #fbfcfa;
  color: var(--ink);
}
input[type="checkbox"] {
  width: auto;
  margin: 0 8px 0 0;
  vertical-align: middle;
}
input:focus, select:focus, textarea:focus, button:focus, a:focus {
  outline: 3px solid rgba(40,180,135,.26);
  outline-offset: 2px;
}
.form-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }
.status-text { min-height: 28px; color: var(--muted); font-weight: 800; }
.status-text.error { color: var(--risk); }
.status-text.success { color: var(--positive); }

.result-top { align-items: flex-start; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.result-verdict { font-size: clamp(44px, 7vw, 76px); color: var(--primary); font-weight: 950; line-height: 1; }
.score-ring { min-width: 138px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; text-align: center; background: #fbfcfa; }
.score-ring strong { display: block; color: var(--primary); font-size: 42px; line-height: 1; }
.result-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-top: 18px; }
.result-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.result-section h3 { margin-bottom: 12px; }
.result-card { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.result-card strong { display: block; color: var(--primary); font-size: 24px; line-height: 1.1; }
.result-card span { color: var(--muted); font-size: 13px; font-weight: 800; }
.result-card p, .confidence-note { margin: 10px 0 0; color: var(--muted); }
.result-lists { margin-top: 18px; }
.sample-preview .result-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
.risk-list, .plain-list { margin: 12px 0 0; padding-left: 20px; color: var(--muted); }

.article-list { display: grid; gap: 14px; }
.article-row { display: grid; grid-template-columns: 160px 1fr auto; gap: 18px; align-items: center; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.article-row span { color: var(--muted); font-weight: 800; }

.footer { padding: 36px clamp(18px, 5vw, 72px); border-top: 1px solid var(--line); background: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.2fr repeat(3, 1fr); gap: 24px; }
.footer a { display: block; margin: 7px 0; color: var(--muted); font-weight: 700; }
.footer p { color: var(--muted); }

.toast { position: fixed; right: 18px; bottom: 18px; z-index: 60; max-width: 360px; padding: 14px 16px; border-radius: 8px; background: var(--primary); color: #fff; opacity: 0; transform: translateY(10px); transition: .18s ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .site-header { grid-template-columns: auto auto; }
  .menu-button { display: inline-flex; justify-self: end; padding: 9px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--primary); font-weight: 900; }
  .site-nav, .header-actions { display: none; grid-column: 1 / -1; }
  .site-header.open .site-nav, .site-header.open .header-actions { display: flex; justify-content: flex-start; flex-wrap: wrap; }
  .hero, .grid.two, .grid.three, .grid.four, .result-grid, .sample-preview .result-grid, .product-grid, .footer-grid { grid-template-columns: 1fr; }
  .trust-bar, .steps { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 640px) {
  h1 { font-size: 40px; }
  .hero { min-height: auto; padding-top: 40px; }
  .metric-row, .result-top { flex-direction: column; align-items: stretch; }
  .mini-grid, .field-grid, .field-grid.three, .trust-bar, .steps { grid-template-columns: 1fr; }
  .article-row { grid-template-columns: 1fr; }
  .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { scroll-behavior: auto !important; transition: none !important; }
}
