/* BiGKET Back Office — ระบบดีไซน์ v3 (แนวซอฟต์แวร์ ERP: shell bar + เมนูโมดูล + แท็บ + ตารางข้อมูลแน่น) */
:root {
  --blue: #2A8A4F; --blue-d: #1F6B3C; --blue-soft: #E9F5EE; --yellow: #F7DA0A; --navy: #12381F;
  --bg: #F2F4F7; --card: #fff; --line: #E3E7ED; --line-2: #CDD4DE; --text: #1B2635; --muted: #6A778A; --head: #F7F8FA;
  --red: #C8291C; --red-soft: #FDECEA; --green: #107E3E; --green-soft: #E6F4EA; --amber: #A65F00; --amber-soft: #FEF3D9; --info: #2A8A4F; --info-soft: #E9F5EE;
  --ring: 0 0 0 3px rgba(47,148,86,.2); --r: 8px; --sh: 0 1px 2px rgba(16,28,44,.06);
}
* { box-sizing: border-box; }
[hidden], input[type=hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h3, h4 { margin: 0; line-height: 1.3; } h1 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; } h3 { font-size: 14px; font-weight: 700; } h4 { font-size: 13.5px; font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; } button { cursor: pointer; }
.muted { color: var(--muted); font-weight: 400; } .r { text-align: right; } .num, td.r, th.r { font-variant-numeric: tabular-nums; }
.err, .bad-text { color: var(--red); font-weight: 600; min-height: 1.2em; } .warn-text { color: var(--amber); font-weight: 600; }
.loading { padding: 48px; text-align: center; color: var(--muted); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.logo { font-weight: 800; font-size: 22px; letter-spacing: -.5px; line-height: 1; } .logo span:first-child { color: #F7DA0A; } .logo span:nth-child(2) { color: var(--yellow); }

/* ───────── ปุ่ม ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; color: var(--blue); font-weight: 600; font-size: 13.5px; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--blue-soft); border-color: #EDB6BB; } .btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; } .btn.primary:hover { background: var(--blue-d); }
.btn.danger { color: var(--red); border-color: #EDBDB7; } .btn.danger:hover:not([disabled]) { background: var(--red-soft); }
.btn.ghost { border-color: transparent; background: none; } .btn.ghost:hover { background: var(--blue-soft); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; } .btn.block { display: flex; width: 100%; height: 40px; }
.btn.sm.block { width: 100%; }
.x { border: 0; background: none; color: var(--muted); flex: none; font-size: 12.5px; font-weight: 600; padding: 4px 8px; border-radius: 6px; line-height: 1.2; } .x:hover { color: var(--red); background: var(--red-soft); }

/* ───────── ฟอร์ม ───────── */
label { display: block; font-weight: 500; font-size: 12.5px; color: #4A5668; margin-bottom: 12px; }
label > input:not([type=checkbox]):not([type=color]):not([type=file]), label > select, textarea, .toolbar input, .toolbar select, .row input, .row select, .le input, .search-in, .prefix input, .za-add input, .za-head input[type=number], .za-sub input[type=number] {
  display: block; width: 100%; height: 34px; margin-top: 4px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; color: var(--text); font-size: 14px; font-weight: 400; min-width: 0; transition: border-color .12s, box-shadow .12s; }
textarea { height: auto !important; padding: 8px 10px !important; resize: vertical; font-family: inherit; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--blue) !important; box-shadow: var(--ring); outline: none; }
input:disabled, select:disabled { background: var(--head); color: var(--muted); }
input[type=color] { display: block; width: 100%; height: 34px; margin-top: 4px; border: 1px solid var(--line-2); border-radius: 6px; padding: 2px; background: #fff; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13.5px; font-weight: 500; color: var(--text); } .check input { width: 16px; height: 16px; accent-color: var(--blue); flex: none; margin: 0; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; } .f3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.savebar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.savebar:empty { display: none; }
.rows { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.row { display: flex; gap: 8px; width: 100%; align-items: center; } .row input, .row select { margin: 0; }
.imgcell { display: flex; gap: 6px; min-width: 0; align-items: center; } .imgcell input { flex: 1; }
.hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.prefix { display: flex; margin-top: 4px; } .prefix em { font-style: normal; display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--line-2); border-right: 0; border-radius: 6px 0 0 6px; background: var(--head); color: var(--muted); }
.prefix input { flex: 1; margin: 0; border-radius: 0 6px 6px 0; }

/* ───────── โครงหน้า: shell bar ───────── */
.shellbar { position: sticky; top: 0; z-index: 40; height: 48px; display: flex; align-items: center; gap: 16px; padding: 0 16px; background: var(--navy); color: #fff; }
.sb-logo { display: flex; align-items: baseline; flex: none; } .sb-logo small { font-size: 12px; font-weight: 500; color: #E9C6CA; letter-spacing: 0; }
.sb-search { flex: 1; max-width: 520px; margin: 0 auto; }
.sb-search input { width: 100%; height: 32px; border: 0; border-radius: 6px; padding: 0 12px 0 34px; background: rgba(255,255,255,.12) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23B9C9DA' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3.5 3.5'/%3E%3C/svg%3E") no-repeat 11px center; color: #fff; }
.sb-search input::placeholder { color: #A9BCD0; } .sb-search input:focus { background-color: #fff; color: var(--text); box-shadow: none; }
.sb-right { display: flex; align-items: center; gap: 4px; flex: none; }
.sb-right a, .sb-right button { height: 32px; display: inline-flex; align-items: center; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: #D3EBDC; font-size: 13px; font-weight: 500; white-space: nowrap; }
.sb-right a:hover, .sb-right button:hover { background: rgba(255,255,255,.1); color: #fff; }
.sb-user { display: flex; align-items: center; gap: 8px; margin-left: 6px; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.15); font-size: 13px; color: #D3EBDC; }
.av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #F7DA0A; color: #fff; font-weight: 700; font-size: 13px; }
.av { overflow: hidden; } .av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.me { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px 0 2px; border: 0; border-radius: 99px; background: none; color: inherit; font-size: 13px; font-weight: 500; } .me:hover { background: rgba(255,255,255,.1); }
.img-box.round { border-radius: 50%; font-size: 40px; font-weight: 700; color: var(--blue); }
.sb-menu { display: none !important; height: 32px; align-items: center; padding: 0 10px; border: 1px solid rgba(255,255,255,.25); border-radius: 6px; background: none; color: #fff; font-size: 13px; font-weight: 600; }

.layout { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: calc(100vh - 48px); }
.side { background: #fff; border-right: 1px solid var(--line); position: sticky; top: 48px; height: calc(100vh - 48px); overflow-y: auto; padding: 10px 8px; }
.side nav { display: flex; flex-direction: column; gap: 1px; }
.side nav a { position: relative; display: flex; align-items: center; height: 36px; padding: 0 12px; border-radius: 6px; font-size: 14px; font-weight: 500; color: #3A4657; }
.side nav a:hover { background: var(--head); color: var(--text); }
.side nav a.on { background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.side nav a.on::before { content: ''; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--blue); }
.side nav hr { border: 0; border-top: 1px solid var(--line); margin: 8px 4px; }

.content { min-width: 0; }
.pagehead { background: #fff; border-bottom: 1px solid var(--line); padding: 14px 24px 0; }
.ph-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding-bottom: 14px; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; } .crumbs a { color: var(--blue); } .crumbs a:hover { text-decoration: underline; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; }
.tabs a { position: relative; padding: 9px 12px 11px; font-size: 14px; font-weight: 500; color: #4A5668; white-space: nowrap; }
.tabs a:hover { color: var(--blue); }
.tabs a.on { color: var(--blue); font-weight: 700; } .tabs a.on::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--blue); }
.pagebody { padding: 18px 24px 56px; max-width: 1480px; }

/* ───────── การ์ด / แผง ───────── */
.panel, .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 16px; margin-bottom: 16px; display: block; }
.panel > h3:first-child, .panel > summary { margin: -16px -16px 14px; padding: 11px 16px; border-bottom: 1px solid var(--line); font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel > h3:first-child .muted { font-size: 12.5px; font-weight: 500; margin-left: auto; }
.panel h3:not(:first-child), .panel form > h3:first-child { margin: 18px 0 10px; }
details.panel { padding-top: 0; padding-bottom: 0; } details.panel > summary { margin-bottom: 0; border-bottom: 0; cursor: pointer; list-style: none; min-height: 46px; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: 'แก้ไข'; margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--blue); }
details.panel[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 14px; } details.panel[open] > summary::after { content: 'ปิด'; } details.panel[open] { padding-bottom: 16px; }
details > summary { cursor: pointer; font-weight: 600; }
.card.flush, .panel.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head.pad { padding: 10px 16px; margin: 0; border-bottom: 1px solid var(--line); }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; } .zone { transition: border-color .12s; } .zone:hover { border-color: var(--blue); }
/* พื้นที่จัดส่งตามสาขา: การ์ดสาขา → พื้นที่ของสาขา → ตาราง รหัสไปรษณีย์ / ตำบล / ยอดขั้นต่ำ */
/* หน้าแก้ไขพื้นที่: ช่องเลือกรหัสไปรษณีย์ + กล่องตำบลของแต่ละรหัส */
.za-add { position: relative; max-width: 520px; } .za-add input { margin: 0; width: 100%; }
.za-sug { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 10px 28px rgba(0,0,0,.14); max-height: 320px; overflow: auto; }
.za-sug button { display: flex; gap: 10px; align-items: baseline; width: 100%; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font: inherit; color: var(--text); cursor: pointer; }
.za-sug button:last-child { border-bottom: 0; } .za-sug button:hover:not([disabled]) { background: var(--head); } .za-sug button[disabled] { opacity: .5; cursor: default; }
.za-sug button span { flex: 1; min-width: 0; } .za-sug p { margin: 0; padding: 10px 12px; }
.za-blk { border: 1px solid var(--line); border-radius: var(--r); margin-top: 12px; overflow: hidden; }
.za-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 12px; background: var(--head); } .za-head b { font-size: 15px; }
.za-head > .muted { flex: 1; min-width: 140px; font-size: 13px; } .za-head input[type=number] { width: 190px; margin: 0; }
.za-subs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 24px; padding: 4px 12px 8px 30px; } .za-subs:empty { display: none; }
.za-sub { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.za-sub .check { flex: 1; min-width: 0; cursor: pointer; } .za-sub input[type=number] { width: 130px; margin: 0; height: 30px; }
.za-sub input[type=number]:disabled { opacity: .45; }
.zone-br { max-width: 980px; } .zone-br > h3 .btn { margin-left: 4px; }
.zone-subs { width: 32%; max-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .zone-br td { white-space: nowrap; }
.codes { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 0; align-items: center; color: var(--muted); font-size: 12.5px; } .codes span { background: var(--head); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text); }

/* ───────── ตัวเลขสรุป (KPI) ───────── */
.stats, .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat, .kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; box-shadow: var(--sh); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
a.stat:hover { border-color: var(--blue); }
.stat span, .kpi span { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat b, .kpi b { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat small, .kpi > small, .kpi b small { color: var(--muted); font-size: 12px; font-weight: 400; }
.stat.alert b { color: var(--red); } .stat.warn b { color: var(--amber); }
.meter { height: 4px; border-radius: 9px; background: #E8ECF1; margin-top: 8px; overflow: hidden; } .meter i { display: block; height: 100%; background: var(--green); }

/* ───────── แถบเครื่องมือ / ตัวกรอง ───────── */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: flex-end; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); }
.toolbar form { display: flex; gap: 8px; flex: 1; min-width: 240px; align-items: flex-end; } .toolbar input, .toolbar select { margin: 0; } .toolbar input[type=search] { min-width: 220px; }
.toolbar label { margin: 0; font-size: 12px; } .toolbar label > input, .toolbar label > select { margin-top: 3px; }
.toolbar > .pill { align-self: center; }
.seg { display: inline-flex; background: var(--head); border: 1px solid var(--line-2); border-radius: 6px; padding: 2px; flex-wrap: wrap; gap: 2px; }
.seg button { border: 0; background: none; border-radius: 4px; height: 28px; padding: 0 12px; font-size: 13px; font-weight: 500; color: #4A5668; }
.seg button:hover { color: var(--blue); } .seg button.on { background: #fff; color: var(--blue); font-weight: 700; box-shadow: 0 1px 2px rgba(16,28,44,.15); }
.search-in { width: 240px; max-width: 100%; margin: 0; padding-left: 32px !important; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236A778A' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3.5 3.5'/%3E%3C/svg%3E") no-repeat 10px center; }

/* ───────── ตาราง ───────── */
.scroll { overflow-x: auto; } table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--head); color: #4A5668; font-size: 12.5px; font-weight: 600; white-space: nowrap; border-top: 1px solid var(--line); }
.panel > table th:first-child, .panel > .scroll table th:first-child, .panel > table td:first-child, .panel > .scroll table td:first-child { padding-left: 16px; }
.panel > table th:last-child, .panel > .scroll table th:last-child, .panel > table td:last-child, .panel > .scroll table td:last-child { padding-right: 16px; }
.panel > table, .panel > .scroll { margin: 0 -16px; width: calc(100% + 32px); max-width: none; }
.panel > h3:first-child + table th, .panel > h3:first-child + .scroll table th { border-top: 0; }
.panel > h3:first-child + table, .panel > h3:first-child + .scroll { margin-top: -14px; }
.panel > table:last-child, .panel > .scroll:last-child { margin-bottom: -16px; } .panel > table:last-child tr:last-child td, .panel > .scroll:last-child tr:last-child td { border-bottom: 0; }
th.r, td.r { text-align: right; white-space: nowrap; } td small { color: var(--muted); }
td b { font-weight: 600; }
table.click tbody tr { cursor: pointer; } table.click tbody tr:hover { background: #F4FAF6; } table.click tbody tr:hover td:first-child b { color: var(--blue); }
tr.grand td { font-weight: 700; font-size: 14.5px; background: var(--head); }
td.empty, td.muted { text-align: center; color: var(--muted); padding: 28px 10px; }
.pager { display: flex; gap: 4px; margin-top: 12px; flex-wrap: wrap; } .pager button { border: 1px solid var(--line-2); background: #fff; border-radius: 6px; min-width: 32px; height: 30px; padding: 0 6px; font-size: 13px; } .pager .on { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ───────── สถานะ ───────── */
.pill { display: inline-flex; align-items: center; gap: 5px; background: #EEF1F5; color: #475467; border-radius: 4px; padding: 1px 8px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.pill.ok, .st-delivered { background: var(--green-soft); color: var(--green); } .pill.warn, .st-pending { background: var(--amber-soft); color: var(--amber); } .pill.bad, .st-cancelled { background: var(--red-soft); color: var(--red); }
.st-confirmed, .st-packing, .st-shipping { background: var(--info-soft); color: var(--info); }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 4px; white-space: nowrap; } .tag.red { background: var(--red-soft); color: var(--red); }

dl { margin: 0; } .kv div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-top: 1px solid var(--line); } .kv div:first-child { border: 0; padding-top: 0; } dt { color: var(--muted); flex: none; } dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.addr { padding: 10px 0; border-top: 1px solid var(--line); } .addr:first-of-type { border: 0; padding-top: 0; } .addr small { display: block; color: var(--muted); }
.note { background: var(--amber-soft); border-radius: 6px; padding: 8px 12px; margin: 12px 0 0; }
pre { background: var(--navy); color: #F2D3D6; padding: 14px; border-radius: 8px; overflow: auto; font-size: 12.5px; } code { background: var(--head); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.toast { position: fixed; bottom: 22px; left: 50%; translate: -50% 0; background: #1B2635; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 90; font-weight: 500; box-shadow: 0 10px 30px rgba(16,28,44,.3); max-width: calc(100vw - 32px); }
.toast.bad { background: var(--red); }

/* ───────── รูปสินค้า ───────── */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.thumb { width: 88px; height: 88px; border: 1px solid var(--line); border-radius: 6px; position: relative; overflow: hidden; background: #fff; margin: 0; }
.thumb img { width: 100%; height: 100%; object-fit: contain; } .thumb .x { position: absolute; top: 3px; right: 3px; background: rgba(255,255,255,.95); padding: 1px 6px; }
.thumb.add { display: grid; place-items: center; color: var(--blue); border: 1px dashed var(--line-2); cursor: pointer; font-size: 13px; font-weight: 600; }
.thumb.add:hover { background: var(--blue-soft); }

/* ───────── ตารางกรอกรายการสินค้า ───────── */
.le { margin-bottom: 14px; } .le-lbl { display: block; font-size: 12.5px; font-weight: 500; color: #4A5668; margin-bottom: 4px; }
.le table { border: 1px solid var(--line); border-radius: 6px; } .le th { border-top: 0; }
.le td { padding: 4px 6px; } .le td:first-child { width: 150px; } .le td.qty { width: 110px; } .le td.cost { width: 120px; } .le td:last-child { width: 48px; text-align: right; }
.le input { height: 30px; margin: 0; } .le input[type=number] { text-align: right; }
.le-name { color: var(--muted); font-size: 13px; } .le-name b { color: var(--text); font-weight: 500; } .le-name .bad-text { font-weight: 500; }
.le-foot { display: flex; gap: 8px; align-items: center; margin-top: 8px; } .le-foot span { margin-left: auto; color: var(--muted); font-size: 12.5px; }

/* ───────── ฟอร์มสินค้า ───────── */
.pform { max-width: 860px; } .pform .seg.big { margin-bottom: 14px; } .seg.big button { height: 36px; padding: 0 20px; font-size: 14px; }
.pack { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; background: var(--head); border: 1px solid var(--line); border-radius: 6px; font-size: 13.5px; }
.pack input { height: 34px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; } .pack input[type=number] { width: 84px; text-align: right; } .pack select { width: 130px; height: 34px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; }
.pack output { margin-left: auto; color: var(--green); font-weight: 600; } .pack output b { font-size: 15px; }
.switches { display: flex; flex-wrap: wrap; gap: 14px 32px; } .switches .switch { font-size: 14px; }
.savebar.sticky { position: sticky; bottom: 0; z-index: 5; margin: 0 0 16px; padding: 12px 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 -4px 16px rgba(16,28,44,.08); }

/* ───────── ป้ายบาร์โค้ด ───────── */
.with-btn { display: flex; gap: 6px; margin-top: 4px; } .with-btn input { flex: 1; margin: 0 !important; } .with-btn .btn { height: 34px; flex: none; }
.lb-sheet { background: #fff; box-shadow: 0 1px 6px rgba(16,28,44,.25); }
.lb { width: var(--lw); height: var(--lh); padding: 1.5mm 2mm; display: flex; flex-direction: column; align-items: center; gap: .4mm; overflow: hidden; color: #000; background: #fff; font-family: 'Noto Sans Thai', sans-serif; text-align: center; }
.lb b { font-size: 2.7mm; line-height: 1.2; font-weight: 600; max-height: 2.4em; overflow: hidden; width: 100%; }
.lb-price { font-size: 4mm; font-weight: 800; line-height: 1.1; } .lb-price small { font-size: 2.4mm; font-weight: 500; }
.lb-bars { flex: 1; min-height: 0; width: 100%; display: block; } .lb-bars svg { width: 100%; height: 100%; display: block; }
.lb-code { font-size: 2.4mm; letter-spacing: .3mm; line-height: 1; font-variant-numeric: tabular-nums; }
#labels { display: none; }
/* ป้ายราคา A4 แนวนอน: ขาวดำ ไม่มีเส้นตกแต่ง — บน: รหัส + ชื่อ · กลาง: ราคาปกติชิดขวา (ราคาต่อชิ้นใต้ "/ หน่วย") · ล่าง: QR (ซ้าย) + ราคาขายส่งสูงสุด 3 ระดับ (ขวา) */
.sign { width: 297mm; height: 210mm; padding: 12mm 15mm 12mm; display: flex; flex-direction: column; background: #fff; color: #000; font-family: 'Noto Sans Thai', sans-serif; overflow: hidden; break-after: page; }
.sg-sku { font-size: 11mm; font-weight: 500; line-height: 1; letter-spacing: .5mm; font-variant-numeric: tabular-nums; }
.sign h1 { margin: 4mm 0 0; font-size: 17mm; font-weight: 700; line-height: 1.18; letter-spacing: 0; max-height: 2.4em; overflow: hidden; }
.sg-main { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: flex-end; }
.sg-price { display: flex; align-items: flex-start; line-height: .9; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sg-price > b { font-size: 84mm; font-weight: 600; letter-spacing: -2.8mm; }
.sg-dec { display: flex; flex-direction: column; font-size: 31mm; font-weight: 600; margin-top: 6mm; }
.sg-dec small { font-size: 9mm; font-weight: 500; line-height: 1.35; margin-top: 3mm; } .sg-dec small + small { margin-top: 0; }
.sg-each b { font-size: 1.35em; font-weight: 600; letter-spacing: 0; }
.sg-main.sm .sg-price > b { font-size: 66mm; letter-spacing: -2.2mm; } .sg-main.xs .sg-price > b { font-size: 52mm; letter-spacing: -1.7mm; } .sg-main.sm .sg-dec { font-size: 25mm; margin-top: 5mm; } .sg-main.xs .sg-dec { font-size: 20mm; margin-top: 4mm; }
.sg-main.sm .sg-dec small, .sg-main.xs .sg-dec small { font-size: 8mm; }
.sg-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8mm; }
.sg-qr { flex: none; width: 38mm; margin: 0 0 0 -2mm; } .sg-qr svg { display: block; width: 100%; height: auto; } .sg-qr span { display: block; text-align: center; font-size: 4.6mm; font-weight: 500; line-height: 1.2; }
.sg-tiers { flex: 1; min-width: 0; display: flex; justify-content: flex-end; align-items: flex-end; gap: 9mm; }
.sg-tier { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sg-tier span { font-size: 6.5mm; font-weight: 500; line-height: 1.25; } .sg-tier b { font-size: 21mm; font-weight: 600; line-height: 1.05; letter-spacing: -.5mm; } .sg-tier small { font-size: 5.6mm; font-weight: 500; line-height: 1.3; }
.sg-tiers.sm .sg-tier b { font-size: 16mm; } .sg-tiers.xs .sg-tier b { font-size: 12.5mm; } .sg-tiers.sm .sg-tier span, .sg-tiers.xs .sg-tier span { font-size: 5.6mm; } .sg-tiers.sm .sg-tier small, .sg-tiers.xs .sg-tier small { font-size: 4.8mm; }

/* ───────── หมวดหมู่ ───────── */
.sf-strip { display: flex; align-items: flex-start; gap: 12px; overflow-x: auto; padding: 14px 12px 8px; background: var(--head); border-radius: 6px; scrollbar-width: thin; }
.sf-tile { flex: 0 0 92px; width: 92px; min-width: 0; position: relative; display: flex; flex-direction: column; gap: 6px; text-align: center; }
.sf-tile.off { opacity: .45; }
.sf-pic { aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; overflow: hidden; }
.sf-pic img { width: 100%; height: 100%; object-fit: cover; }
.sf-pic i, .ct-thumb i { width: 100%; height: 100%; display: grid; place-items: center; font-style: normal; font-size: 11px; color: #8A97A8; background: #EEF1F5; }
.sf-tile b { font-size: 12.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sf-tile em { position: absolute; top: -8px; left: 50%; translate: -50% 0; z-index: 1; font-style: normal; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; padding: 1px 8px; border-radius: 99px; white-space: nowrap; }
.sf-preview { display: grid; place-items: center; padding: 22px 0 16px; background: var(--head); border-radius: 6px; }
.ct-row { display: grid; grid-template-columns: 30px minmax(200px, 1fr) 140px 64px 116px 150px; gap: 12px; align-items: center; padding: 8px 16px 8px 8px; border-bottom: 1px solid var(--line); background: #fff; }
.ct-head { background: var(--head); color: #4A5668; font-size: 12.5px; font-weight: 600; }
.ct-body { list-style: none; margin: 0; padding: 0; } .ct-body .ct-row:last-child { border-bottom: 0; } .ct-body .ct-row:hover { background: #F4FAF6; }
.ct-row.dragging { opacity: .6; background: var(--blue-soft); box-shadow: inset 0 0 0 1.5px var(--blue); }
.ct-empty { padding: 32px; text-align: center; color: var(--muted); }
.grip { cursor: grab; color: #A3B0C0; text-align: center; font-size: 15px; letter-spacing: -3px; user-select: none; } .grip:hover { color: var(--text); }
.ct-row[draggable=false] .grip { visibility: hidden; }
.ct-main { display: flex; align-items: center; gap: 12px; min-width: 0; border: 0; background: none; padding: 0; text-align: left; }
.ct-thumb { width: 40px; height: 40px; flex: none; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: var(--head); }
.ct-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ct-name { display: flex; flex-direction: column; min-width: 0; } .ct-name b { font-size: 14px; font-weight: 600; } .ct-main:hover .ct-name b { color: var(--blue); }
.ct-name small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-act { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.ct-act .mini button { width: 28px; height: 28px; padding: 0; }

/* สวิตช์ */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; margin: 0; font-weight: 500; font-size: 13px; color: var(--text); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i { position: relative; width: 34px; height: 18px; flex: none; border-radius: 99px; background: #C3CBD6; transition: background .2s; }
.switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: translate .2s; }
.switch input:checked + i { background: var(--green); } .switch input:checked + i::after { translate: 16px 0; }
.switch input:focus-visible + i { box-shadow: var(--ring); } .switch.big { display: flex; height: 34px; margin-top: 4px; }

/* ลิ้นชักแก้ไข */
body.drawer-open { overflow: hidden; }
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(10,22,38,.4); animation: fade .2s ease; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 71; width: min(460px, 100vw); background: #fff; display: flex; flex-direction: column; box-shadow: -18px 0 50px rgba(10,22,38,.2); translate: 100% 0; transition: translate .24s cubic-bezier(.2,.8,.2,1); }
.drawer.in { translate: 0 0; } @keyframes fade { from { opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); } .drawer-head h3 { font-size: 16px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--head); }
.field-group { margin-bottom: 16px; } .lbl { display: block; font-size: 12.5px; font-weight: 500; color: #4A5668; margin-bottom: 6px; }
.img-pick { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: center; }
.img-box { width: 120px; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px dashed var(--line-2); background: var(--head); display: grid; place-items: center; color: var(--muted); font-size: 12.5px; position: relative; }
.img-box img { width: 100%; height: 100%; object-fit: cover; } .img-box:has(img) { border-style: solid; border-color: var(--line); }
.img-box.busy::after { content: '…'; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.85); font-weight: 700; font-size: 20px; }
.img-side { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; } .img-side label { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 16px; }
.chip { border: 1px solid var(--line-2); background: #fff; border-radius: 99px; padding: 2px 10px; font-size: 12.5px; color: #3B4B5F; } .chip:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; padding: 12px 14px; border: 1px solid #F1CAC5; border-radius: 6px; background: #FFFAF9; }
.danger-zone b { display: block; font-size: 13.5px; color: var(--red); } .danger-zone small { color: var(--muted); font-size: 12.5px; }

/* ───────── ภาพรวม ───────── */

/* ───────── หน้าเข้าสู่ระบบ ───────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--navy); }
.login .panel { width: min(380px, 100%); padding: 32px 28px 24px; border: 0; border-radius: 10px; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.login .logo { font-size: 32px; text-align: center; margin-bottom: 24px; } .login .logo span:first-child { color: var(--blue); }
.login label > input { height: 40px; }


/* ───────── หน้าเลือกระบบหลังเข้าสู่ระบบ ───────── */
.launch { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(1100px 620px at 50% 115%, #6B1A24 0%, transparent 70%), var(--navy); color: #fff; }
.launch-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 24px; }
.launch-top .logo { font-size: 26px; }
.launch-top .btn.ghost { color: #D3EBDC; } .launch-top .btn.ghost:hover { background: rgba(255,255,255,.1); }
.launch-grid { flex: 1; display: flex; justify-content: center; align-items: center; gap: 28px; padding: 24px 16px 12vh; flex-wrap: wrap; }
.launch-tile { position: relative; width: 250px; aspect-ratio: 1 / .92; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; padding: 26px; border-radius: 18px; overflow: hidden;
  background: #fff; color: var(--text); box-shadow: 0 18px 50px rgba(0,0,0,.35); transition: transform .18s ease, box-shadow .18s ease; }
.launch-tile:hover, .launch-tile:focus-visible { transform: translateY(-6px); box-shadow: 0 26px 60px rgba(0,0,0,.45); outline: none; }
.launch-tile:focus-visible { box-shadow: 0 0 0 4px var(--yellow), 0 26px 60px rgba(0,0,0,.45); }
.launch-tile i { position: absolute; top: 22px; left: 26px; font-style: normal; font-weight: 800; font-size: 64px; line-height: 1; letter-spacing: -.03em; }
.launch-tile b { font-size: 28px; font-weight: 800; letter-spacing: -.01em; }
.launch-tile::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; }
.launch-tile.pos i { color: var(--blue); } .launch-tile.pos::after { background: var(--blue); }
.launch-tile.wg i { color: var(--green); } .launch-tile.wg::after { background: var(--green); }
.launch-tile.bo i { color: #E0808A; } .launch-tile.bo::after { background: var(--yellow); }
.launch-tile.pod i { color: #2F6FB3; } .launch-tile.pod::after { background: #2F6FB3; }
.shellbar .vrp-name { color: #fff; font-weight: 700; white-space: nowrap; margin-right: auto; }
@media (max-width: 620px) { .launch-grid { gap: 16px; padding-bottom: 8vh; } .launch-tile { width: min(320px, 100%); aspect-ratio: 2 / 1; padding: 20px; } .launch-tile i { font-size: 44px; top: 18px; left: 20px; } .launch-tile b { font-size: 24px; } .launch-top .sb-user span:not(.av) { display: none; } }

/* ───────── ตัวตกแต่งหน้าแรก (builder) ───────── */
.bld-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r) var(--r) 0 0; padding: 10px 14px; }
.bld-bar b { font-size: 14.5px; margin-right: 12px; } .bld-actions { display: flex; gap: 8px; flex-wrap: wrap; }
#bld-status { font-size: 12.5px; font-weight: 600; padding: 1px 8px; border-radius: 4px; white-space: nowrap; }
#bld-status.warn { background: var(--amber-soft); color: var(--amber); } #bld-status.info { background: var(--info-soft); color: var(--info); } #bld-status.ok { background: var(--green-soft); color: var(--green); }
.bld-main { display: grid; grid-template-columns: 216px minmax(0, 1fr) 328px; height: calc(100vh - 250px); min-height: 520px; background: #fff; border: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); overflow: hidden; }
.bld-side { overflow-y: auto; padding: 14px; } .bld-side:first-child { border-right: 1px solid var(--line); } .bld-side:last-child { border-left: 1px solid var(--line); }
.bld-side h4 { margin: 0 0 10px; }
.bld-canvas { background: #E7ECF2; overflow: hidden; position: relative; } .bld-canvas iframe { border: 0; background: #fff; display: block; }
.bld-main.app .bld-canvas { display: flex; justify-content: center; padding: 16px 0; } .bld-main.app iframe { border-radius: 22px; box-shadow: 0 0 0 8px #14202E, 0 12px 30px rgba(0,0,0,.25); }
.pal { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin-bottom: 6px; }
.pal:hover:not([disabled]) { border-color: var(--blue); background: var(--blue-soft); } .pal[disabled] { opacity: .5; cursor: not-allowed; }
.pal b { font-size: 13.5px; font-weight: 600; } .pal small { grid-column: 1; color: var(--muted); font-size: 12px; } .pal span { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.layer { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; margin-bottom: 6px; cursor: pointer; }
.layer:hover { border-color: var(--blue); } .layer span:first-child { min-width: 0; } .layer b { display: block; font-size: 13.5px; font-weight: 600; } .layer small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini { display: inline-flex; gap: 4px; flex: none; } .mini button { border: 1px solid var(--line-2); background: #fff; border-radius: 5px; height: 26px; padding: 0 8px; font-size: 12px; font-weight: 600; color: #4A5668; }
.mini button:hover:not([disabled]) { border-color: var(--blue); color: var(--blue); } .mini button[disabled] { opacity: .4; cursor: not-allowed; } .mini .danger { color: var(--red); }
.mini.wide { display: flex; margin: 10px 0 14px; } .mini.wide button { flex: 1; }
.ins-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; } .ins-head h4 { margin: 0; } .ins-head small { color: var(--muted); }
.spec { background: var(--head); border-radius: 6px; padding: 7px 10px; font-size: 12.5px; color: var(--muted); margin: 0 0 12px; } .spec b { color: var(--text); }
.item { border: 1px solid var(--line); border-radius: 6px; padding: 10px; margin-bottom: 10px; } .item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.item details { margin-top: 2px; } .item summary { font-size: 13px; margin-bottom: 8px; color: var(--blue); }
.imgfld { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; } .imgfld img, .imgfld-empty { width: 112px; height: 62px; border-radius: 6px; object-fit: cover; flex: none; border: 1px solid var(--line); }
.imgfld-empty { display: grid; place-items: center; color: var(--muted); font-size: 12px; border-style: dashed; background: var(--head); } .imgfld small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 4px; } .imgfld label { margin: 0; display: inline-flex; }

/* ───────── จอแคบ ───────── */
@media (max-width: 1240px) {
  .ct-head { display: none; }
  .ct-row { grid-template-columns: 26px minmax(0, 1fr) auto auto; padding-right: 12px; }
  .ct-row > :nth-child(3), .ct-row > :nth-child(4), .ct-row .switch > span { display: none; }
}
@media (max-width: 1180px) { .bld-main { grid-template-columns: 180px minmax(0, 1fr) 290px; } }
@media (max-width: 960px) {
  .sb-menu { display: inline-flex !important; } .sb-logo small, .sb-right a, .sb-user span:not(.av) { display: none; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; position: fixed; top: 48px; left: 0; z-index: 50; width: 240px; box-shadow: 8px 0 30px rgba(10,22,38,.2); }
  body.nav-open .side { display: block; }
  .pagehead { padding: 12px 16px 0; } .pagebody { padding: 14px 16px 48px; }
  .cols { grid-template-columns: 1fr; } .f3 { grid-template-columns: 1fr 1fr; }
  .row { flex-wrap: wrap; } .row > * { flex-basis: 40% !important; }
  .bld-main { grid-template-columns: 1fr; height: auto; } .bld-canvas { height: 420px; } .bld-side { border: 0 !important; }
  .toolbar form { min-width: 0; flex-wrap: wrap; }
}
@media (max-width: 560px) {
  .f2, .f3 { grid-template-columns: 1fr; } .sb-search { display: none; } .img-pick { grid-template-columns: 1fr; }
  .ct-act .btn { display: none; }
}

/* ───────── พิมพ์ ───────── */
@media print {
  body.print-labels > *:not(#labels) { display: none !important; }
  body.print-labels #labels { display: block; } body.print-labels .lb { break-after: page; }
  .sign { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .shellbar, .side, .tabs, .top-actions, .toolbar, .savebar, .toast, .pagehead .crumbs { display: none !important; }
  .layout { display: block; } .pagebody { padding: 0; } .pagehead { border: 0; padding: 0 0 10px; }
  .panel { box-shadow: none; break-inside: avoid; } body { background: #fff; }
}

/* ───────── โทนสีแบรนด์: เขียวของโลโก้ BiGKET (แทนโทนกรมท่าเดิม) ───────── */
:root { --brand: #2F9456; --brand-d: #1F6B3C; --blue: #2A8A4F; --blue-d: #1F6B3C; --blue-soft: #E9F5EE; --info: #2A8A4F; --info-soft: #E9F5EE; --bg: #F5F8F6; --head: #FBF8F8; --line: #DFE6EE; }
.shellbar { background: var(--brand); box-shadow: inset 0 -1px 0 rgba(0,0,0,.08); }
.shellbar .logo span:first-child, .launch-top .logo span:first-child { color: #fff; }
.sb-search input { background-color: rgba(255,255,255,.22); } .sb-search input::placeholder { color: #FBE3E5; }
.sb-right a, .sb-right button, .sb-user { color: #fff; } .sb-user { border-left-color: rgba(255,255,255,.3); }
.sb-right a:hover, .sb-right button:hover, .me:hover { background: rgba(255,255,255,.18); }
.av { background: #fff; color: var(--brand); }
.login { background: linear-gradient(160deg, var(--brand) 0%, var(--brand-d) 100%); }
.launch { background: linear-gradient(160deg, var(--brand) 0%, var(--brand-d) 100%); }
.launch-tile.pos i { color: var(--brand); } .launch-tile.pos::after { background: var(--brand); }
.side nav a.on { background: var(--blue-soft); }
.toast { background: #12381F; } .toast.bad { background: var(--red); }
pre { background: #12381F; }

/* แผงพับได้: หัวแผงเต็มความกว้าง ไม่ถูกตัดขอบ */
details.panel > summary { margin: 0 -16px; } details.panel[open] > summary { margin-bottom: 14px; }


/* ราคาขายส่งตามจำนวน (สูงสุด 3 ระดับ) */
.tiers { display: flex; flex-direction: column; gap: 6px; }
.tier-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.tier-row input { width: 96px; height: 34px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; text-align: right; }
.tier-unit { min-width: 34px; color: var(--muted); } .tier-row output { color: var(--green); font-weight: 600; font-size: 13px; } .tier-row output b { font-size: 14px; }

/* ภาษาอังกฤษ: ตารางคำแปล */
.tr-table td { vertical-align: top; } .tr-table td:first-child { width: 90px; white-space: nowrap; } .tr-table .tr-th { width: 42%; white-space: pre-wrap; line-height: 1.5; padding-top: 12px; }
.tr-table input, .tr-table textarea { width: 100%; margin: 0; border: 1px solid var(--line-2); border-radius: 6px; padding: 0 10px; height: 34px; background: #fff; }
.tr-table input:placeholder-shown { background: #FFFBEB; }

/* เมนูย่อยในแถบซ้าย (แทนแท็บด้านบน) */
.side nav a.open { color: var(--blue); font-weight: 700; }
.side nav .sub { display: flex; flex-direction: column; gap: 1px; margin: 1px 0 6px; }
.side nav .sub a { height: 33px; padding-left: 28px; font-size: 13.5px; }
.pagehead { padding-bottom: 14px; }

/* ทุกหน้าในหลังบ้านเป็นคอลัมน์เดียว อ่านจากบนลงล่าง */
.cols { grid-template-columns: minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; max-width: 860px; } .stack > .panel, .stack > form.panel { margin: 0; }
.sw-list { display: flex; flex-direction: column; gap: 12px; }

/* หน้าเอกสาร: ตัวอย่างแบบฟอร์ม */
.doc-prev { margin-top: 14px; padding: 18px; background: #EEF2F7; border: 1px solid var(--line); border-radius: 8px; display: flex; justify-content: center; overflow: auto; }
#doc-receipt, #doc-pack { box-shadow: 0 2px 10px rgba(10,22,38,.12); background: #fff; }
.doc-sign { zoom: .3; box-shadow: 0 6px 30px rgba(10,22,38,.18); background: #fff; }
.pill.st-awaiting { background: #FFF4D6; color: #7A5200; }

/* ───────── โลโก้ BiGKET (ภาพตัวอักษร เขียว-เหลือง) · ขนาดตาม font-size ของ .logo ───────── */
.logo, .cd-logo { display: inline-flex; flex-direction: column; align-items: center; gap: .1em; line-height: 1; } /* โลโก้แนวตั้ง: รูปอยู่บน ตัวอักษรอยู่ล่าง */
.logo img, .cd-logo img { display: block; width: auto; flex: none; }
.logo .lg-m, .cd-logo .lg-m { height: 1.5em; } .logo .lg-w, .cd-logo .lg-w { height: 1em; }
.shellbar .logo, .launch-top .logo, .side .logo img { filter: brightness(0) invert(1); } /* บนพื้นสีเข้ม: โลโก้สีขาว */

/* ───────── หน้าต่างเลือกสินค้าในเอกสาร: หมวดหมู่ซ้าย สินค้าขวา ───────── */
.le-empty { margin: 0; padding: 18px; text-align: center; color: var(--muted); font-size: 13px; border: 1px dashed var(--line-2); border-top: 0; border-radius: 0 0 6px 6px; }
.pk-scrim { position: fixed; inset: 0; z-index: 80; background: rgba(10,22,38,.45); animation: fade .2s ease; }
.pk { position: fixed; z-index: 81; inset: 4vh 4vw; display: flex; flex-direction: column; background: #fff; border-radius: 10px; box-shadow: 0 24px 70px rgba(10,22,38,.3); overflow: hidden; }
.pk-head { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.pk-head h3 { margin: 0; font-size: 16px; } .pk-head .muted { font-size: 12.5px; }
.pk-head .pk-q { margin-left: auto; width: min(380px, 40vw); height: 34px; }
.pk-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px 1fr; }
.pk-cats { overflow: auto; border-right: 1px solid var(--line); padding: 8px; background: var(--head); }
.pk-cats button { display: flex; width: 100%; justify-content: space-between; gap: 8px; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; font-weight: 500; color: var(--text); }
.pk-cats button small { color: var(--muted); font-weight: 400; }
.pk-cats button:hover { background: #fff; } .pk-cats button.on { background: var(--blue-soft); color: var(--blue-d); font-weight: 700; }
.pk-list { overflow: auto; }
.pk-table { width: 100%; } .pk-table thead th { position: sticky; top: 0; z-index: 1; background: var(--head); }
.pk-table tbody tr { cursor: pointer; } .pk-table tbody tr:hover { background: var(--head); }
.pk-table tbody tr.on { background: var(--blue-soft); } .pk-table tr.out td { color: var(--muted); }
.pk-table td:first-child { width: 34px; } .pk-table input[type=checkbox] { pointer-events: none; }
/* แถวสินค้าเตี้ย: ช่องบาร์โค้ด (td.muted) ไม่เอาระยะ 28px + จัดกลาง ของแถว "ไม่มีข้อมูล" — คงไว้เฉพาะแถวว่างที่กินทั้งตาราง (มี colspan) */
.pk-table tbody td { padding: 4px 10px; } .pk-table tbody td.muted:not([colspan]) { text-align: left; }
.pk-table tbody td.muted[colspan] { padding: 28px 10px; }
.pk-table .pk-n { width: 84px; height: 26px; margin: 0; text-align: right; }
/* ของหมดในเอกสารที่ตัดสต็อกออก: กดเลือกไม่ได้ */
.pk-table tbody tr.off { cursor: not-allowed; background: #FAFBFC; } .pk-table tbody tr.off:hover { background: #FAFBFC; } .pk-table tr.off .pk-n { background: #F1F3F6; cursor: not-allowed; }
.pk-out { color: var(--red); font-weight: 700; }
.pk-foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); }
@media (max-width: 820px) {
  .pk { inset: 0; border-radius: 0; } .pk-head { flex-wrap: wrap; } .pk-head .pk-q { width: 100%; order: 3; }
  .pk-main { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .pk-cats { display: flex; gap: 4px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .pk-cats button { width: auto; white-space: nowrap; flex: none; }
}
