:root {
  --bg: #f6f7f9; --card: #ffffff; --ink: #1f2937; --muted: #5b6472; --line: #e3e6eb;
  --brand: #0f6e5a; --brand-ink: #ffffff; --brand-soft: #e5f2ee;
  --warn: #9a5b00; --warn-soft: #fff4e0; --err: #b42318; --err-soft: #fdecea; --ok-soft: #e7f6ec;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 400 0.9062rem/1.6 "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: #0a5244; }
h1 { font-size: 1.35rem; font-weight: 700; margin: 0 0 4px; }
h2 { font-size: 1.05rem; font-weight: 700; margin: 0 0 12px; }
.muted, small, .hint { color: var(--muted); font-size: 0.8125rem; }

.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo { font-weight: 700; color: var(--ink); white-space: nowrap; }
.logo span { color: var(--brand); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { padding: 6px 10px; border-radius: 10px; color: var(--muted); white-space: nowrap; }
.nav a.on, .nav a:hover { background: var(--brand-soft); color: var(--brand); }
.who { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; color: var(--muted); }

main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 48px; }
.narrow { max-width: 720px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.two { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } }
.kpi .n { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.kpi.alert .n { color: var(--warn); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--brand);
  background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 600; padding: 8px 16px;
  border-radius: var(--radius); cursor: pointer; white-space: nowrap; }
.btn:hover { background: #0a5244; color: #fff; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.small { padding: 4px 10px; font-size: 0.8125rem; }
.btn.danger { background: var(--err); border-color: var(--err); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }

label { display: block; font-weight: 600; margin: 12px 0 4px; }
label .req { color: var(--err); }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #cfd4db;
  border-radius: 10px; padding: 9px 11px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { min-height: 90px; resize: vertical; }
.row { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: auto; margin-top: 5px; }
.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline input, .inline select { width: auto; flex: 1 1 160px; }
.hp { position: absolute; left: -9999px; }

.msg { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }
.msg.ok { background: var(--ok-soft); }
.msg.err { background: var(--err-soft); color: var(--err); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }
.msg ul { margin: 0; padding-left: 18px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8125rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }
@media (max-width: 640px) {
  table.stack thead { display: none; }
  table.stack tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.stack td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 0; text-align: right; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 0.8125rem; text-align: left; }
}

.tag { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 600;
  background: #eef0f3; color: var(--muted); white-space: nowrap; }
.tag.new { background: #e8f0fe; color: #1a56b0; }
.tag.contacted { background: #f3ecfd; color: #6b3fb5; }
.tag.docs { background: var(--warn-soft); color: var(--warn); }
.tag.approved { background: var(--ok-soft); color: #18794e; }
.tag.rejected { background: var(--err-soft); color: var(--err); }
.tag.late { background: var(--warn-soft); color: var(--warn); }

dl.info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.info dt { color: var(--muted); font-size: 0.8125rem; padding-top: 2px; }
dl.info dd { margin: 0; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border: 0; }
.qr svg { width: 168px; height: 168px; }
.code { font-family: ui-monospace, monospace; background: #f1f3f5; padding: 2px 6px; border-radius: 6px; word-break: break-all; }
.center { text-align: center; }
.public-head { text-align: center; margin: 8px 0 20px; }
.inline .check { flex: 0 0 auto; white-space: nowrap; }
td.zero { color: #b0b6bf; }
@media (max-width: 640px) {
  .top-in { gap: 8px; }
  .nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .who { margin-left: auto; }
  table.stack td.zero { display: none; }
}
details.edit { margin-top: 4px; }
details.edit summary { cursor: pointer; color: var(--brand); font-size: 0.8125rem; list-style: none; }
details.edit summary::-webkit-details-marker { display: none; }
details.edit[open] { background: #f9fafb; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; min-width: 240px; }
h3 { font-size: 0.9062rem; font-weight: 700; margin: 14px 0 6px; }
ol.flow { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); counter-reset: f; }
ol.flow li { border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 10px; padding: 10px 12px; background: #fbfcfd; }
ol.flow b { display: block; margin-bottom: 2px; }
ol.flow span { color: var(--muted); font-size: 0.8125rem; }
.mind-root { margin: 0 auto 18px; width: max-content; max-width: 100%; background: var(--brand); color: #fff; font-weight: 700; padding: 10px 22px; border-radius: 999px; text-align: center; }
.mind-branches { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); position: relative; }
.mind-branches section { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; border-top: 4px solid var(--brand); }
.mind-branches section:nth-child(2) { border-top-color: #9aa3ae; }
.mind-branches section:nth-child(3) { border-top-color: #1a56b0; }
.mind-branches section:nth-child(4) { border-top-color: #6b3fb5; }
.mind-branches section:nth-child(5) { border-top-color: #9a5b00; }
.mind-branches section:nth-child(6) { border-top-color: #18794e; }
.mind-branches section:nth-child(7) { border-top-color: #b42318; }
.mind-branches h4 { margin: 0 0 8px; font-size: 0.9062rem; }
.mind-branches ul { margin: 0; padding-left: 16px; }
.mind-branches li { margin: 0 0 6px; }
.mind-branches li small { display: block; color: var(--muted); font-size: 0.75rem; line-height: 1.4; }
.langs { display: flex; gap: 2px; font-size: 0.8125rem; }
.langs a { padding: 3px 7px; border-radius: 8px; color: var(--muted); }
.langs a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.langs.public { justify-content: center; padding: 12px 16px 0; }
:lang(hi) body, html[lang="hi"] body { font-family: "Noto Sans Devanagari", "IBM Plex Sans Thai", system-ui, sans-serif; }
html[lang="zh"] body { font-family: "Noto Sans SC", "IBM Plex Sans Thai", system-ui, sans-serif; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--err); color: #fff; font-size: 0.75rem; font-weight: 700; text-align: center; line-height: 18px; }
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th { text-align: center; }
.cal td { height: 104px; vertical-align: top; border: 1px solid var(--line); padding: 4px 5px; }
.cal td.out { background: #f9fafb; color: #b0b6bf; }
.cal td.today { background: var(--brand-soft); }
.cal .dn { font-size: 0.8125rem; font-weight: 600; }
.cal .ev { display: block; font-size: 0.75rem; line-height: 1.35; margin-top: 3px; padding: 2px 5px; border-radius: 6px; background: #eef2ff; color: #1a3d8f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .ev.done { text-decoration: line-through; opacity: .6; }
.cal .ev.doc { background: var(--warn-soft); color: var(--warn); }
@media (max-width: 640px) { .cal td { height: 64px; padding: 2px; } .cal .ev { font-size: 0.75rem; padding: 1px 3px; } .cal-wrap { overflow-x: auto; } .cal { min-width: 560px; } }
.rem li { margin-bottom: 6px; }
.ai-out h3 { margin-top: 16px; }
.ai-out ul { padding-left: 18px; }
.ai-out a { word-break: break-all; }
.doc-sheet { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 28px; max-width: 860px; margin: 0 auto; }
.doc-sheet .doc-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 14px; }
.doc-sheet .doc-title { font-size: 1.35rem; font-weight: 700; text-align: right; }
.doc-sheet table.lines th, .doc-sheet table.lines td { border-bottom: 1px solid var(--line); }
.doc-sheet .totals { margin-left: auto; max-width: 340px; }
.doc-sheet .terms h4 { margin: 12px 0 2px; font-size: 0.9062rem; }
.doc-sheet .terms p { margin: 0; color: #374151; }
.draft-mark { color: var(--err); font-weight: 700; border: 2px solid var(--err); padding: 2px 10px; border-radius: 8px; display: inline-block; }
@media print {
  .top, .langs, .no-print, .msg { display: none !important; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
  .doc-sheet { border: 0; padding: 0; max-width: none; }
}
.langs a { font-family: "IBM Plex Sans Thai", "Noto Sans SC", "Noto Sans Devanagari", system-ui, sans-serif; }
ul.rem { list-style: none; padding: 0; margin: 0; }
ul.rem form.inline { flex-wrap: nowrap; align-items: flex-start; }
ul.rem form.inline .btn { flex: 0 0 auto; }
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; padding: 6px 10px; border-radius: 10px; color: var(--muted); white-space: nowrap; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu[open] > summary, details.menu.on > summary { background: var(--brand-soft); color: var(--brand); }
details.menu .menu-items { position: absolute; z-index: 10; top: 100%; left: 0; min-width: 200px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
details.menu .menu-items a { display: block; }
@media (max-width: 640px) { details.menu .menu-items { position: fixed; left: 16px; right: 16px; top: auto; } }
