/* =============================================================================
   คู่มือการใช้งาน (/manual) — ชุดสีและตัวอักษรเดียวกับหน้าเว็บสาธารณะ (landing.css): Sarabun ส้ม #ff8800 / #b95900
   โหมดอ่าน: เนื้อหากว้างไม่เกินราว 72 ตัวอักษร ภาพหน้าจอมีกรอบบาง คำบรรยายใต้ภาพ · พิมพ์/PDF: หน้าปก สารบัญ ขึ้นหน้าใหม่ทุกหัวข้อ
   ========================================================================== */
:root {
  --brand: #ff8800;
  --brand-600: #b95900;
  --brand-700: #a85300;
  --brand-soft: #fff4e6;
  --ink: #1d2128;
  --ink-2: #4b5260;
  --muted: #667085;
  --line: #e7e9ee;
  --line-2: #d4d8de;
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --green: #15803d;
  --green-soft: #e7f6ee;
  --amber: #92400e;
  --amber-soft: #fff7e6;
  --blue: #1d4ed8;
  --blue-soft: #eef3ff;
  --radius: 14px;
  --header-h: 64px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Sarabun', system-ui, sans-serif; font-size: 17px; line-height: 1.75; -webkit-font-smoothing: antialiased; }
::selection { background: var(--brand-soft); color: var(--brand-700); }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--brand-600); text-underline-offset: 3px; }
[hidden] { display: none !important; }
.mn-i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 2px; border-radius: 6px; }

