/* PD2 Digital Checklist — tablet-first UI (touch target ≥ 44px) */
:root {
  --bg: #f2f4f7; --card: #ffffff; --ink: #14202e; --muted: #5d6b7a; --line: #d7dde5;
  --navy: #0f2742; --navy2: #1b3a5e; --pri: #1565c0; --pri-ink: #fff;
  --ok: #1b7f3b; --ok-bg: #e5f5ea; --bad: #c62828; --bad-bg: #fdecec; --warn: #9a6200; --warn-bg: #fff4dc;
  --info-bg: #e8f1fc; --na: #6b7280; --pick: #1565c0; --env: #2e7d32; --safe: #c62828;
  --r: 12px; --shadow: 0 1px 2px rgba(15, 39, 66, .06), 0 4px 14px rgba(15, 39, 66, .06);
  font-family: 'Sarabun', 'Leelawadee UI', 'Leelawadee', 'Tahoma', 'Noto Sans Thai', sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 17px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea {
  min-height: 46px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(21, 101, 192, .25); border-color: var(--pri); }
input:disabled, select:disabled, textarea:disabled { background: #f5f6f8; color: var(--ink); opacity: 1; }
label { display: block; font-weight: 600; margin: 10px 0; }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; }
label.chk { display: inline-flex; gap: 8px; align-items: center; font-weight: 400; margin: 6px 16px 6px 0; }
label.chk input { width: 22px; height: 22px; }
.muted { color: var(--muted); } .fine { color: var(--muted); font-size: 13px; text-align: center; margin: 6px 0; }
small { font-size: .82em; }
code { font-size: 12px; }

/* buttons */
.btn { min-height: 46px; padding: 8px 18px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.btn:active { transform: translateY(1px); }
.btn.pri { background: var(--pri); border-color: var(--pri); color: var(--pri-ink); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.big { width: 100%; min-height: 54px; font-size: 18px; justify-content: center; margin-top: 10px; }
.btn.sm { min-height: 36px; padding: 4px 12px; font-size: 14px; }
.mini { min-height: 34px; padding: 2px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 14px; cursor: pointer; }
.mini.del { color: var(--bad); }
.btnrow { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--navy); color: #fff; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: #fff; cursor: pointer; text-align: left; padding: 0; }
.brand img { height: 30px; background: #fff; border-radius: 6px; padding: 3px 6px; }
.brand b { display: block; font-size: 17px; } .brand small { display: block; opacity: .75; font-size: 12px; }
.cls { background: #f5b301; color: #1a1a1a; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.sp { flex: 1; }
.who { text-align: right; } .who b { display: block; font-size: 15px; } .who small { opacity: .75; }
.top nav { display: flex; gap: 6px; flex-wrap: wrap; }
.tb { min-height: 40px; padding: 4px 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .3); background: var(--navy2); color: #fff; cursor: pointer; font-size: 14px; }
.tb.out { background: #6b1d1d; }
main { max-width: 1180px; margin: 0 auto; padding: 16px 16px 120px; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #0f2742, #1b3a5e 60%, #26527f); }
.acard { width: 100%; max-width: 440px; background: #fff; border-radius: 18px; padding: 28px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.alogo { display: block; width: 220px; max-width: 70%; margin: 0 auto 8px; }
.acard h1 { text-align: center; margin: 6px 0; font-size: 24px; }
.acard > p { text-align: center; margin: 4px 0; }
.clsbox { text-align: center; background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 6px; font-size: 14px; font-weight: 700; margin: 10px 0; }
.fatal { margin: 40px auto; max-width: 600px; padding: 24px; background: var(--bad-bg); color: var(--bad); border-radius: 12px; font-size: 18px; }

/* home */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--card); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); border-left: 5px solid var(--line); }
.kpi b { display: block; font-size: 30px; line-height: 1.1; }
.kpi span { color: var(--muted); font-size: 14px; }
.kpi.hot { border-left-color: var(--pri); } .kpi.hot b { color: var(--pri); }
.kpi.bad { border-left-color: var(--bad); } .kpi.bad b { color: var(--bad); }
.kpi.env { border-left-color: var(--env); }
.h2 { font-size: 19px; margin: 26px 0 10px; }
.h2row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.newgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; }
.newcard { display: flex; align-items: center; gap: 12px; text-align: left; padding: 16px; min-height: 96px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); cursor: pointer; }
.newcard:hover { border-color: var(--pri); }
.newcard .ic { font-size: 30px; }
.newcard .nt { flex: 1; } .newcard small { color: var(--pri); font-weight: 700; } .newcard b { display: block; } .newcard em { display: block; color: var(--muted); font-style: normal; font-size: 13px; }
.newcard .plus { font-size: 26px; color: var(--pri); font-weight: 700; }
.amgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.amcard { background: var(--card); border-radius: var(--r); padding: 12px 16px; box-shadow: var(--shadow); border-left: 6px solid var(--ok); display: grid; gap: 2px; }
.amcard.over { border-left-color: var(--bad); } .amcard.soon { border-left-color: #e0a800; }
.amcard em { font-style: normal; font-weight: 700; } .amcard.over em { color: var(--bad); } .amcard.ok em { color: var(--ok); }
.filters { display: grid; grid-template-columns: 1fr 1fr 150px 150px 2fr; gap: 8px; margin-bottom: 10px; }
.tablewrap { overflow-x: auto; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list th { background: #eef1f5; font-size: 14px; white-space: nowrap; }
table.list.small td, table.list.small th { padding: 6px 8px; font-size: 13px; }
table.list tbody tr { cursor: pointer; } table.list tbody tr:hover { background: #f5f9ff; }
table.list tr.mine { background: #eef5ff; }
.empty { padding: 30px; text-align: center; color: var(--muted); background: var(--card); border-radius: var(--r); }
.st { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.st-draft { background: #eceff3; color: #444; } .st-pending { background: #fff1d6; color: #8a5a00; } .st-ok { background: var(--ok-bg); color: var(--ok); }
.st-rej { background: var(--bad-bg); color: var(--bad); } .st-void { background: #e5e7eb; color: #6b7280; text-decoration: line-through; }
.st-bad { background: var(--bad-bg); color: var(--bad); } .st-me { background: var(--pri); color: #fff; }

/* banners */
.banner { padding: 12px 16px; border-radius: 10px; margin: 10px 0; background: #eceff3; }
.banner.warn { background: var(--warn-bg); color: #6d4600; border: 1px solid #f0cf85; }
.banner.danger { background: var(--bad); color: #fff; font-size: 18px; }
.banner.info { background: var(--info-bg); color: #0d3c78; }

/* form view */
.fhead { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; background: var(--card); padding: 12px 16px; border-radius: var(--r); box-shadow: var(--shadow); }
.fhead h1 { margin: 0; font-size: 20px; }
.fdoc { color: var(--pri); font-weight: 700; font-size: 13px; }
.fmeta { color: var(--muted); font-size: 14px; }
.prog { height: 10px; background: #e6e9ee; border-radius: 99px; overflow: hidden; }
.prog > div { height: 100%; background: linear-gradient(90deg, #1565c0, #1b7f3b); transition: width .25s; }
.sumtxt { font-size: 14px; margin-top: 4px; }
.bad { color: var(--bad); } .ok { color: var(--ok); }
.fnote { background: var(--info-bg); color: #0d3c78; padding: 10px 14px; border-radius: 10px; margin: 12px 0 6px; }
.stds { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #e8edf4; color: #33475b; vertical-align: middle; }
.tag.t-safe { background: var(--bad-bg); color: var(--safe); } .tag.t-env { background: var(--ok-bg); color: var(--env); }
.card { min-width: 0; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 18px; margin: 14px 0; }
.card h2 { font-size: 18px; margin: 2px 0 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card.safety { border-top: 5px solid var(--safe); }
.card.os { border: 2px solid #f0cf85; background: #fffaf0; }
details.info { margin: 4px 0 10px; } details.info summary { cursor: pointer; color: var(--pri); font-weight: 600; min-height: 36px; }
table.spec { border-collapse: collapse; margin: 8px 0; font-size: 15px; }
table.spec th, table.spec td { border: 1px solid var(--line); padding: 6px 12px; text-align: center; } table.spec th { background: #eef1f5; }

.flds { display: grid; gap: 0; grid-template-columns: minmax(0, 1fr); }
.flds.two { grid-template-columns: 1fr 1fr; column-gap: 20px; }
.flds.tiles { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.fld { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 12px; align-items: center; padding: 10px 8px; border-bottom: 1px solid #edf0f3; border-left: 4px solid transparent; }
.fld .fl { display: flex; gap: 10px; align-items: flex-start; }
.fld .no { min-width: 30px; height: 30px; border-radius: 50%; background: #eef1f5; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.fld .lbl { font-weight: 600; }
.fld .std { color: var(--muted); font-size: 14px; }
.fld .hint { color: var(--pri); font-size: 14px; font-weight: 600; }
.fld .fc { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.fld .fx { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.fld .note { grid-column: 1 / -1; display: none; }
.fld.shownote .note { display: block; }
.fld.done { border-left-color: var(--ok); }
.fld.issue { border-left-color: var(--bad); background: var(--bad-bg); }
.fld.missing { border-left-color: #e0a800; background: #fff8e6; }
.fld.issue .note input { border-color: var(--bad); }
.flds.two .fld { grid-template-columns: 1fr; } .flds.two .fld .fc { justify-content: flex-start; }
.flds.two .fld .fc > input, .flds.two .fld .fc > select, .flds.two .fld .fc > textarea { width: 100%; }
.flds.tiles .fld { border: 1px solid var(--line); border-radius: 10px; grid-template-columns: 1fr auto; padding: 8px 10px; }
.fld.t-grid { grid-template-columns: minmax(0, 1fr) auto; } .fld.t-grid .fl { grid-column: 1 / 2; } .fld.t-grid .fc { grid-column: 1 / -1; grid-row: 2; } .fld.t-grid .fc { justify-content: flex-start; display: block; min-width: 0; }
.fld.t-text .fc, .fld.t-textarea .fc { min-width: 280px; } .fld.t-text .fc > input, .fld.t-textarea .fc > textarea { width: 100%; }
.fld.t-am .std { font-size: 13.5px; }
.by { color: var(--muted); font-size: 12.5px; }
.jb { font-size: 14px; } .jb.ok { color: var(--ok); } .jb.bad { color: var(--bad); } .jb.pend { color: var(--muted); font-size: 13px; }
.req { color: var(--bad); font-style: normal; margin-left: 2px; }

.seg { display: inline-flex; flex-wrap: wrap; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { min-height: 48px; min-width: 64px; padding: 6px 14px; border: 0; border-right: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; }
.seg button:last-child { border-right: 0; }
.seg button.sel.good { background: var(--ok); color: #fff; }
.seg button.sel.bad { background: var(--bad); color: #fff; }
.seg button.sel.na { background: var(--na); color: #fff; }
.seg button.sel.pick { background: var(--pick); color: #fff; }
.seg button:disabled { cursor: default; }
.num { display: inline-flex; align-items: center; gap: 6px; }
.num input { width: 130px; text-align: right; font-size: 19px; font-variant-numeric: tabular-nums; }
.num em { font-style: normal; color: var(--muted); min-width: 36px; }
.num .neg { font-size: 22px; }
.fld.issue .num input { border-color: var(--bad); color: var(--bad); font-weight: 700; }
input.wv { width: 220px; }
.tm { display: inline-flex; gap: 6px; align-items: center; } .tm input { width: 140px; }
.tick { width: 48px; height: 48px; border-radius: 10px; border: 2px solid var(--line); background: #fff; font-size: 24px; color: #fff; cursor: pointer; }
.tick.on { background: var(--ok); border-color: var(--ok); }

.gridwrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
table.grid { border-collapse: collapse; font-size: 14px; }
table.grid th, table.grid td { border: 1px solid #e3e7ec; padding: 3px; text-align: center; }
table.grid thead th { background: #eef1f5; position: sticky; top: 0; min-width: 62px; font-size: 13px; }
table.grid thead th small { display: block; color: var(--pri); font-weight: 600; font-size: 11px; }
table.grid tbody th { position: sticky; left: 0; background: #eef1f5; min-width: 34px; }
table.grid input, table.grid select { min-height: 42px; padding: 4px 6px; width: 72px; text-align: center; border-radius: 6px; }
table.grid input[type=time] { width: 110px; } table.grid input[type=text]:not([data-num]) { width: 120px; }
table.grid .bad { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); font-weight: 700; }
table.grid .ok { background: var(--ok-bg); border-color: #9fd3b0; }

.photos { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.photos figure { position: relative; margin: 0; }
.photos img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }
.photos .x { position: absolute; top: -6px; right: -6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--bad); color: #fff; cursor: pointer; }
.isslist { margin: 6px 0 10px; padding-left: 20px; } .isslist li { margin: 3px 0; }
label.blk { font-weight: 700; }

.sigs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.sig { border: 1.5px dashed var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; align-content: start; min-height: 110px; }
.sig.signed { border-style: solid; border-color: #9fd3b0; background: #f6fbf7; }
.sig.cur { border-color: var(--pri); border-style: solid; background: #f4f8ff; }
.sig .sl small { display: block; color: var(--muted); }
.sig .sv { display: flex; gap: 10px; align-items: center; } .sig .sv img { width: 120px; height: 44px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.pend { color: var(--muted); font-size: 14px; }

.actbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(0, 0, 0, .06); }

/* admin */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs button { min-height: 44px; padding: 6px 16px; border-radius: 10px 10px 0 0; border: 1px solid var(--line); border-bottom: 0; background: #e8ecf1; cursor: pointer; font-weight: 600; }
.tabs button.on { background: #fff; color: var(--pri); }
.tabs + .card { margin-top: 0; border-top-left-radius: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.roles { display: flex; flex-wrap: wrap; }

/* modal */
.mbg { position: fixed; inset: 0; z-index: 50; background: rgba(10, 20, 35, .55); display: grid; place-items: center; padding: 16px; }
.mbox { width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: #fff; border-radius: 16px; padding: 20px 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.mbox.wide { max-width: 1000px; }
.mbox h3 { margin: 0 0 8px; }
.mact { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.padwrap { position: relative; }
#sigpad { width: 100%; height: 190px; border: 2px dashed #9aa7b5; border-radius: 10px; background: #fff; touch-action: none; display: block; }
.padwrap .mini { position: absolute; right: 8px; bottom: 8px; }
.bigimg { width: 100%; height: auto; border-radius: 8px; }

/* toast */
#toasts { position: fixed; top: 70px; right: 16px; z-index: 60; display: grid; gap: 8px; max-width: min(460px, calc(100vw - 32px)); }
.toast { padding: 12px 16px; border-radius: 10px; color: #fff; background: var(--ok); box-shadow: 0 8px 24px rgba(0, 0, 0, .2); transition: opacity .5s, transform .5s; font-weight: 600; }
.toast.err { background: var(--bad); } .toast.warn { background: #b37400; }
.toast.out { opacity: 0; transform: translateX(20px); }

/* responsive (tablet portrait / phone) */
@media (max-width: 860px) {
  .fhead { grid-template-columns: auto 1fr; top: 0; position: relative; }
  .fhead .fhact { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; }
  .filters { grid-template-columns: 1fr 1fr; } .filters input[type=search] { grid-column: 1 / -1; }
  .flds.two, .row2, .row3 { grid-template-columns: 1fr; }
  .who { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .fld { grid-template-columns: minmax(0, 1fr) auto; } .fld .fl { grid-column: 1 / -1; } .fld .fc { justify-content: flex-start; }
  .cls { display: none; }
  main { padding: 12px 12px 140px; }
}


/* ---------- form navigation & readability ---------- */
:root { --toph: 56px; }
.fnote { cursor: pointer; }
.fnote summary { list-style: none; } .fnote summary::-webkit-details-marker { display: none; }
.fnote[open] summary { margin-bottom: 6px; font-weight: 600; }
.secnav { position: sticky; top: var(--toph); z-index: 12; background: rgba(242, 244, 247, .97); backdrop-filter: blur(4px); margin: 10px calc(-1 * var(--gut, 16px)) 0; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.navtop { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.navtop .prog { flex: 1; min-width: 120px; }
.navtop .sumtxt { margin: 0; white-space: nowrap; }
.seg.vm button { min-height: 38px; min-width: 0; padding: 4px 12px; font-size: 14px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: thin; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 4px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; font-size: 14px; max-width: 260px; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip b { font-size: 12.5px; color: var(--muted); }
.chip.done { border-color: #9fd3b0; background: var(--ok-bg); } .chip.done b { color: var(--ok); }
.chip.issue { border-color: #f1a7a7; background: var(--bad-bg); } .chip.issue b { color: var(--bad); }

.sec { scroll-margin-top: 140px; }
.sech { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -4px -6px 6px; }
.sect { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; text-align: left; background: none; border: 0; padding: 6px; min-height: 44px; cursor: pointer; font-size: 18px; font-weight: 700; color: inherit; }
.sect .caret { transition: transform .2s; color: var(--muted); }
.sec.collapsed .caret { transform: rotate(-90deg); }
.sec.collapsed .secb { display: none; }
.sec.collapsed .sech { margin-bottom: -4px; }
.scount { margin-left: auto; font-size: 14px; font-weight: 700; color: var(--muted); background: #eef1f5; border-radius: 999px; padding: 2px 10px; }
.scount.ok { color: var(--ok); background: var(--ok-bg); } .scount.bad { color: var(--bad); background: var(--bad-bg); }
.okall { border-color: #9fd3b0; color: var(--ok); }

.fld .ft { display: flex; align-items: center; gap: 6px; }
.fld .jst { min-width: 22px; text-align: right; }
.ico { width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 18px; cursor: pointer; }
.fld .by { font-size: 12px; margin-top: 2px; }
.fld .lbl { font-size: 17px; line-height: 1.35; }
.fld .hint { display: inline-block; margin-top: 2px; background: #e8f1fc; border-radius: 6px; padding: 0 8px; font-size: 13.5px; }
.fld.issue .hint { background: #fbd5d5; color: var(--bad); }
.flds.two .fld .ft, .flds.tiles .fld .ft { display: none; }
.fld.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px rgba(21, 101, 192, .55); } 100% { box-shadow: none; } }

/* โหมดแสดงเฉพาะ: ยังไม่กรอก / ผิดปกติ */
#formbody.only-todo .fld.done:not(.keep), #formbody.only-todo .fld.opt:not(.keep), #formbody.only-todo .fld.t-info { display: none; }
#formbody.only-issue .fld:not(.issue):not(.keep) { display: none; }
#formbody.only-todo .sec:not(:has(.fld:not(.done):not(.opt):not(.t-info))):not(:has(.fld.keep)),
#formbody.only-issue .sec:not(:has(.fld.issue)):not(:has(.fld.keep)) { display: none; }
#formbody[class^="only-"] details.info { display: none; }

.actbar .sp { flex: 1; }
.btn.next { background: #fff7e0; border-color: #e0a800; color: #6d4600; }
.btn.next b { background: #e0a800; color: #fff; border-radius: 999px; padding: 0 8px; font-size: 14px; }
@media (max-width: 640px) {
  .navtop .sumtxt { display: none; }
  .actbar .sp { display: none; }
  .ico { width: 38px; height: 38px; }
}
.fhact { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.fld > *, .fld .fl > div { min-width: 0; }
.fld .lbl, .fld .std { overflow-wrap: break-word; }
.sect { flex-wrap: nowrap; }
.sect .stitle { flex: 1 1 auto; min-width: 0; }
@media (max-width: 640px) {
  .sect { font-size: 16px; }
  .sect .tag { display: none; }
  .sech .okall { width: 100%; justify-content: center; }
}
main { --gut: 16px; }
@media (max-width: 640px) { main { --gut: 12px; } .secnav { padding-left: 12px; padding-right: 12px; } }
/* คอลัมน์ชื่อข้อมีความกว้างขั้นต่ำ — ตัวควบคุมที่กว้าง (ปุ่มหลายตัว) จะตัดบรรทัดแทนการบีบชื่อข้อ */
.fld { grid-template-columns: minmax(220px, 1fr) auto auto; }
.fld .fc { min-width: 0; }
/* ข้อที่มีปุ่มเลือกหลายตัว (เช่น หน่วย Vacuum 5 แบบ) แสดงชื่อเต็มบรรทัด แล้วปุ่มอยู่บรรทัดถัดไป */
.fld.t-unitRange .fl { grid-column: 1 / -1; }
.fld.t-unitRange .fc { grid-column: 1 / 2; justify-content: flex-start; }
.fld.t-unitRange .seg button { min-height: 44px; }
@media (max-width: 640px) {
  .fld { grid-template-columns: minmax(0, 1fr) auto; }
}

/* ---------- F-P-013 เลือกชนิดสินค้าด้วยรูป ---------- */
.fld.t-shape { grid-template-columns: minmax(0, 1fr); }
.fld.t-shape .fc { display: block; }
.shapes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.shp { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 6px; border: 2px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; text-align: center; font-weight: 600; font-size: 14px; min-height: 120px; }
.shp img { width: 100%; height: 84px; object-fit: contain; background: #fff; border-radius: 6px; }
.shp:hover { border-color: #9cbbe6; }
.shp.on { border-color: var(--pri); background: #eef5ff; box-shadow: 0 0 0 3px rgba(21, 101, 192, .25); color: var(--pri); }
.shpbig { margin: 12px 0 0; border: 2px solid var(--pri); border-radius: 12px; padding: 8px; background: #fff; text-align: center; }
.shpbig img { width: 100%; max-width: 640px; max-height: 380px; object-fit: contain; }
.shpbig figcaption { margin-top: 6px; font-size: 15px; }
@media (max-width: 640px) { .shapes { grid-template-columns: repeat(2, 1fr); } }

/* Shared tablet: primary forms, resumable work and clear save feedback */
.homeintro h1 { font-size:28px; margin:8px 0 0; }
.homeintro p { margin:4px 0 20px; color:var(--muted); }
.newgrid { grid-template-columns:repeat(3,minmax(0,1fr)); }
.newcard { min-height:150px; align-items:flex-start; border-top:4px solid var(--pri); }
.newcard .nt small { font-size:20px; }
.newcard .nt b { margin:6px 0; font-size:18px; }
.newcard .ic { font-size:24px; }
.workcard { width:100%; display:flex; align-items:center; gap:16px; padding:16px; margin:8px 0; background:white; border:1.5px solid var(--line); border-radius:12px; text-align:left; cursor:pointer; }
.workcard small { display:block; color:var(--muted); margin-top:5px; }
.workcard .workinfo { flex:1; }
.workcard strong { color:var(--pri); white-space:nowrap; }
.homeextra { background:white; border:1px solid var(--line); border-radius:12px; padding:12px 16px; margin:16px 0; }
.homeextra > summary { cursor:pointer; min-height:48px; align-content:center; font-weight:600; }
.homeextra .kpis { margin-top:12px; }
.formhelp { color:var(--muted); padding:0 4px; }
.savestate { font-size:14px; color:var(--ok); }
.savestate.bad { color:var(--bad); }
.recordlink { background:none; border:0; padding:4px 0; min-height:48px; color:var(--pri); text-align:left; font-weight:700; cursor:pointer; }
button:focus-visible, summary:focus-visible { outline:3px solid var(--pri); outline-offset:3px; }
button { touch-action:manipulation; }
.tb, .btn.sm, .mini, .ico { min-height:48px; }
.ico { min-width:48px; }
@media (max-width:1000px) { .newgrid { grid-template-columns:1fr; } .newcard { min-height:108px; align-items:center; } .top .cls { display:none; } .filters { grid-template-columns:1fr 1fr; } .filters input[type=search] { grid-column:1/-1; } }
@media (max-width:640px) { .workcard { flex-wrap:wrap; } .workcard .workinfo { flex-basis:100%; } .workcard strong { margin-left:auto; } .h2row { flex-wrap:wrap; } .actbar { padding-bottom:max(10px,env(safe-area-inset-bottom)); } .savestate { flex-basis:100%; } main { padding-bottom:230px; } .navtop .sumtxt { display:block; } }
