/* ระบบตัวอย่าง Thai Doc Extractor — สีและรูปทรงตามหน้าจอจริง (Tailwind slate/blue/emerald/amber) เขียนเป็น CSS ของตัวเอง ไม่โหลดจากภายนอก */
@font-face { font-family: "Prompt"; src: url("../fonts/prompt-light.woff") format("woff"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Prompt"; src: url("../fonts/prompt-regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Prompt"; src: url("../fonts/prompt-medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Prompt"; src: url("../fonts/prompt-semibold.woff") format("woff"); font-weight: 600; font-display: swap; }

:root {
  --brand: #1d4ed8; --brand-dark: #1e40af; --brand-soft: #eff6ff;
  --bg: #f8fafc; --card: #fff; --line: #e2e8f0; --line-2: #cbd5e1;
  --ink: #0f172a; --text: #334155; --muted: #64748b; --faint: #94a3b8;
  --ok-bg: #def7ec; --ok: #03543f; --rv-bg: #fdf6b2; --rv: #723b13; --run-bg: #e1effe; --run: #1e429f;
  --fail-bg: #fde8e8; --fail: #9b1c1c; --unk-bg: #e5e7eb; --unk: #374151;
  --amber: #b45309; --amber-line: #fbbf24; --amber-soft: #fefce8; --excel: #059669; --excel-dark: #047857;
  --yellow-cell: #fff3b0;
  --radius: 12px; --shadow: 0 1px 2px rgba(15, 23, 42, .06);
  --sx-dark: #002c2f; --sx-yellow: #fdd301;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Prompt", system-ui, sans-serif; font-weight: 400; color: var(--text); background: var(--bg); line-height: 1.6; font-size: 15px; min-height: 100vh; display: flex; flex-direction: column; }
img, svg { max-width: 100%; }
a { color: var(--brand); }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.3; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: clamp(1.35rem, 1.05rem + 1.3vw, 1.85rem); }
h2 { font-size: 1.12rem; }
p { margin: 0 0 .8em; }
svg { width: 1.1em; height: 1.1em; flex: 0 0 auto; vertical-align: -.18em; }
.noscript { padding: 2rem; text-align: center; }
.hint { color: var(--muted); font-size: .84rem; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; }

/* ---------- แถบระบบตัวอย่าง (แบบเดียวกับเดโม่ booking) ---------- */
.demo-bar { position: sticky; top: 0; z-index: 50; background: var(--sx-dark); color: #fff; font-size: .82rem; }
.demo-bar__in { max-width: 1280px; margin: 0 auto; padding: .45rem 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem; }
.demo-bar__note { display: flex; align-items: center; gap: .45rem; flex: 1 1 260px; min-width: 0; }
.demo-bar__badge { background: var(--sx-yellow); color: var(--sx-dark); font-weight: 600; border-radius: 999px; padding: .05rem .55rem; white-space: nowrap; }
.demo-bar__short { display: none; }
.demo-bar__links { display: flex; gap: .8rem; align-items: center; }
.demo-bar__links a, .demo-bar__links button { color: #fff; background: none; border: 0; padding: 0; cursor: pointer; font-size: .8rem; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- หัวเว็บ (nav ของโปรแกรมจริง) ---------- */
.nav { background: #fff; border-bottom: 1px solid var(--line); }
.nav__in { max-width: 1280px; margin: 0 auto; padding: .7rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: .6rem 1.2rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; font-size: 1.08rem; color: var(--brand); text-decoration: none; }
.brand svg { width: 1.35em; height: 1.35em; }
.nav__links { display: flex; gap: 1.1rem; flex-wrap: wrap; font-size: .92rem; }
.nav__links a { color: var(--muted); text-decoration: none; }
.nav__links a:hover { color: var(--brand); }
.nav__links a.is-on { color: var(--brand); font-weight: 600; }

/* ---------- โครงหน้า ---------- */
.main { flex: 1 0 auto; }
.container { max-width: 1024px; margin: 0 auto; padding: 1.4rem 1rem 2.5rem; }
.container--wide { max-width: 1280px; }
.container--narrow { max-width: 896px; }
.page-head { margin-bottom: 1rem; }
.lead { color: var(--muted); max-width: 46rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.3rem 1.4rem; margin-bottom: 1.2rem; min-width: 0; }
.card--flush { padding: 1rem; }
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.card__head h2 { margin: 0; }
.sub { font-size: .88rem; color: var(--muted); font-weight: 500; margin: 0 0 .7rem; }

/* ---------- ป้ายสถานะ (styles.css ของโปรแกรมจริง) ---------- */
.badge { display: inline-block; padding: 1px 10px; border-radius: 9999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.7; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-review { background: var(--rv-bg); color: var(--rv); }
.badge-run { background: var(--run-bg); color: var(--run); }
.badge-fail { background: var(--fail-bg); color: var(--fail); }
.badge-unknown { background: var(--unk-bg); color: var(--unk); }
.pill { display: inline-block; font-size: 11.5px; border-radius: 999px; padding: 0 8px; white-space: nowrap; font-weight: 500; }
.pill--ok { background: var(--ok-bg); color: var(--ok); }
.pill--warn { background: var(--rv-bg); color: var(--rv); }

/* ---------- ปุ่ม ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border-radius: 9px; padding: .62rem 1.15rem; font-weight: 600; font-size: .93rem; border: 1px solid transparent; cursor: pointer; text-decoration: none; line-height: 1.3; text-align: center; }
.btn--sm { padding: .42rem .8rem; font-size: .85rem; font-weight: 500; }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }
.btn--excel { background: var(--excel); color: #fff; }
.btn--excel:hover { background: var(--excel-dark); }
.btn--light { background: #fff; color: var(--text); border-color: var(--line-2); }
.btn--light:hover { border-color: var(--brand); color: var(--brand); }
.actions { display: flex; gap: .7rem; flex-wrap: wrap; margin: 1.4rem 0 .4rem; }

/* ---------- กล่องคำอธิบาย ---------- */
.demo-note { display: flex; gap: .65rem; align-items: flex-start; background: var(--brand-soft); border: 1px solid #bfdbfe; color: #1e3a8a; border-radius: 10px; padding: .75rem 1rem; margin-bottom: 1rem; font-size: .92rem; }
.demo-note svg { margin-top: .2rem; }
.demo-note--ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.promise { border-left: 4px solid var(--excel); background: #fff; border-radius: 0 10px 10px 0; padding: .8rem 1.1rem; margin-bottom: 1.2rem; box-shadow: var(--shadow); }
.promise__k { font-size: .78rem; font-weight: 600; color: var(--excel-dark); letter-spacing: .02em; }
.promise p { margin: .15rem 0 0; color: var(--ink); }
.locked { display: flex; gap: .55rem; align-items: flex-start; background: #f1f5f9; border: 1px dashed var(--line-2); border-radius: 10px; padding: .6rem .85rem; color: var(--muted); font-size: .86rem; margin: .8rem 0; }
.locked svg { margin-top: .2rem; }
.alert { display: flex; gap: .65rem; align-items: flex-start; border-radius: 10px; padding: .85rem 1rem; margin-bottom: 1.2rem; font-size: .92rem; }
.alert svg { margin-top: .2rem; }
.alert--warn { background: var(--amber-soft); border: 1px solid #fde68a; color: #78350f; }
.alert--ok { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }

/* ---------- หน้าหลัก ---------- */
.dropzone { border: 2px dashed var(--line-2); border-radius: 12px; padding: 1.6rem 1rem; text-align: center; color: var(--muted); background: #fbfdff; }
.dropzone svg { width: 2.2rem; height: 2.2rem; color: var(--faint); }
.dropzone p { margin: .3rem 0 0; }
.dropzone b { color: var(--brand); font-weight: 600; }
.opts { display: flex; flex-wrap: wrap; gap: .5rem 1.6rem; font-size: .88rem; margin-top: .6rem; }
.opt { display: flex; align-items: flex-start; gap: .5rem; color: var(--muted); }
.opt input { width: 1rem; height: 1rem; margin-top: .25rem; flex: 0 0 auto; }
.job { border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.job__head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.job__title { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; min-width: 0; }
.job__file { font-weight: 600; color: var(--ink); word-break: break-all; }
.job__actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.bar { margin-top: .7rem; height: 8px; background: #f1f5f9; border-radius: 99px; overflow: hidden; }
.bar__fill { height: 100%; background: var(--brand); width: 0; transition: width .5s ease; }
.job__meta { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.steps-now { font-size: .82rem; color: var(--run); margin-top: .25rem; }
.job__docs { margin-top: .5rem; }
.docrow { display: flex; align-items: flex-start; gap: .55rem; padding: .55rem 0; border-top: 1px solid #f1f5f9; font-size: .92rem; }
.docrow__page { color: var(--faint); flex: 0 0 3.1rem; line-height: 1.9; }
.docrow__main { flex: 1 1 auto; min-width: 0; }
.docrow__line { display: flex; align-items: center; flex-wrap: wrap; gap: .2rem .55rem; }
.docrow__type { font-weight: 500; color: var(--ink); }
.docrow__id { color: var(--faint); font-weight: 400; font-size: .8rem; }
.docrow__cap { color: var(--faint); font-size: .78rem; }
.docrow--wait { color: var(--faint); }
.link-review { color: var(--amber); font-weight: 600; }
.link-muted { color: var(--muted); }

/* ---------- หน้าตรวจ ---------- */
.back { display: inline-flex; align-items: center; gap: .25rem; color: var(--muted); text-decoration: none; font-size: .88rem; margin-bottom: .6rem; }
.back:hover { color: var(--brand); }
.meta { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .6rem; margin-bottom: .8rem; }
.meta h1 { margin: 0 .3rem 0 0; font-size: clamp(1.2rem, 1rem + 1vw, 1.55rem); }
.review { display: grid; grid-template-columns: 1fr; gap: 1.2rem; align-items: start; }
.review__img { margin: 0; }
.imgbox { display: block; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #f1f5f9; cursor: zoom-in; }
.imgbox img { display: block; width: 100%; height: auto; }
.zoomlink { display: inline-flex; align-items: center; gap: .3rem; margin-top: .5rem; text-decoration: none; }
.review__fields { margin: 0; }
.fields { display: grid; gap: .7rem; }
.field { border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; min-width: 0; }
.field--review { background: var(--amber-soft); border-color: #facc15; }
.field__top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.field__top label { font-size: .9rem; font-weight: 500; color: var(--ink); min-width: 0; }
.field__key { color: var(--faint); font-size: .74rem; font-weight: 400; }
.input { display: block; width: 100%; margin-top: .35rem; border: 1px solid var(--line); border-radius: 7px; padding: .45rem .7rem; font-size: .95rem; background: #fff; min-width: 0; }
.input:focus { outline: 2px solid #93c5fd; outline-offset: 0; border-color: var(--brand); }
.input--review { border-color: var(--amber-line); }
.input[readonly], select.input:disabled { background: #f8fafc; color: var(--text); }
.reason { display: flex; gap: .35rem; align-items: flex-start; font-size: .82rem; color: var(--amber); margin-top: .35rem; }
.reason svg { margin-top: .2rem; }
.pick { font-size: .84rem; color: var(--text); margin-top: .4rem; display: flex; flex-wrap: wrap; gap: .35rem .5rem; align-items: center; }
.pick button, .demo-hint__ans button { background: #fff; border: 1px solid #93c5fd; color: var(--brand); border-radius: 7px; padding: .2rem .6rem; cursor: pointer; font-size: .84rem; }
.pick button:hover, .demo-hint__ans button:hover { background: var(--brand-soft); }
.demo-hint { margin-top: .4rem; font-size: .8rem; }
.demo-hint__btn { background: none; border: 0; padding: 0; color: #0f766e; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-size: .8rem; }
.demo-hint__ans { color: #0f766e; }
.src { font-size: .78rem; color: var(--faint); margin-top: .3rem; word-break: break-word; }
.items-h { font-size: .88rem; color: var(--muted); font-weight: 500; margin: 1.2rem 0 .5rem; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1.2rem; font-size: .9rem; }

/* ---------- ตาราง ---------- */
.table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { border-collapse: collapse; width: 100%; font-size: .84rem; }
.tbl th, .tbl td { border: 1px solid var(--line); padding: .35rem .55rem; text-align: left; vertical-align: top; }
.tbl th { background: #f8fafc; font-weight: 600; color: var(--ink); }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl--xl { width: auto; min-width: 100%; font-size: .8rem; }
.tbl--xl th, .tbl--xl td { white-space: nowrap; }
.tbl .cell-yellow { background: var(--yellow-cell); }

/* ---------- หน้า Excel ---------- */
.radios { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin: .4rem 0 1rem; }
.radio { display: inline-flex; align-items: center; gap: .45rem; font-size: .93rem; cursor: pointer; }
.radio input { width: 1rem; height: 1rem; accent-color: var(--brand); }
.dl { display: flex; align-items: center; gap: .6rem 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.preview { display: grid; grid-template-columns: minmax(0, 1fr); gap: .9rem; }
.sheet { min-width: 0; }
.sheet__name { display: inline-block; font-size: .78rem; color: var(--muted); background: #f1f5f9; border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; padding: .1rem .6rem; }
.list { margin: 0 0 .5rem; padding-left: 1.2rem; }

/* ---------- ตั้งค่า ---------- */
.grid2 { display: grid; grid-template-columns: 1fr; gap: .8rem 1.2rem; }
.set { display: block; font-size: .88rem; }
.set span { color: var(--text); }
.set small { display: block; color: var(--faint); }
.dtype { border: 1px solid var(--line); border-radius: 10px; padding: .55rem .9rem; margin-bottom: .6rem; }
.dtype summary { cursor: pointer; font-weight: 500; color: var(--ink); }
.dtype[open] summary { margin-bottom: .6rem; }
.rules { font-size: .86rem; margin-top: .6rem; }
.rules ul { margin: .25rem 0 .4rem; padding-left: 1.2rem; }

/* ---------- ท้ายเว็บ ---------- */
.footer { background: #fff; border-top: 1px solid var(--line); font-size: .84rem; color: var(--muted); }
.footer__in { max-width: 1024px; margin: 0 auto; padding: 1.3rem 1rem 1rem; }
.footer__in b { color: var(--ink); font-weight: 600; }
.footer__in p { margin: .35rem 0; }
.footer__bar { border-top: 1px solid var(--line); margin-top: .9rem; padding-top: .7rem; font-size: .78rem; color: var(--faint); }
.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 60; background: var(--excel); color: #fff; padding: .75rem 1rem; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); font-size: .9rem; max-width: calc(100vw - 2rem); }

@media (min-width: 640px) {
  .grid2 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 960px) {
  .review { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; }
  .review__img { position: sticky; top: 3.4rem; max-height: calc(100vh - 4.4rem); overflow: auto; }
}
@media (max-width: 959px) {
  .imgbox { max-width: 560px; margin: 0 auto; }
}
@media (max-width: 639px) {
  body { font-size: 14.5px; }
  .demo-bar { position: static; }
  .demo-bar__in { padding: .4rem .7rem; }
  .demo-bar__long { display: none; }
  .demo-bar__short { display: inline; }
  .demo-bar__note { flex: 1 1 100%; }
  .card { padding: 1rem; }
  .container { padding-top: 1rem; }
  .job { padding: .8rem; }
  .docrow__id { display: none; }
  .dropzone { padding: 1rem; }
  .job__actions { width: 100%; }
  .job__actions .btn { flex: 1 1 auto; }
  .actions .btn { flex: 1 1 auto; }
}
@media print { .demo-bar, .nav { display: none; } }