/* หัวหน้า */
.mn-header { position: sticky; top: 0; z-index: 30; height: var(--header-h); background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--line); backdrop-filter: saturate(1.4) blur(6px); }
.mn-header-in { max-width: 1280px; height: 100%; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 16px; }
.mn-brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.mn-word { font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: #2b2d42; }
.mn-word b { color: var(--brand); font-weight: 800; }
.mn-tag { font-size: 14px; font-weight: 700; color: var(--brand-600); }
.mn-search { position: relative; flex: 1; max-width: 520px; margin-left: auto; display: flex; align-items: center; }
.mn-search > .mn-i { position: absolute; left: 13px; color: var(--muted); }
.mn-search input { width: 100%; height: 44px; padding: 0 14px 0 40px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg-soft); font: inherit; font-size: 15.5px; color: var(--ink); }
.mn-search input:focus { outline: none; border-color: var(--brand-600); background: #fff; box-shadow: 0 0 0 3px rgba(255, 136, 0, .16); }
.mn-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; max-height: 60vh; overflow-y: auto; padding: 6px; background: #fff; border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 16px 40px rgba(29, 33, 40, .14); }
.mn-results a { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.mn-results a:hover, .mn-results a.is-active { background: var(--brand-soft); }
.mn-results b { font-size: 15px; font-weight: 700; }
.mn-results small { font-size: 13px; color: var(--muted); line-height: 1.5; }
.mn-res-empty { padding: 10px; color: var(--muted); font-size: 14.5px; }
.mn-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; color: var(--ink); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.mn-btn:hover { border-color: var(--brand-600); color: var(--brand-600); }
.mn-btn.is-primary { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.mn-btn.is-primary:hover { background: var(--brand-700); color: #fff; }
.mn-btn.is-ghost { min-height: 38px; padding: 0 12px; font-size: 14px; font-weight: 600; color: var(--ink-2); }

/* โครงหน้า */
.mn-layout { max-width: 1280px; margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 48px; }
.mn-toc { position: sticky; top: var(--header-h); align-self: start; max-height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 24px 0 40px; }
.mn-toc-box > summary { display: none; }
.mn-toc-group { margin-bottom: 18px; }
.mn-toc-group > p { margin-bottom: 4px; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.mn-toc ol { list-style: none; margin: 0; padding: 0; }
.mn-toc li a { display: flex; gap: 8px; padding: 6px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 15px; line-height: 1.45; }
.mn-toc li a span { min-width: 18px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mn-toc li a:hover { background: var(--bg-soft); color: var(--ink); }
.mn-toc li.is-current > a { background: var(--brand-soft); color: var(--brand-700); font-weight: 700; }
.mn-toc-sub { display: none; padding-left: 26px !important; }
.mn-toc li.is-current .mn-toc-sub { display: block; }
.mn-toc-sub a { font-size: 14px !important; padding: 4px 10px !important; }

.mn-main { min-width: 0; padding: 28px 0 120px; }
.mn-intro { max-width: 760px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.mn-intro h1 { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; }
.mn-intro p { margin-top: 10px; color: var(--ink-2); font-size: 17.5px; }
.mn-intro .mn-updated { font-size: 14px; color: var(--muted); }
.mn-loading { padding: 40px 0; color: var(--muted); }

/* หัวข้อ */
.mn-sec { max-width: 760px; padding: 44px 0 12px; border-bottom: 1px solid var(--line); }
.mn-sec-head { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 4px 16px; margin-bottom: 18px; }
.mn-sec-group { grid-column: 1; font-size: 14px; font-weight: 700; color: var(--brand-600); }
.mn-sec-title { grid-column: 1; display: flex; align-items: baseline; gap: 12px; font-size: 28px; font-weight: 800; letter-spacing: -.015em; line-height: 1.3; }
.mn-sec-num { font-size: 20px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mn-print-one { grid-column: 2; grid-row: 1 / span 2; align-self: center; }

/* เนื้อหา */
.mn-body { color: var(--ink); }
.mn-body > * + * { margin-top: 14px; }
.mn-body h2 { margin-top: 36px; font-size: 22px; font-weight: 800; line-height: 1.35; }
.mn-body h3 { margin-top: 26px; font-size: 18.5px; font-weight: 700; line-height: 1.4; }
.mn-body p, .mn-body li { max-width: 72ch; }
.mn-body ul, .mn-body ol { padding-left: 1.4em; }
.mn-body li + li { margin-top: 6px; }
.mn-body ol > li::marker { font-weight: 700; color: var(--brand-600); }
.mn-body strong { font-weight: 700; }
.mn-body code { padding: 1px 6px; border-radius: 6px; background: var(--bg-soft); border: 1px solid var(--line); font-size: .9em; }
.mn-body kbd { padding: 1px 7px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; background: #fff; font: inherit; font-size: .88em; font-weight: 700; }
.mn-body hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
.mn-table { overflow-x: auto; margin-top: 14px; }
.mn-body table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.mn-body th, .mn-body td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.mn-body th { font-weight: 700; background: var(--bg-soft); }

/* ภาพหน้าจอ */
.mn-fig { margin: 20px 0 8px; }
.mn-fig-zoom { display: block; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; background: var(--bg-soft); box-shadow: 0 8px 24px rgba(29, 33, 40, .07); }
.mn-fig img { display: block; width: 100%; height: auto; }
.mn-fig figcaption { margin-top: 8px; font-size: 14.5px; color: var(--muted); line-height: 1.55; }
.mn-fig.is-mobile { max-width: 300px; }
.mn-figs { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.mn-figs .mn-fig { flex: 0 1 260px; margin-top: 12px; }
.mn-fig.is-missing .mn-fig-zoom { min-height: 120px; display: grid; place-items: center; }
.mn-fig.is-missing img { display: none; }
.mn-fig.is-missing .mn-fig-zoom::after { content: 'ภาพประกอบกำลังจัดทำ'; color: var(--muted); font-size: 14px; }

/* กล่องเน้น */
.mn-call { position: relative; margin: 18px 0; padding: 12px 16px 12px 46px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); }
.mn-call > p { margin: 0; }
.mn-call-i { position: absolute; left: 15px; top: 15px; }
.mn-call.is-tip { background: var(--green-soft); border-color: #bfe5cf; }
.mn-call.is-tip .mn-call-i { color: var(--green); }
.mn-call.is-warn { background: var(--amber-soft); border-color: #f5d7a1; }
.mn-call.is-warn .mn-call-i { color: var(--amber); }
.mn-call.is-note { background: var(--blue-soft); border-color: #cddbff; }
.mn-call.is-note .mn-call-i { color: var(--blue); }
blockquote:not(.mn-call) { margin: 16px 0; padding: 10px 14px; border-radius: 10px; background: var(--bg-soft); color: var(--ink-2); }

.mn-top { position: fixed; right: 20px; bottom: 20px; z-index: 20; width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 50%; background: #fff; color: var(--ink); box-shadow: 0 8px 22px rgba(29, 33, 40, .12); }
.mn-cover { display: none; }

@media (max-width: 900px) {
  :root { --header-h: 60px; }
  /* มือถือมีแถบสารบัญค้างใต้หัว (สูงราว 65px) → เว้นขอบบนให้พ้นทั้งสองแถบ ไม่ให้ชื่อหัวข้อที่ลิงก์ไปถูกบัง */
  html { scroll-padding-top: calc(var(--header-h) + 84px); }
  .mn-header-in { padding: 0 16px; gap: 10px; }
  .mn-tag { display: none; }
  .mn-btn span { display: none; }
  .mn-btn.is-primary { padding: 0 12px; }
  .mn-layout { grid-template-columns: 1fr; gap: 0; padding: 0 16px; }
  .mn-toc { position: sticky; top: var(--header-h); z-index: 10; max-height: none; overflow: visible; padding: 10px 0; background: #fff; border-bottom: 1px solid var(--line); margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .mn-toc-box > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 700; cursor: pointer; list-style: none; }
  .mn-toc-box > summary::-webkit-details-marker { display: none; }
  .mn-toc-box[open] .mn-toc-list { max-height: 65vh; overflow-y: auto; padding: 4px 0 8px; }
  .mn-intro h1 { font-size: 27px; }
  .mn-sec { padding-top: 34px; }
  .mn-sec-title { font-size: 23px; }
  .mn-print-one { display: none; }
  .mn-body { font-size: 16.5px; }
}
@media (max-width: 480px) {
  .mn-search input { font-size: 16px; }
  .mn-word { font-size: 19px; }
  .mn-fig.is-mobile, .mn-figs .mn-fig { max-width: 100%; flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- พิมพ์ / บันทึกเป็น PDF ---------- */
@page { size: A4; margin: 16mm 14mm 18mm; }
@media print {
  body { font-size: 11.5pt; line-height: 1.6; }
  .mn-header, .mn-toc, .mn-top, .mn-intro, .mn-print-one { display: none !important; }
  .mn-layout { display: block; max-width: none; padding: 0; }
  .mn-main { padding: 0; }
  .mn-cover { display: flex; flex-direction: column; justify-content: center; min-height: 240mm; break-after: page; }
  .mn-word.is-big { font-size: 40pt; }
  .mn-cover-title { margin-top: 8mm; font-size: 30pt; font-weight: 800; }
  .mn-cover-sub { margin-top: 4mm; font-size: 13pt; color: var(--ink-2); max-width: 140mm; }
  .mn-cover-date { margin-top: 3mm; color: var(--muted); }
  .mn-print-toc { margin-top: 14mm; columns: 2; column-gap: 10mm; font-size: 11pt; }
  .mn-print-toc h2 { column-span: all; font-size: 15pt; margin-bottom: 3mm; }
  .mn-print-toc ol { list-style: none; padding: 0; margin: 0 0 3mm; }
  .mn-ptoc-g { font-weight: 700; color: var(--brand-600); margin-top: 2mm; }
  .mn-sec { max-width: none; padding: 0; border: 0; break-before: page; }
  .mn-sec-title { font-size: 20pt; }
  .mn-body h2 { font-size: 15pt; break-after: avoid; }
  .mn-body h3 { font-size: 13pt; break-after: avoid; }
  .mn-fig { break-inside: avoid; }
  .mn-fig-zoom { box-shadow: none; }
  .mn-fig img { max-height: 150mm; width: auto; max-width: 100%; margin: 0 auto; }
  .mn-call { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  /* พิมพ์เฉพาะหัวข้อ */
  body[data-only]:not([data-only=""]) .mn-cover { display: none; }
  body[data-only]:not([data-only=""]) .mn-sec { display: none; }
  body[data-only]:not([data-only=""]) .mn-sec.is-print-only { display: block; break-before: auto; }
}
