:root {
  --navy: #031c3d; --navy-2: #0a3264; --ice: #f4fbff; --ice-2: #eaf7ff;
  --surface: #fff; --ink: #031a3b; --muted: #52677e; --line: #bfd6e6;
  --lime: #cfff00; --lime-soft: #f0ffd0; --warn: #fff7ce; --danger: #b7352b;
  --shadow: 0 18px 50px rgb(3 28 61 / .08);
  --head: "Bai Jamjuree", system-ui, sans-serif; --body: "IBM Plex Sans Thai Looped", system-ui, sans-serif;
  --shell: 1500px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; scroll-behavior: smooth; background: var(--ice); }
body { margin: 0; color: var(--ink); background: var(--ice); font: 400 16px/1.5 var(--body); }
a { color: inherit; text-underline-offset: 3px; }
button, input, select { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
input, select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); padding: 9px 11px; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }
input[aria-invalid="true"] { border-color: var(--danger); background: #fff8f7; }
.shell { width: min(100%, var(--shell)); margin-inline: auto; padding-inline: clamp(18px, 3vw, 46px); }
.skip-link { position: fixed; z-index: 1000; top: 10px; left: 10px; padding: 9px 14px; background: var(--lime); color: var(--navy); transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.site-header { height: 72px; color: #fff; background: var(--navy); }
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.wordmark { color: #fff; font: 700 26px/1 var(--head); text-decoration: none; letter-spacing: -.03em; }
.site-header nav { display: flex; gap: clamp(18px, 3vw, 44px); }
.site-header nav a { color: rgb(255 255 255 / .88); font: 600 14px/1 var(--head); text-decoration: none; }
.site-header nav a:hover { color: var(--lime); }
.app-shell { padding-top: 34px; padding-bottom: 70px; }
.page-heading { max-width: 920px; margin-bottom: 24px; }
.page-heading h1 { margin: 0; font: 700 clamp(36px, 5vw, 64px)/.98 var(--head); letter-spacing: -.045em; }
.page-heading p { margin: 14px 0 0; color: var(--muted); font-size: 17px; }
.project-panel, .method-panel, .result-panel { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); }
.project-panel { padding: 22px; }
.project-panel h2, .method-panel h2, .result-panel h2, .methodology h2 { margin: 0; font: 700 23px/1.25 var(--head); }
.project-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr .8fr 1fr; gap: 16px; margin-top: 17px; }
.field { min-width: 0; }
.field span { display: block; margin-bottom: 6px; font: 600 13px/1.35 var(--head); }
.field small { display: block; min-height: 18px; margin-top: 4px; color: var(--muted); font-size: 11px; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; width: min(700px, 100%); gap: 5px; padding: 5px; margin: 22px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--ice-2); }
.mode-switch button { min-height: 48px; border: 0; border-radius: 7px; background: transparent; font: 700 15px/1.3 var(--head); }
.mode-switch button[aria-selected="true"] { background: var(--lime); box-shadow: 0 3px 12px rgb(3 28 61 / .08); }
.work-grid { display: grid; grid-template-columns: minmax(0, 1fr) 430px; align-items: start; gap: 18px; }
.method-panel { padding: 24px; min-height: 420px; }
.method-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.method-heading p { max-width: 780px; margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.method-heading a, .text-button { flex: 0 0 auto; color: var(--navy-2); font: 600 13px/1.4 var(--head); }
.text-button { border: 0; background: transparent; text-decoration: underline; text-underline-offset: 3px; }
.method-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.assumption-button { min-height: 38px; padding: 7px 12px; border: 1px solid #b5df00; border-radius: 7px; background: var(--lime-soft); font: 700 12px/1.3 var(--head); }
.benchmark-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mep-reference { margin-top: 22px; padding: 17px; border: 1px solid var(--line); border-radius: 10px; background: #fbfdff; }
.reference-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.reference-heading h3 { margin: 7px 0 0; font: 700 17px/1.3 var(--head); }
.reference-heading small { color: var(--muted); font-size: 11px; text-align: right; }
.mep-rate-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin-top: 14px; }
.mep-rate-grid span { padding: 8px; border-radius: 6px; background: var(--ice-2); color: var(--muted); font-size: 11px; text-align: center; }
.mep-rate-grid b { display: block; color: var(--ink); font: 600 11px/1.3 var(--head); }
.mep-reference p { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.evidence-badge { display: inline-block; margin-top: 5px; padding: 2px 6px; border-radius: 999px; font: 700 9px/1.4 var(--head); white-space: nowrap; }
.evidence-sourced { color: #174f14; background: #e7fbdc; }
.evidence-derived { color: #0a4a78; background: #e2f3ff; }
.evidence-user { color: #5c6570; background: #eef1f4; }
.scope-note { margin-top: 28px; padding: 18px; border-left: 4px solid var(--lime); background: var(--ice); }
.scope-note strong { font: 700 15px/1.3 var(--head); }
.scope-note p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.cost-table { width: 100%; min-width: 1040px; border-collapse: collapse; background: #fff; font-size: 12px; }
.cost-table th { padding: 11px 9px; background: #deeffb; text-align: left; font: 700 12px/1.35 var(--head); white-space: nowrap; }
.cost-table td { padding: 7px; border-top: 1px solid #d9e7f1; vertical-align: top; }
.cost-table td:first-child { width: 188px; }
.cost-table td:nth-child(2) { width: 105px; }
.cost-table td:nth-child(3) { width: 145px; }
.cost-table td:nth-child(4), .cost-table td:nth-child(5), .cost-table td:nth-child(6) { width: 108px; }
.cost-table td:nth-child(7) { min-width: 190px; }
.cost-table input, .cost-table select { min-height: 38px; padding: 7px 8px; font-size: 12px; }
.cost-table .category-input { font-weight: 600; }
.delete-row { min-width: 38px; min-height: 38px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--danger); }
.delete-row[disabled] { visibility: hidden; }
.table-help { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.result-panel { position: sticky; top: 18px; padding: 22px; }
.result-method { margin: 7px 0 17px; color: var(--muted); font-size: 13px; }
.result-table { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.result-row { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); align-items: center; }
.result-row > * { min-width: 0; padding: 10px 7px; border-right: 1px solid #d8e5ee; text-align: right; font-size: 11px; white-space: nowrap; }
.result-row output { font-size: 10px; font-variant-numeric: tabular-nums; }
.result-row > *:first-child { text-align: left; }
.result-row > *:last-child { border-right: 0; }
.result-row + .result-row { border-top: 1px solid #d8e5ee; }
.result-head { background: #deeffb; font: 700 11px/1.2 var(--head); }
.result-total { background: var(--lime-soft); }
.result-total > * { font-weight: 700; }
.result-label small { display: block; margin-top: 2px; color: var(--muted); font: 600 8px/1.2 var(--head); }
.result-meta { margin: 16px 0; }
.result-meta div { display: flex; justify-content: space-between; gap: 18px; padding: 7px 0; border-bottom: 1px solid #dfebf3; font-size: 12px; }
.result-meta dt { color: var(--muted); }
.result-meta dd { margin: 0; font-weight: 600; text-align: right; }
.primary-button { width: 100%; min-height: 50px; border: 1px solid #b5df00; border-radius: 8px; background: var(--lime); font: 700 18px/1 var(--head); }
.primary-button:hover { filter: brightness(.97); }
.secondary-actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: 10px; margin-top: 10px; }
.secondary-actions button { min-height: 44px; border: 1px solid var(--navy-2); border-radius: 7px; background: #fff; font: 600 13px/1.2 var(--head); }
.status { min-height: 23px; margin: 8px 0 0; color: var(--navy-2); font-size: 11px; text-align: center; }
.warning { margin-top: 18px; padding: 16px; border: 1px solid #f0dc77; border-radius: 9px; background: var(--warn); }
.warning strong { display: block; font: 700 15px/1.35 var(--head); }
.warning p { margin: 7px 0 0; color: #4f4b32; font-size: 12px; }
.methodology { margin-top: 24px; padding: 26px 0 0; border-top: 1px solid var(--line); }
.method-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-top: 18px; }
.method-columns strong { font: 700 15px/1.3 var(--head); }
.method-columns p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.source-line { margin: 22px 0 0; color: var(--muted); font-size: 12px; }
.site-footer { color: #fff; background: var(--navy); }
.site-footer .shell { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; font: 600 13px/1.4 var(--head); }
.site-footer a { color: #fff; }
@media (max-width: 1120px) {
  .project-grid { grid-template-columns: repeat(3, 1fr); }
  .field-wide { grid-column: span 2; }
  .work-grid { grid-template-columns: 1fr; }
  .result-panel { position: static; }
}
@media (max-width: 720px) {
  .site-header { height: 64px; }
  .site-header nav { gap: 15px; }
  .site-header nav a:nth-child(3) { display: none; }
  .app-shell { padding-top: 24px; padding-bottom: 46px; }
  .page-heading h1 { font-size: clamp(34px, 12vw, 50px); }
  .page-heading p { font-size: 14px; }
  .project-panel, .method-panel, .result-panel { border-radius: 10px; padding: 18px; }
  .project-grid, .benchmark-grid, .method-columns { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .mode-switch { width: 100%; }
  .mode-switch button { font-size: 13px; }
  .method-heading, .reference-heading { flex-direction: column; }
  .method-actions { justify-content: flex-start; }
  .mep-rate-grid { grid-template-columns: repeat(2, 1fr); }
  .result-row { grid-template-columns: 1.25fr repeat(3, 1fr); }
  .result-row > * { padding: 9px 5px; font-size: 10px; }
  .site-footer .shell { align-items: flex-start; flex-direction: column; justify-content: center; padding-block: 18px; }
}
@media print {
  body { background: #fff; }
  .site-header, .page-heading p, .mode-switch, .secondary-actions, .primary-button, .status, .text-button, .site-footer { display: none !important; }
  .shell { width: 100%; max-width: none; padding: 0; }
  .app-shell { padding: 0; }
  .page-heading { margin: 0 0 14px; }
  .page-heading h1 { font-size: 28px; }
  .project-panel, .method-panel, .result-panel { box-shadow: none; break-inside: avoid; }
  .work-grid { display: block; }
  .workspace { margin-bottom: 16px; }
  .result-panel { position: static; }
  [hidden] { display: none !important; }
  .table-wrap { overflow: visible; }
  .cost-table { min-width: 0; font-size: 9px; }
  .cost-table input, .cost-table select { border: 0; padding: 2px; min-height: 0; font-size: 9px; appearance: none; }
}
