/* PC Import — คู่มือ (guide/) · ต่อยอดจาก ../css/app.css (ตัวแปรสี/ฟอนต์/topbar/card ใช้ของเดิม) */
:root { --toc-w: 240px; --content-w: 860px; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
body { line-height: 1.6; }

/* ─── โครง: TOC ซ้าย + เนื้อหาขวา ─── */
.guide { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px 16px 48px; display: grid; grid-template-columns: var(--toc-w) minmax(0, 1fr); gap: 28px; align-items: start; }
.toc { position: sticky; top: 16px; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 6px 14px 14px; max-height: calc(100vh - 32px); overflow-y: auto; }
.toc summary { list-style: none; cursor: default; font-weight: 800; font-size: 14px; color: var(--muted); letter-spacing: .02em; padding: 0 0 8px; }
.toc summary::-webkit-details-marker { display: none; }
.toc ol { list-style: none; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a { display: flex; gap: 8px; align-items: baseline; padding: 6px 8px; border-radius: 8px; font-size: 14px; color: var(--ink); line-height: 1.35; }
.toc a::before { content: counter(toc); flex: none; min-width: 20px; height: 20px; border-radius: 6px; background: var(--bg); color: var(--muted); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.toc > ol > li:first-child { counter-increment: none; }   /* หัวข้อ "คืออะไร" ไม่มีเลข → เลขในสารบัญตรงกับเลขหัวข้อ 1–10 */
.toc > ol > li:first-child > a::before { content: '•'; }
.toc a:hover { background: var(--bg); }
.toc a.is-active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.toc a.is-active::before { background: var(--brand); color: #fff; }
.toc .toc-sub a { font-size: 13px; padding: 3px 8px 3px 36px; color: var(--muted); }
.toc .toc-sub a::before { display: none; }
.toc .toc-sub a.is-active { color: var(--brand); background: transparent; }

.content { min-width: 0; max-width: var(--content-w); display: flex; flex-direction: column; gap: 18px; }
.content > section { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 22px 24px; }
.content h1 { font-size: 26px; font-weight: 800; line-height: 1.25; color: var(--navy); }
.content h2 { font-size: 21px; font-weight: 800; color: var(--navy); display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.content h2 .n { flex: none; width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; }
.content h3 { font-size: 16px; font-weight: 800; margin: 18px 0 6px; }
.content p { margin: 6px 0; font-size: 15px; }
.content ul, .content ol { margin: 6px 0 6px 22px; font-size: 15px; }
.content li { margin: 3px 0; }
.lead { font-size: 16px; color: var(--muted); margin-top: 6px; }
.who { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.who span { background: var(--bg); border-radius: 999px; padding: 6px 14px; font-size: 14px; }
.who b { color: var(--navy); }

/* ทำอะไร → เห็นอะไร */
.step { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; margin: 10px 0; }
.step .ic { font-size: 16px; line-height: 1.6; text-align: center; }
.step b.do { color: var(--navy); }
.see { display: block; margin-top: 2px; font-size: 14px; color: var(--muted); }
.see::before { content: '→ เห็น: '; font-weight: 700; color: var(--done); }

/* กล่องเน้น */
.tip, .warnbox, .badbox { border-radius: 10px; padding: 10px 14px; font-size: 14px; margin: 10px 0; border-left: 4px solid; }
.tip { background: var(--brand-soft); border-color: var(--brand); }
.warnbox { background: var(--warn-soft); border-color: var(--warn); }
.badbox { background: var(--bad-soft); border-color: var(--bad); }
.tip b, .warnbox b, .badbox b { display: block; margin-bottom: 2px; }
.badbox b { color: var(--bad); }
.warnbox b { color: var(--warn); }
.tip b { color: var(--brand); }

/* วงกลมเลข callout ①②③ ในข้อความ */
.c { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--bad); color: #fff; font-size: 12px; font-weight: 800; vertical-align: -3px; margin: 0 2px; font-family: 'Sarabun', sans-serif; }

/* ปุ่ม/ป้ายจำลองจากแอป (ให้คนอ่านจำหน้าตาได้) */
.ui { display: inline-block; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 1px 9px; font-size: .92em; font-weight: 700; white-space: nowrap; box-shadow: 0 1px 0 rgba(0,0,0,.04); }
.ui.brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.ui.done { background: var(--done-soft); border-color: var(--done); color: var(--done); }
.ui.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.ui.bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.ditto { font-size: 1.25em; font-weight: 800; color: var(--brand); line-height: 1; }
.qm { color: var(--bad); font-weight: 800; }

/* ตาราง */
.gt { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0; }
.gt th, .gt td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.gt th { background: var(--bg); font-weight: 700; font-size: 13px; }
.gt td.c2 { text-align: center; }
.gt .mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.gt-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.gt-wrap .gt { min-width: 520px; }
.cell { display: inline-block; background: var(--navy); color: #fff; border-radius: 6px; padding: 0 8px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; font-weight: 700; }

/* ภาพหน้าจอ */
figure.shot { margin: 14px 0 4px; }
.shot .frame { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.shot img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.shot img.zoom:hover { filter: brightness(.97); }
/* ป้ายชื่อคอลัมน์บนภาพชีตจริง — สลับสูง/ต่ำสองแถว (top 10.5% / 15.5%) เพราะคอลัมน์ J K L แคบกว่าป้าย */
.shot .tag { position: absolute; transform: translateY(-100%); background: var(--brand); color: #fff; font-size: 10px; font-weight: 700; line-height: 1.2; padding: 1px 4px; border-radius: 4px; white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,.25); pointer-events: none; border: 1px solid #fff; }
.shot .tag::after { content: ''; position: absolute; left: 5px; bottom: -5px; border: 4px solid transparent; border-top-color: var(--brand); border-bottom: 0; }
.shot .tag.b { left: auto; }
figcaption { margin-top: 8px; font-size: 14px; color: var(--muted); line-height: 1.55; }
figcaption b { color: var(--ink); }
.shot.narrow .frame { max-width: 560px; }
.shot.badge .frame { max-width: 720px; }

/* FAQ */
.faq details { border: 1px solid var(--line); border-radius: 10px; padding: 0; margin: 8px 0; background: #fff; }
.faq summary { cursor: pointer; padding: 11px 14px; font-weight: 700; font-size: 15px; list-style: none; display: flex; gap: 10px; align-items: flex-start; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: '＋'; color: var(--brand); font-weight: 800; flex: none; }
.faq details[open] summary::before { content: '－'; }
.faq details[open] summary { border-bottom: 1px solid var(--line); }
.faq .a { padding: 10px 14px 14px 38px; font-size: 14px; }
.faq .a p { margin: 4px 0; font-size: 14px; }

/* ท้าย */
.end .links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* lightbox */
.lb { position: fixed; inset: 0; background: rgba(15,22,35,.92); display: flex; align-items: center; justify-content: center; z-index: 50; cursor: zoom-out; padding: 2.5vh 2.5vw; }
.lb img { max-width: 95vw; max-height: 95vh; width: auto; height: auto; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.5); background: #fff; }
.lb .lb-x { position: absolute; top: 12px; right: 16px; color: #fff; font-size: 28px; line-height: 1; background: transparent; border: 0; cursor: pointer; opacity: .8; font-family: inherit; }
.lb .lb-x:hover { opacity: 1; }
body.lb-open { overflow: hidden; }

/* กลับขึ้นบน (มือถือ) */
.totop { position: fixed; right: 14px; bottom: 18px; width: 42px; height: 42px; border-radius: 50%; background: var(--navy); color: #fff; border: 0; font-size: 20px; box-shadow: var(--shadow); cursor: pointer; display: none; z-index: 8; font-family: inherit; }
.totop.is-show { display: inline-flex; align-items: center; justify-content: center; }

/* ─── จอแคบ: TOC พับอยู่เหนือเนื้อหา ─── */
@media (max-width: 900px) {
  .guide { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px 16px 72px; }
  .toc { position: static; max-height: none; padding: 10px 14px; }
  .toc summary { cursor: pointer; padding: 4px 0; display: flex; justify-content: space-between; align-items: center; color: var(--ink); }
  .toc summary::after { content: '▾'; color: var(--muted); }
  .toc[open] summary::after { content: '▴'; }
  .toc ol { padding-top: 6px; }
  .content { max-width: none; }
  .content > section { padding: 16px; }
  .content h1 { font-size: 22px; }
  .content h2 { font-size: 18px; }
  .content p, .content ul, .content ol { font-size: 14px; }
  .step { grid-template-columns: 18px 1fr; gap: 8px; }
  .shot .tag { font-size: 9px; padding: 1px 4px; }
  .ui { white-space: normal; }   /* ป้ายปุ่มยาว ๆ ในข้อความห่อบรรทัดได้ ไม่ดันหน้ากว้าง */
  .gt-wrap .gt { min-width: 480px; }
}
@media (min-width: 901px) { .toc summary::after { display: none; } .toc[open] summary { pointer-events: none; } }

/* ─── พิมพ์ ─── */
@media print {
  .topbar, .toc, .totop, .foot, .lb, .noprint { display: none !important; }
  .guide { display: block; padding: 0; max-width: none; }
  .content { max-width: none; gap: 10px; }
  .content > section { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; padding: 12px 14px; }
  .faq details { break-inside: avoid; }
  .faq details:not([open]) .a { display: block; }
  .faq summary::before { content: 'ถาม: '; }
  .shot img { max-height: 420px; width: auto; max-width: 100%; }
  a[href^="http"]::after { content: ' (' attr(href) ')'; font-size: 11px; color: #666; }
}
