/* Manutham Order Management — components
 * โครงหน้า / ฟอร์ม / studio 3D ยกมาจาก v14 · ส่วนที่มีหัวข้อ [NEW] คือ pattern ที่เพิ่มสำหรับงานออร์เดอร์
 * ใช้ค่าจาก tokens.css เท่านั้น
 */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: var(--fs-14); line-height: var(--lh-body); color: var(--ink); background: var(--bg); overflow-wrap: anywhere; }
button, input, select, textarea { font-family: inherit; color: inherit; }
a { color: var(--mp-green-700); }
h1, h2, h3, p { margin: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--mp-mint-500); outline-offset: 3px; }
svg.ic { width: 18px; height: 18px; flex: none; }

/* ------------------------------------------------------------------ layout */
.app-sidebar { width: var(--sidebar-w); position: fixed; inset: 0 auto 0 0; background: var(--surface); border-right: 1px solid var(--line); padding: 25px 17px; display: flex; flex-direction: column; z-index: 20; overflow-y: auto; overscroll-behavior: contain; }   /* v33.98: เมนูยาวกว่าความสูงจอ (ผู้ดูแลเห็นทุกเมนู) → เลื่อนในแถบเมนูได้ — เดิมเมนูล่าง ๆ กดไม่ถึงบนจอเตี้ย */
.brand-mark { width: 138px; height: 76px; object-fit: contain; display: block; margin: 0 auto 25px; }
.nav-caption { font-size: var(--fs-10); letter-spacing: 1.6px; color: var(--ink-subtle); font-weight: var(--fw-bold); padding: 8px 14px 12px; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 48px; padding: 12px 14px; border: 0; border-radius: var(--r-lg); background: transparent; font-size: var(--fs-13); font-weight: var(--fw-medium); color: var(--ink-muted); text-align: left; cursor: pointer; transition: background var(--dur-fast); }
.nav-item svg { width: 21px; height: 21px; flex: none; }
@media (hover: hover) { .nav-item:hover { background: var(--surface-hover); } }   /* จอสัมผัสไม่ค้างสีหลังแตะ */
.nav-item[aria-current="page"] { background: var(--surface-nav); color: var(--mp-green-700); font-weight: var(--fw-bold); }
.nav-item[aria-current="page"]::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--mp-mint-500); margin-left: auto; }
.nav-bottom { margin-top: auto; padding: 15px 12px; background: var(--bg); border: 1px solid var(--line-soft); border-radius: 13px; color: var(--ink-muted); font-size: var(--fs-11); line-height: 1.8; }
.nav-bottom strong { display: block; color: var(--ink-section); font-size: var(--fs-12); }

.app-main { margin-left: var(--sidebar-w); }
.topbar { height: var(--topbar-h); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 34px; background: var(--surface-glass); }
.breadcrumb { font-size: var(--fs-12); color: var(--ink-subtle); }
.breadcrumb b { color: var(--ink-section); font-weight: var(--fw-medium); margin-left: 10px; }
.admin-chip { display: flex; align-items: center; gap: 8px; font-size: var(--fs-11); color: var(--ink-muted); }
.admin-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-tint); color: var(--mp-green-700); display: grid; place-items: center; font-weight: var(--fw-bold); }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-10); padding: 4px 8px; border-radius: var(--r-xs); background: var(--ok-bg); color: var(--ok-ink); font-weight: var(--fw-bold); }
.conn::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--mp-mint-500); }
.conn.demo { background: var(--warn-bg); color: var(--warn-ink); } .conn.demo::before { background: var(--warn-ink); }

.main-content { max-width: 1530px; margin: auto; padding: 28px 32px 40px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 23px; }
.eyebrow { font-size: var(--fs-10); letter-spacing: 1.7px; font-weight: var(--fw-bold); color: var(--mp-mint-600); margin-bottom: 6px; }
h1 { font-size: var(--fs-27); line-height: var(--lh-tight); color: var(--ink-heading); font-weight: var(--fw-bold); letter-spacing: -.7px; }
.page-heading p { font-size: var(--fs-12); color: var(--ink-subtle); margin-top: 6px; }

.workflow-strip { display: flex; flex-wrap: wrap; gap: 10px 25px; margin: 0 0 24px; padding: 0 2px; list-style: none; }
.workflow-step { display: flex; align-items: center; gap: 8px; color: var(--ink-subtle); font-size: var(--fs-11); }
.workflow-step b { width: 22px; height: 22px; border-radius: 50%; background: var(--line-soft); color: var(--ink-muted); display: grid; place-items: center; font-size: var(--fs-10); }
.workflow-step.done, .workflow-step.current { color: var(--mp-green-700); }
.workflow-step.current b { background: var(--mp-green-700); color: var(--ink-on-brand); }
.workflow-step.done b { background: var(--surface-nav); color: var(--mp-green-700); }

.work-grid { display: grid; grid-template-columns: minmax(340px, 1fr) minmax(360px, .92fr); gap: 22px; align-items: start; }
.work-grid > * { min-width: 0; }
.side-col { display: grid; gap: 22px; position: sticky; top: 18px; }
.form-pane { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 23px; }
.form-pane + .form-pane { margin-top: 22px; }
.panel-head { display: flex; align-items: center; gap: 10px; padding-bottom: 20px; margin-bottom: 22px; border-bottom: 1px solid var(--line-soft); }
.panel-icon { width: 37px; height: 37px; border-radius: var(--r-lg); background: var(--surface-tint); color: var(--mp-green-700); display: grid; place-items: center; flex: none; }
.panel-icon svg { width: 19px; height: 19px; }
.panel-head h2 { font-size: var(--fs-15); font-weight: var(--fw-bold); }
.panel-head small { display: block; color: var(--ink-subtle); margin-top: 3px; font-size: var(--fs-10); }
.panel-head .panel-aside { margin-left: auto; }
.form-section { padding-bottom: 19px; margin-bottom: 20px; border-bottom: 1px solid var(--line-soft); }
.form-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.section-kicker { display: flex; gap: 7px; align-items: center; font-size: var(--fs-12); font-weight: var(--fw-bold); margin: 0 0 14px; color: var(--ink-section); }
.section-kicker span { font-size: var(--fs-10); color: var(--ink-subtle); font-weight: var(--fw-medium); }

/* ------------------------------------------------------------------ fields */
.field { margin-bottom: 14px; min-width: 0; }
.field > label, .field-label { display: block; font-size: var(--fs-12); color: var(--ink-label); font-weight: var(--fw-medium); line-height: var(--lh-body); margin-bottom: 7px; }
.field > label .opt { color: var(--ink-subtle); font-weight: var(--fw-regular); }
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.input-grid.three { grid-template-columns: repeat(3, 1fr); }
.input-grid .wide { grid-column: 1 / -1; }
input[type=text], input[type=email], input[type=number], input[type=tel], input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: var(--control-h); padding: 11px 12px; border: 1px solid var(--line-input); border-radius: var(--r-md);
  font-size: var(--fs-14); line-height: 1.55; color: var(--ink-strong); background: var(--surface); transition: border-color var(--dur), box-shadow var(--dur); }
textarea { resize: vertical; min-height: 76px; }
textarea.memo-input { min-height: 0; line-height: 1.5; }   /* v33.22: หมายเหตุถึงช่างตัดผ้า หลายบรรทัด */
input::placeholder, textarea::placeholder { color: var(--ink-faint); font-size: var(--fs-12); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--mp-mint-700); box-shadow: var(--focus-ring); }
input:disabled, input[readonly].locked, select:disabled { background: var(--surface-off); color: var(--ink-muted); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); box-shadow: var(--danger-ring); }
input[type=number] { -moz-appearance: textfield; } input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.unit-field { position: relative; }
.unit-field input { padding-right: 52px; }
.unit-field .unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: var(--fs-11); color: var(--ink-subtle); pointer-events: none; }
.micro-hint { font-size: var(--fs-11); color: var(--ink-subtle); line-height: var(--lh-body); margin: 0 0 12px; }
.field-error { font-size: var(--fs-11); color: var(--danger-ink); margin-top: 5px; }
.note { font-size: var(--fs-12); border-radius: var(--r-md); padding: 10px 13px; line-height: var(--lh-body); margin: 0 0 14px; border: 1px solid; }
.note.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.note.danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-ink); }
.note.i-tip { background: var(--info-bg); border-color: var(--info-line); color: var(--info-ink); }

/* option cards (radio) — v14 .radio-group */
.radio-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.radio-group label { display: flex; align-items: center; gap: 8px; margin: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--r-lg); font-size: var(--fs-12); color: var(--ink-muted); background: var(--surface); cursor: pointer; }
.radio-group label:has(input:checked) { border-color: var(--mp-mint-600); background: var(--surface-sel); color: var(--mp-green-700); }
.radio-group label:has(input:focus-visible) { outline: 3px solid var(--mp-mint-500); outline-offset: 2px; }
.radio-group input { accent-color: var(--mp-green-700); width: 15px; height: 15px; margin: 0; flex: none; }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--control-h); padding: 10px 16px; border: 1px solid transparent; border-radius: var(--r-lg); font-size: var(--fs-13); font-weight: var(--fw-semibold); cursor: pointer; transition: background var(--dur-fast), border-color var(--dur-fast); }
a.btn { text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--mp-green-700); color: var(--ink-on-brand); }
.btn-primary:hover:not(:disabled) { background: var(--mp-green-900); }
.btn-soft { background: var(--ok-bg); color: var(--mp-green-700); border-color: var(--ok-line); }
.btn-soft:hover:not(:disabled) { background: var(--surface-nav); }
.btn-ghost { background: var(--surface); color: var(--ink-label); border-color: var(--line); font-weight: var(--fw-medium); font-size: var(--fs-12); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); }
.btn-danger { background: var(--surface); color: var(--danger-ink); border-color: var(--danger-line); font-weight: var(--fw-medium); font-size: var(--fs-12); }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn-block { width: 100%; }
.btn-lg { min-height: 50px; font-size: var(--fs-14); }
.btn-sm { min-height: 34px; padding: 5px 10px; font-size: var(--fs-11); border-radius: var(--r-sm); }
.btn .spinner { width: 16px; height: 16px; border-width: 2px; }
.spinner { width: 29px; height: 29px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--mp-green-700); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.chip { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 4px 10px; border-radius: var(--r-full); border: 1px solid var(--line); background: var(--surface); font-size: var(--fs-11); color: var(--ink-label); cursor: pointer; }
.chip:hover { background: var(--surface-hover); } .chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }

/* ------------------------------------------------------------------ [NEW] type picker — โมดูลจาก sidebar ของ v14 ย้ายมาเป็นขั้นแรกของออร์เดอร์ */
.type-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; border: 0; padding: 0; margin: 0; }
.type-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 9px; min-height: 92px; padding: 13px 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink-muted); font-size: var(--fs-12); font-weight: var(--fw-medium); line-height: 1.45; cursor: pointer; transition: background var(--dur-fast), border-color var(--dur-fast); }
.type-card svg { width: 22px; height: 22px; }
.type-card:hover { background: var(--surface-hover); }
.type-card input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.type-card:has(input:checked) { border-color: var(--mp-mint-600); background: var(--surface-sel); color: var(--mp-green-700); font-weight: var(--fw-bold); }
.type-card:has(input:checked)::after { content: ''; position: absolute; top: 12px; right: 12px; width: 6px; height: 6px; border-radius: 50%; background: var(--mp-mint-500); }
.type-card:has(input:focus-visible) { outline: 3px solid var(--mp-mint-500); outline-offset: 2px; }
/* v33.106: ประเภทงาน = Dropdown มีไอคอน + ค้นหา (การ์ดเดิมซ่อน เป็นที่เก็บค่า) */
.type-picker.is-combo { display: none !important; }
.type-combo { position: relative; max-width: 560px; }
.type-trigger { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 9px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink-strong); text-align: left; cursor: pointer; font: inherit; }
.type-trigger:hover { background: var(--surface-hover); } .type-trigger:focus-visible { outline: 3px solid var(--mp-mint-500); outline-offset: 2px; }
.type-combo.open .type-trigger { border-color: var(--mp-mint-600); }
.type-trigger .tc-ic, .type-opt .to-ic { flex: 0 0 auto; display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-md, 10px); background: var(--surface-sel); color: var(--mp-green-700); }
.type-trigger .tc-ic svg, .type-opt .to-ic svg { width: 22px; height: 22px; }
.type-trigger .tc-txt, .type-opt .to-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.type-trigger .tc-txt b { font-size: var(--fs-15, 15px); color: var(--mp-green-700); }
.type-trigger .tc-txt small, .type-opt .to-txt small { font-size: var(--fs-12, 12px); color: var(--ink-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-trigger .tc-txt .tc-k { font-size: var(--fs-11, 11px); color: var(--ink-subtle); }
.type-trigger .tc-caret { margin-left: auto; width: 18px; height: 18px; color: var(--ink-subtle); transition: transform .15s; } .type-combo.open .tc-caret { transform: rotate(180deg); }
.type-pop { position: absolute; z-index: 45; left: 0; right: 0; top: calc(100% + 4px); padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg, 0 12px 32px rgba(16, 24, 40, .16)); }
.type-pop .type-search { width: 100%; margin-bottom: 6px; }
.type-pop .type-list { position: static; max-height: min(360px, 55vh); border: 0; box-shadow: none; padding: 0; }
.type-opt { align-items: center; min-height: 52px; } .type-opt .to-txt b { font-size: var(--fs-14, 14px); font-weight: var(--fw-medium, 500); }
.type-opt[aria-current="true"] .to-txt b { font-weight: var(--fw-bold, 700); } .type-opt .to-on { color: var(--mp-mint-600); font-weight: 700; }
@media (max-width: 760px) { .type-combo { max-width: none; } .type-pop .type-search { font-size: 16px; } .type-opt { min-height: 56px; } }

/* ------------------------------------------------------------------ [NEW] combobox — ค้นหาลูกค้า / สินค้า / จังหวัด-อำเภอ-ตำบล */
.combo { position: relative; }
.combo input { padding-right: 38px; }
.combo .combo-caret { position: absolute; right: 12px; top: 22px; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-subtle); pointer-events: none; }
.combo-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(var(--control-h) + 4px); max-height: 288px; overflow: auto; margin: 0; padding: 5px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); }
.combo-opt { display: flex; align-items: baseline; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: var(--fs-13); color: var(--ink-strong); }
.combo-opt small { color: var(--ink-subtle); font-size: var(--fs-11); }
.combo-opt .end { margin-left: auto; white-space: nowrap; color: var(--ink-muted); font-size: var(--fs-12); }
.combo-opt[aria-selected="true"], .combo-opt:hover { background: var(--surface-sel); color: var(--mp-green-700); }
.combo-empty { padding: 12px 10px; font-size: var(--fs-12); color: var(--ink-subtle); }
.combo-more { padding: 6px 10px 4px; font-size: var(--fs-10); color: var(--ink-subtle); }

/* เอนทิตีที่เลือกแล้ว (ลูกค้า / สินค้า) */
.picked { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--ok-line); background: var(--surface-sel); border-radius: var(--r-lg); margin-bottom: 14px; }
.picked-main { min-width: 0; flex: 1; }
.picked-main b { display: block; font-size: var(--fs-14); color: var(--ink-heading); font-weight: var(--fw-semibold); }
.picked-main span { font-size: var(--fs-12); color: var(--ink-muted); }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.kv .field input { background: var(--surface-off); }
.kv .field input.cust-editable { background: var(--surface, #fff); border-color: var(--brand, #09355c); }   /* v33.20: แก้ชื่อ/เบอร์ได้ตอนแก้ไขออร์เดอร์ */
#custEditNote { margin-top: 8px; }

/* ------------------------------------------------------------------ [NEW] ผลคำนวณคอลัมน์ N */
.calc-box { border: 1px solid var(--line-soft); background: var(--surface-soft); border-radius: var(--r-lg); padding: 14px 15px; margin-bottom: 14px; }
.calc-box .calc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.calc-box .calc-label { font-size: var(--fs-11); color: var(--ink-muted); }
.calc-box .calc-value { font-size: var(--fs-21); font-weight: var(--fw-bold); color: var(--ink-strong); letter-spacing: -.5px; }
.calc-box .calc-value small { font-size: var(--fs-12); font-weight: var(--fw-medium); color: var(--ink-muted); margin-left: 4px; }
.calc-box ul { margin: 8px 0 0; padding: 8px 0 0 16px; border-top: 1px dashed var(--line); font-size: var(--fs-11); color: var(--ink-muted); line-height: var(--lh-loose); }
.calc-box.ready { background: var(--surface-sel); border-color: var(--ok-line); }

/* ------------------------------------------------------------------ [NEW] รายการสินค้าในออร์เดอร์ */
.line-items { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.line-item { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.line-item.editing { border-color: var(--mp-mint-600); background: var(--surface-sel); }
.line-no { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-tint); color: var(--mp-green-700); font-size: var(--fs-11); font-weight: var(--fw-bold); display: grid; place-items: center; margin-top: 1px; }
.line-body b { font-size: var(--fs-13); font-weight: var(--fw-semibold); color: var(--ink-heading); display: block; }
.line-body span { font-size: var(--fs-11); color: var(--ink-muted); display: block; line-height: 1.7; }
.line-body .badge { display: inline-flex; vertical-align: 2px; font-size: var(--fs-10); color: var(--ink-muted); } .line-body .badge.ok { color: var(--ok-ink); } .line-body .badge.warn { color: var(--warn-ink); }
.line-amt { text-align: right; font-size: var(--fs-14); font-weight: var(--fw-bold); color: var(--ink-strong); white-space: nowrap; }
.line-actions { grid-column: 2 / -1; display: flex; gap: 6px; margin-top: 4px; }
.empty { border: 1px dashed var(--line); border-radius: 13px; padding: 22px; text-align: center; color: var(--ink-subtle); font-size: var(--fs-12); margin-bottom: 14px; }

/* ------------------------------------------------------------------ [NEW] สลิป */
.slip-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px; border: 1.5px dashed var(--line-input); border-radius: var(--r-lg); background: var(--surface-soft); text-align: center; font-size: var(--fs-12); color: var(--ink-muted); cursor: pointer; transition: background var(--dur-fast), border-color var(--dur-fast); }
.slip-drop:hover, .slip-drop.over { background: var(--surface-sel); border-color: var(--mp-mint-600); }
.slip-drop:has(input:focus-visible) { outline: 3px solid var(--mp-mint-500); outline-offset: 2px; }
.slip-drop b { color: var(--mp-green-700); font-weight: var(--fw-semibold); }
.slip-drop[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.slip-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.slip-thumb { position: relative; aspect-ratio: 3 / 4; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--surface-off); }
.slip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slip-thumb figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 5px; font-size: var(--fs-9); color: var(--ink-on-brand); background: var(--overlay-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slip-thumb button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--surface-float); color: var(--danger-ink); font-size: 16px; line-height: 1; cursor: pointer; }

/* ------------------------------------------------------------------ [NEW] สรุปยอด */
.totals { display: grid; gap: 7px; font-size: var(--fs-13); margin: 0; }
.totals div { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-muted); }
.totals dt { font-weight: var(--fw-regular); } .totals dd { margin: 0; color: var(--ink-strong); font-weight: var(--fw-medium); white-space: nowrap; }
.totals .grand { margin-top: 6px; padding: 14px 15px; border-radius: var(--r-lg); background: var(--mp-green-700); color: var(--ink-on-brand); align-items: baseline; }
.totals .grand dt { font-size: var(--fs-12); } .totals .grand dd { color: var(--ink-on-brand); font-size: var(--fs-21); font-weight: var(--fw-bold); letter-spacing: -.5px; }
.totals .minus dd { color: var(--danger-ink); }
.sheet-map { font-size: var(--fs-10); color: var(--ink-subtle); margin-top: 10px; line-height: var(--lh-loose); }
.col-tag { display: inline-block; min-width: 18px; padding: 0 4px; margin-right: 4px; border-radius: 4px; background: var(--surface-tint); color: var(--mp-green-700); font-size: var(--fs-9); font-weight: var(--fw-bold); text-align: center; vertical-align: 1px; }

/* ------------------------------------------------------------------ [NEW] ตารางออร์เดอร์ + สถานะ */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .combo, .toolbar .search { flex: 1; min-width: 220px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); }
.order-table { width: 100%; border-collapse: collapse; font-size: var(--fs-13); min-width: 760px; }
.order-table th { text-align: left; font-size: var(--fs-11); font-weight: var(--fw-semibold); color: var(--ink-muted); padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-soft); white-space: nowrap; }
.order-table td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.order-table tr:last-child td { border-bottom: 0; }
.order-table tbody tr { cursor: pointer; } .order-table tbody tr:hover { background: var(--surface-hover); }
.order-table .num { text-align: right; font-weight: var(--fw-semibold); white-space: nowrap; }
.order-table .mono { font-weight: var(--fw-semibold); color: var(--ink-heading); white-space: nowrap; }
.order-table small { display: block; color: var(--ink-subtle); font-size: var(--fs-11); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: var(--r-xs); font-size: var(--fs-10); font-weight: var(--fw-bold); white-space: nowrap; background: var(--surface-tint); color: var(--ink-muted); }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); } .badge.warn { background: var(--warn-bg); color: var(--warn-ink); } .badge.i-tip { background: var(--info-bg); color: var(--info-ink); }

.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; list-style: none; margin: 0; padding: 0; }
.step { position: relative; text-align: center; font-size: var(--fs-11); color: var(--ink-subtle); padding-top: 34px; line-height: 1.5; }
.step::before { content: ''; position: absolute; top: 12px; left: -50%; right: 50%; height: 2px; background: var(--line); }
.step:first-child::before { display: none; }
.step i { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 26px; height: 26px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); display: grid; place-items: center; font-style: normal; font-size: var(--fs-11); font-weight: var(--fw-bold); color: var(--ink-subtle); z-index: 1; }
.step.done { color: var(--mp-green-700); font-weight: var(--fw-semibold); } .step.done i { background: var(--mp-green-700); border-color: var(--mp-green-700); color: var(--ink-on-brand); }
.step.done::before { background: var(--mp-green-700); }
.step small { display: block; font-weight: var(--fw-regular); color: var(--ink-subtle); font-size: var(--fs-10); }
.readonly-tag { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-10); color: var(--ink-subtle); }

/* ------------------------------------------------------------------ dialog / toast */
dialog.sheet { border: 0; border-radius: var(--r-2xl); padding: 0; width: min(720px, calc(100vw - 24px)); max-height: 92dvh; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-modal); }
dialog.sheet::backdrop { background: var(--scrim); backdrop-filter: blur(4px); }
dialog.sheet[open] { display: flex; flex-direction: column; }
dialog.sheet.narrow { width: min(400px, calc(100vw - 24px)); }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); flex: none; }
.sheet-head h2 { font-size: var(--fs-16); font-weight: var(--fw-bold); color: var(--ink-heading); } .sheet-head p { font-size: var(--fs-11); color: var(--ink-subtle); }
.sheet-close { margin-left: auto; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--surface-tint); color: var(--ink-section); font-size: 24px; line-height: 1; cursor: pointer; flex: none; }
.sheet-body { padding: 20px; overflow: auto; flex: 1 1 auto; min-height: 0; -webkit-overflow-scrolling: touch; }   /* flex-basis auto: Safari/iPhone ย่อ 0% จนเนื้อหาหาย */
.sheet-foot { padding: 14px 20px max(16px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; flex: none; }
.sheet-foot .btn { flex: 1; }
.success-mark { width: 54px; height: 54px; border-radius: 50%; background: var(--ok-bg); color: var(--mp-green-700); display: grid; place-items: center; margin: 4px auto 12px; } .success-mark svg { width: 26px; height: 26px; }
.link-box { display: flex; gap: 8px; align-items: stretch; margin-top: 8px; } .link-box input { font-size: var(--fs-12); background: var(--surface-soft); }
.toast { position: fixed; bottom: 28px; left: calc(50% + var(--sidebar-w) / 2); transform: translate(-50%, 15px); background: var(--mp-green-800); color: var(--ink-on-brand); font-size: var(--fs-12); padding: 13px 20px; border-radius: 11px; box-shadow: var(--shadow-toast); z-index: 100; opacity: 0; pointer-events: none; transition: var(--dur); max-width: 85vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); } .toast.error { background: var(--danger-ink); }
.skeleton { border-radius: var(--r-md); background: linear-gradient(90deg, var(--line-soft), var(--surface-soft), var(--line-soft)); background-size: 200% 100%; animation: sk 1.2s linear infinite; min-height: 44px; } @keyframes sk { to { background-position: -200% 0; } }

/* ------------------------------------------------------------------ studio 3D (v14 — ไม่แก้พฤติกรรม) */
.studio { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden; min-width: 0; }
.studio-head { padding: 20px 21px 13px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.studio-head h2 { font-size: var(--fs-14); } .studio-head p { font-size: var(--fs-11); color: var(--ink-subtle); margin-top: 4px; }
.live-pill { font-size: var(--fs-9); font-weight: var(--fw-bold); border-radius: var(--r-xs); background: var(--ok-bg); padding: 5px 7px; color: var(--ok-ink); letter-spacing: .5px; white-space: nowrap; }
.live-pill::before { content: ''; width: 5px; height: 5px; background: var(--mp-mint-500); display: inline-block; border-radius: 50%; margin-right: 5px; }
.mode-tabs { display: flex; background: var(--surface-sunk); border-radius: var(--r-md); padding: 4px; margin: 0 20px 12px; gap: 3px; }
.mode-tabs button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 6px 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink-muted); font-size: var(--fs-12); cursor: pointer; }
.mode-tabs button.active { background: var(--surface); color: var(--mp-green-700); box-shadow: var(--shadow-raise); font-weight: var(--fw-bold); }
.mode-tabs svg { width: 15px; height: 15px; }
.studio-canvas-wrap { height: 400px; position: relative; background: var(--canvas-sky); overflow: hidden; }
.studio-canvas-wrap canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; outline: none; }
.studio-canvas-wrap canvas:active { cursor: grabbing; }
.studio-canvas-wrap canvas:focus-visible { outline: 3px solid var(--mp-mint-500); outline-offset: -3px; }
#modelOverlay { position: absolute; inset: 0; pointer-events: none; width: 100%; height: 100%; }
.view-hint { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: var(--fs-11); color: var(--ink-subtle); padding: 10px 4px; border-bottom: 1px solid var(--line-soft); }
.view-hint svg { width: 13px; height: 13px; }
.studio-tools { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; padding: 12px 18px; gap: 8px; }
.camera-tools { display: flex; flex-wrap: wrap; gap: 5px; }
.camera-tools button { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 38px; min-width: 38px; padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink-muted); font-size: var(--fs-11); cursor: pointer; }
.camera-tools button.active { background: var(--surface-nav); color: var(--mp-green-700); border-color: var(--ok-line); }
.camera-tools svg { width: 13px; height: 13px; }
.water-toggle { font-size: var(--fs-11); color: var(--ink-muted); display: flex; align-items: center; gap: 5px; white-space: nowrap; cursor: pointer; }
.water-toggle input { width: 14px; height: 14px; accent-color: var(--mp-green-700); }
.layer-legend { display: flex; flex-wrap: wrap; gap: 8px 13px; margin: 0 18px 13px; padding: 10px 12px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--r-md); font-size: var(--fs-10); color: var(--ink-muted); }
.layer-legend span { display: flex; align-items: center; gap: 5px; } .layer-legend i { width: 10px; height: 10px; display: inline-block; border-radius: 3px; flex: none; }
.spec-strip { margin: 0 18px 13px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); display: grid; grid-template-columns: 1fr 1fr 1fr; }
.spec-strip div { padding: 11px 10px; border-right: 1px solid var(--line-soft); } .spec-strip div:last-child { border-right: 0; }
.spec-strip small { display: block; font-size: var(--fs-10); color: var(--ink-subtle); margin-bottom: 4px; } .spec-strip b { font-size: var(--fs-12); font-weight: var(--fw-semibold); color: var(--ink-section); overflow-wrap: anywhere; }
.studio-foot { padding: 0 18px 17px; } .model-note { font-size: var(--fs-11); color: var(--ink-subtle); line-height: 1.8; }
.fallback { padding: 35px; color: var(--ink-section); text-align: center; position: absolute; inset: 0; display: grid; place-items: center; background: var(--surface-soft); }
.studio:fullscreen, .studio.is-fullscreen { border: 0; border-radius: 0; overflow: auto; padding-bottom: env(safe-area-inset-bottom); }
.studio.is-fullscreen { position: fixed !important; inset: 0 !important; z-index: 80 !important; width: 100% !important; height: 100dvh !important; }
.studio:fullscreen .studio-canvas-wrap, .studio.is-fullscreen .studio-canvas-wrap { height: 62svh !important; }
.studio:fullscreen .spec-strip, .studio:fullscreen .studio-foot, .studio.is-fullscreen .spec-strip, .studio.is-fullscreen .studio-foot { display: none; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1150px) {
  :root { --sidebar-w: 180px; }
  .app-sidebar { padding: 20px 12px; } .main-content { padding: 23px 22px; }
  .work-grid { grid-template-columns: 1fr; } .side-col { position: static; }
  .studio-canvas-wrap { height: 360px; }
}
@media (max-width: 760px) {
  :root { --sidebar-w: 0px; }
  .app-sidebar { position: static; width: 100%; padding: 12px 16px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand-mark { width: 94px; height: 51px; margin: 0 0 11px; } .nav-caption, .nav-bottom { display: none; }
  .nav { flex-direction: row; gap: 5px; padding-bottom: 10px; overflow-x: auto; }
  .nav-item { width: auto; white-space: nowrap; min-height: 40px; padding: 8px 12px; font-size: var(--fs-12); } .nav-item svg { width: 16px; height: 16px; } .nav-item[aria-current="page"]::after { display: none; }
  .app-main { margin: 0; } .topbar { padding: 0 17px; height: 47px; } .admin-chip .who { display: none; }
  .main-content { padding: 22px 15px 40px; } h1 { font-size: 23px; }
  .form-pane { padding: 19px 15px; } .workflow-strip { gap: 8px 14px; }
  .type-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); } .type-card { min-height: 70px; flex-direction: row; align-items: center; }
  .input-grid.three, .kv { grid-template-columns: 1fr 1fr; } .kv .wide-sm { grid-column: 1 / -1; }
  .slip-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .studio-canvas-wrap { height: 320px; }
  input[type=text], input[type=email], input[type=number], input[type=tel], input[type=password], input[type=search], select, textarea { font-size: var(--fs-16); } /* กัน iOS ซูมตอนโฟกัส */
  .sheet-foot .btn { flex: 1 1 100%; }
}
@media (max-width: 420px) { .input-grid, .input-grid.three, .radio-group { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media print { .app-sidebar, .topbar, .studio, .toast { display: none !important; } .app-main { margin: 0; } }

/* ---------- พิมพ์ใบจ่าหน้ารวม ---------- */
.print-batch { border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); margin-bottom: 16px; }
.print-batch > summary { padding: 14px 16px; cursor: pointer; list-style: none; }
.print-batch > summary::-webkit-details-marker { display: none; }
.print-batch > summary::before { content: "▸"; margin-right: 8px; color: var(--ink-muted); }
.print-batch[open] > summary::before { content: "▾"; }
.print-batch-body { padding: 0 16px 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.print-batch-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; max-height: 320px; overflow-y: auto; }
.print-batch-list label { display: flex; gap: 10px; align-items: baseline; font-size: var(--fs-13); padding: 6px 8px; border-radius: var(--r-md); }
.print-batch-list label:hover { background: var(--surface-2, #f4f5f6); }
.print-batch-list input { width: 16px; height: 16px; accent-color: var(--mp-green-700); transform: translateY(2px); }
@media print { .print-batch { display: none; } }

/* ราคาต่อหน่วย: ล็อกตาม Product Detail */
input.price-locked { background: var(--surface-2, #f2f4f5); color: var(--ink-strong); font-weight: 600; cursor: not-allowed; }
input.price-locked:focus { box-shadow: none; border-color: var(--line-input); }

/* ================================================================== Tablet (iPad) + Phone
 * ≥1151px  : เมนูข้างเต็ม (desktop / iPad แนวนอนจอใหญ่)
 * 761–1150 : iPad แนวตั้ง / แนวนอนจอเล็ก → เมนูข้างแบบ "ราง" ไอคอน + ชื่อสั้น (กว้าง 92px) ให้เนื้อหาได้พื้นที่เต็ม
 * ≤760     : โทรศัพท์ → แถบเมนูด้านล่างแบบแอป (เอื้อมนิ้วโป้งถึง) + โลโก้เล็กบน topbar · ตารางกลายเป็นการ์ด
 */
.topbar-logo { display: none; }
.breadcrumb { min-width: 0; }
.page-heading { flex-wrap: wrap; }
.page-heading > .btn, .page-heading > div:last-child .btn { white-space: nowrap; }
.btn { white-space: nowrap; }
#logoutBtn { white-space: nowrap; }

@media (min-width: 761px) and (max-width: 1150px) {
  :root { --sidebar-w: 92px; }
  .app-sidebar { padding: 16px 8px; align-items: stretch; }
  .brand-mark { width: 72px; height: 42px; margin: 0 auto 18px; }
  .nav-caption, .nav-bottom { display: none; }
  .nav { gap: 4px; }
  .nav-item { flex-direction: column; justify-content: center; gap: 5px; min-height: 64px; padding: 9px 4px; text-align: center; border-radius: var(--r-lg); }
  .nav-item svg { width: 22px; height: 22px; }
  .nav-item .nav-label { font-size: 0; line-height: 1.2; }
  .nav-item .nav-label::after { content: attr(data-short); font-size: 11px; }
  .nav-item[aria-current="page"]::after { display: none; }
  .main-content { padding: 22px 22px 40px; }
  .topbar { padding: 0 22px; }
}

@media (max-width: 760px) {
  :root { --sidebar-w: 0px; --tabbar-h: 62px; }
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  /* แถบเมนูล่าง */
  .app-sidebar { position: fixed; inset: auto 0 0 0; top: auto; width: 100%; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 4px env(safe-area-inset-bottom);
    border-right: 0; border-top: 1px solid var(--line); border-bottom: 0; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); z-index: 60; }
  .brand-mark, .nav-caption, .nav-bottom, .nav-group-label { display: none; }
  .nav-item.nav-overflow { display: none; }            /* โมดูลลำดับที่ 5 ขึ้นไป → อยู่ในแผ่น "เมนู" */
  .nav .nav-item.nav-more { display: flex; }
  .nav { flex-direction: row; height: var(--tabbar-h); gap: 0; padding: 0; overflow: visible; }
  .nav-item { flex: 1 1 0; min-width: 0; width: auto; flex-direction: column; justify-content: center; gap: 3px; min-height: 0; height: 100%; padding: 6px 2px; border-radius: 12px; font-size: 0; text-align: center; color: var(--ink-subtle); }
  .nav-item svg { width: 22px; height: 22px; }
  .nav-item .nav-label { font-size: 0; }
  .nav-item .nav-label::after { content: attr(data-short); font-size: 10.5px; font-weight: var(--fw-medium); }
  .nav-item[aria-current="page"] { background: transparent; color: var(--mp-green-700); }
  .nav-item[aria-current="page"] svg { background: var(--surface-nav); border-radius: 999px; padding: 3px 12px; width: 46px; height: 28px; box-sizing: border-box; }
  .nav-item[aria-current="page"]::after { display: none; }
  /* topbar: โลโก้ + ชื่อหน้า · ติดบนตอนเลื่อน */
  .topbar { position: sticky; top: 0; z-index: 40; height: calc(52px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0; gap: 8px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  .topbar-logo { display: block; width: 46px; height: 28px; object-fit: contain; flex: none; }
  .breadcrumb { flex: 1; font-size: var(--fs-14); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .breadcrumb .crumb-root { display: none; }
  .breadcrumb b { margin-left: 0; font-weight: var(--fw-bold); color: var(--ink-heading, var(--ink-section)); }
  .admin-chip { gap: 6px; flex: none; }
  .admin-chip .conn { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; padding: 4px 8px; }
  #logoutBtn { padding: 6px 10px; min-height: 34px; font-size: 12px; }
  .main-content { padding: 18px 14px 28px; }
  .page-heading { gap: 10px; margin-bottom: 16px; }
  .page-heading .eyebrow { display: none; }
  /* ตาราง → การ์ด */
  .table-wrap { border: 0; background: transparent; overflow: visible; }
  .order-table { min-width: 0; }
  .order-table thead { display: none; }
  .order-table, .order-table tbody { display: block; }
  .order-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 14px; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); }
  .order-table td { display: block; padding: 0; border: 0; text-align: left; font-size: var(--fs-13); min-width: 0; }
  .order-table td::before { content: attr(data-label); display: block; font-size: 10.5px; color: var(--ink-subtle); margin-bottom: 1px; }
  .order-table td:not([data-label])::before, .order-table td.card-title::before { content: none; }
  .order-table td.card-title, .order-table td.mono { grid-column: 1 / -1; font-size: var(--fs-14); }
  .order-table td.num { text-align: left; }
  .order-table td.card-action { grid-column: 1 / -1; }
  .order-table td.card-action .btn { width: 100%; justify-content: center; }
  .order-table small { display: block; }
  /* ปุ่มลอย/แจ้งเตือนไม่ทับแถบล่าง */
  .toast { left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); }
  dialog.sheet, dialog.sheet.narrow { width: 100vw; max-width: 100vw; max-height: 94dvh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .print-toolbar { flex-direction: column; align-items: stretch; }
}

/* ================================================================== Dashboard */
.dash-head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; align-self: flex-end; }   /* v33.68 */
@media (max-width: 760px) { .dash-head-right { align-items: stretch; align-self: stretch; } .dash-head-right #dashExport { align-self: flex-start; } }
.dash-range { display: flex; flex-wrap: wrap; background: var(--surface-sunk, #eef0f1); border-radius: var(--r-md); padding: 4px; gap: 3px; align-self: flex-end; }
.dash-range button, .seg button { min-height: 36px; padding: 6px 12px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink-muted); font-size: var(--fs-12); cursor: pointer; white-space: nowrap; }
.dash-range button[aria-pressed="true"] { background: var(--surface); color: var(--mp-green-700); font-weight: var(--fw-bold); box-shadow: var(--shadow-raise); }
.dash-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.dash-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dash-kpi > span { font-size: var(--fs-12); color: var(--ink-subtle); }
.dash-kpi > b { font-size: 24px; line-height: 1.2; color: var(--ink-heading, var(--mp-green-800)); overflow-wrap: anywhere; }
.dash-chg { font-size: 11.5px; color: var(--ink-subtle); } .dash-chg.up { color: var(--mp-green-700); } .dash-chg.down { color: #b3261e; }
.dash-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 16px 18px; margin-bottom: 12px; min-width: 0; }
.dash-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.dash-card-head h3 { font-size: var(--fs-14); margin: 0; }
.dash-chart { overflow-x: auto; }
.dash-bars { display: block; width: 100%; min-width: 320px; height: auto; max-height: 240px; }
.dash-bars rect { fill: var(--mp-green-700); } .dash-bars g:hover rect { fill: var(--mp-mint-500); }
.dash-bars text { font-size: 10px; fill: var(--ink-subtle); text-anchor: middle; } .dash-bars line { stroke: var(--line); }
.dash-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.dash-step { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; background: var(--bg); }
.dash-step b { font-size: 22px; line-height: 1.1; } .dash-step span { font-size: 11.5px; color: var(--ink-subtle); }
.dash-step.done { background: var(--surface-nav); } .dash-step.done b { color: var(--mp-green-700); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .dash-grid .dash-card { margin-bottom: 12px; }
.dash-list { display: flex; flex-direction: column; gap: 10px; }
.dash-row-top { display: flex; justify-content: space-between; gap: 10px; font-size: var(--fs-13); } .dash-row-top span { min-width: 0; overflow-wrap: anywhere; } .dash-row-top b { white-space: nowrap; font-size: 12.5px; }
.dash-meter { height: 6px; border-radius: 99px; background: var(--surface-sunk, #eef0f1); margin-top: 4px; overflow: hidden; } .dash-meter i { display: block; height: 100%; background: var(--mp-green-700); border-radius: 99px; }

/* ================================================================== แท็บ + ตำแหน่งและสิทธิ */
.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs-line button { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; border: 0; background: none; font-size: var(--fs-13); color: var(--ink-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs-line button svg { width: 17px; height: 17px; }
.tabs-line button[aria-selected="true"] { color: var(--mp-green-700); font-weight: var(--fw-bold); border-bottom-color: var(--mp-green-700); }
.pane-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; } .pane-bar p { flex: 1 1 320px; }
.roles-table th.c, .roles-table td.c { text-align: center; }
.roles-table th { white-space: normal; font-size: 11.5px; line-height: 1.3; vertical-align: bottom; }
.perm { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-weight: 700; font-size: 13px; }
.perm.yes { background: var(--surface-nav); color: var(--mp-green-700); } .perm.no { color: var(--ink-faint); }
.perm-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.perm-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft, var(--line)); font-size: var(--fs-13); cursor: pointer; }
.perm-row:last-child { border-bottom: 0; }
.perm-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--mp-green-700); flex: none; }
.perm-row select { width: auto; min-height: 36px; padding: 6px 10px; }

@media (max-width: 1150px) { .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-steps { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; } .dash-step { padding: 8px 6px; text-align: center; } .dash-step b { font-size: 18px; } .dash-step span { font-size: 10px; }
  .dash-kpi { padding: 12px 14px; } .dash-kpi > b { font-size: 19px; }
  .dash-range { width: 100%; justify-content: space-between; } .dash-range button { flex: 1; padding: 6px 4px; }
  .roles-table tr { grid-template-columns: 1fr 1fr 1fr; }
  .roles-table td.c { text-align: left; }
}


/* Dashboard: กำหนดช่วงวันที่เอง */
.dash-custom { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 14px 16px; margin-bottom: 12px; }
.dash-custom .field { margin: 0; min-width: 150px; } .dash-custom input[type=date] { min-height: 42px; }
.dash-quick { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 260px; }
.dash-quick button { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 12px; font-size: var(--fs-12); color: var(--ink-muted); cursor: pointer; min-height: 34px; }
.dash-quick button:hover { border-color: var(--mp-green-700); color: var(--mp-green-700); }
input[type=date] { width: 100%; padding: 9px 12px; border: 1px solid var(--line-input); border-radius: var(--r-md); font-size: var(--fs-14); color: var(--ink-strong); background: var(--surface); }
@media (max-width: 760px) { .dash-custom .field { flex: 1 1 40%; min-width: 0; } .dash-custom .btn { flex: 1 1 100%; } input[type=date] { font-size: 16px; } .dash-range button { padding: 6px 2px; font-size: 11.5px; } }

/* ================================================================== Kanban ลีดลูกค้า */
.leads-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.leads-toolbar input[type=search] { flex: 1 1 260px; max-width: 420px; }
.owner-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.owner-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 6px 5px 12px; font-size: var(--fs-12); color: var(--ink-muted); cursor: pointer; min-height: 32px; }
.owner-chip b { background: var(--surface-sunk, #eef0f1); border-radius: 999px; padding: 1px 8px; font-size: 11px; }
.owner-chip[aria-pressed="true"] { border-color: var(--mp-green-700); color: var(--mp-green-700); font-weight: var(--fw-bold); } .owner-chip[aria-pressed="true"] b { background: var(--surface-nav); }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: start; scroll-snap-type: x proximity; }
.lane { background: var(--surface-sunk, #eef0f2); border-radius: var(--r-xl); padding: 10px; min-height: 160px; scroll-snap-align: start; transition: background .15s, box-shadow .15s; }
.lane.drop { background: var(--surface-nav); box-shadow: inset 0 0 0 2px var(--mp-mint-500); }
.lane-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; font-size: var(--fs-13); }
.lane-count { background: var(--surface); border-radius: 999px; padding: 1px 9px; font-size: 11.5px; color: var(--ink-muted); font-weight: 700; }
.lane-body { display: flex; flex-direction: column; gap: 8px; }
.lane-empty { font-size: 11.5px; color: var(--ink-faint); text-align: center; padding: 18px 0; margin: 0; }
.lead-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 11px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 5px; box-shadow: 0 1px 2px #0e202f08; }
.lead-card:hover { border-color: var(--mp-mint-500); } .lead-card[draggable="true"] { cursor: grab; } .lead-card.dragging { opacity: .45; }
.lead-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; } .lead-top b { font-size: var(--fs-13); line-height: 1.35; } .lead-top small { font-size: 10.5px; color: var(--ink-faint); white-space: nowrap; }
.lead-meta { font-size: 11.5px; color: var(--ink-muted); } .lead-meta:empty { display: none; }
.lead-note { margin: 0; font-size: 11.5px; color: var(--ink-subtle); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lead-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 2px; } .lead-foot small { font-size: 10.5px; color: var(--ink-faint); white-space: nowrap; }
.owner-tag { display: inline-flex; align-items: center; gap: 5px; max-width: 70%; padding: 2px 9px 2px 6px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: hsl(var(--h) 60% 93%); color: hsl(var(--h) 45% 28%); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.owner-tag i { width: 7px; height: 7px; border-radius: 50%; background: hsl(var(--h) 55% 45%); flex: none; }
.owner-tag.none { background: #f3efe6; color: #7a6a45; padding-left: 9px; }
.lead-dl { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px 14px; margin: 0 0 12px; font-size: var(--fs-13); }
.lead-dl dt { color: var(--ink-subtle); } .lead-dl dd { margin: 0; overflow-wrap: anywhere; }
#leadDlgSub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.lead-move { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; } .lead-move label { font-size: var(--fs-12); color: var(--ink-subtle); white-space: nowrap; } .lead-move select { flex: 1; min-height: 42px; }
@media (max-width: 760px) {
  .kanban { grid-auto-columns: 84%; gap: 10px; margin: 0 -14px; padding: 0 14px 10px; scroll-snap-type: x mandatory; scroll-padding: 0 14px; }
  .leads-toolbar input[type=search] { max-width: none; }
  .owner-chips { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; } .owner-chip { flex: none; }
  .lead-dl { grid-template-columns: 1fr; gap: 2px; } .lead-dl dd { margin-bottom: 8px; }
}

/* สีสถานะ = สีชิป dropdown ใน Google Sheet */
.lane { --tone-bg: #eef0f2; --tone-chip: #e3e6e8; --tone-ink: #3f464d; --tone-line: transparent; background: var(--tone-bg); border-top: 3px solid var(--tone-line); }
.tone-blue   { --tone-bg: #eef3fb; --tone-chip: #d3e3fd; --tone-ink: #0b57d0; --tone-line: #a8c7fa; }
.tone-yellow { --tone-bg: #fcf8ea; --tone-chip: #fdefc3; --tone-ink: #7a5b00; --tone-line: #f5d77a; }
.tone-purple { --tone-bg: #f5f0fb; --tone-chip: #e8dcf9; --tone-ink: #6b3fb0; --tone-line: #cfb8f0; }
.tone-orange { --tone-bg: #fcf1ea; --tone-chip: #f9dcc7; --tone-ink: #9a4a14; --tone-line: #f0b893; }
.tone-green  { --tone-bg: #edf2f6; --tone-chip: #d3e1ed; --tone-ink: #1c476d; --tone-line: #a6c1d9; }
.tone-red    { --tone-bg: #fbefee; --tone-chip: #f6d6d3; --tone-ink: #a3261c; --tone-line: #eeaaa4; }
.tone-teal   { --tone-bg: #eaf6f6; --tone-chip: #ccddec; --tone-ink: #0d3e68; --tone-line: #91b5d5; }
.tone-pink   { --tone-bg: #fbf0f6; --tone-chip: #f6d8e8; --tone-ink: #9c2a66; --tone-line: #eeb0d0; }
.tone-gray   { --tone-bg: #f1f2f1; --tone-chip: #e3e5e3; --tone-ink: #5b635e; --tone-line: #cfd2d4; }
.status-chip { display: inline-block; background: var(--tone-chip, #e3e5e3); color: var(--tone-ink, #3f464d); border-radius: 999px; padding: 3px 11px; font-size: 12.5px; font-weight: 700; line-height: 1.4; }
.lane.drop { box-shadow: inset 0 0 0 2px var(--tone-ink); }

.perm-row .perm-note { display: block; font-size: 11px; color: var(--ink-subtle); font-weight: 400; margin-top: 2px; }

/* หน้าบันทึกสำเร็จ: 2 ปุ่มเท่ากัน */
.success-foot .btn { flex: 1 1 0; justify-content: center; }
@media (max-width: 760px) { .success-foot .btn { flex: 1 1 0; } }


/* ================= v14.1: แบ่ง Section ให้ชัดขึ้น (เสริมจากดีไซน์เดิม) ================= */
.form-section { position: relative; background: var(--card, #fff); border: 1px solid var(--line, #e3e6e9); border-radius: 14px; padding: 18px 18px 16px; margin-bottom: 18px; counter-increment: mpsec; }
.form-section > .section-kicker { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .02em; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 2px solid var(--brand, #1b3246); }
.form-section > .section-kicker::before { content: counter(mpsec); flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; background: var(--brand, #1b3246); color: #fff; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.view { counter-reset: mpsec; }
dialog .form-section { box-shadow: none; }
@media (max-width: 640px) { .form-section { padding: 14px 12px 12px; border-radius: 12px; } }

/* v14.2: กล่องขนาดบ่อกลมจากตัวสินค้า (#5/#12) */
.static-dim { padding: 10px 14px; background: #eef2f5; border: 1.5px dashed #9cafc0; border-radius: 10px; font-weight: 700; font-size: 15px; }

/* ===== v15 ===== */
.nav-group-label{font-size:12.5px;font-weight:700;letter-spacing:0;text-transform:none;color:var(--mp-green-700,#1e384e);padding:16px 14px 6px;margin-top:8px;border-top:1px solid var(--line,#d9dee2)}
.nav-group-label:first-child,.nav-group-label.nav-first,.nav-group-label.hidden+.nav-group-label{border-top:0;margin-top:0;padding-top:4px}
.nav .nav-item{margin-left:4px;width:calc(100% - 4px)}
.inline-check{display:inline-flex;align-items:center;gap:8px;font-weight:500;font-size:13.5px;cursor:pointer}
.inline-check input{width:16px;height:16px;accent-color:var(--brand,#1e384e)}
.sub-block{border:1px dashed var(--line,#d9dee2);border-radius:12px;padding:14px 16px;margin:4px 0 16px;background:var(--surface-2,#fbfcfc)}
.unit-toggle{display:inline-flex;gap:2px;padding:2px;background:var(--surface-3,#eef0f2);border-radius:8px}
.unit-toggle button{border:0;background:transparent;padding:4px 10px;border-radius:6px;font:inherit;font-size:12.5px;cursor:pointer;color:var(--ink-muted,#666d73)}
.unit-toggle button.active{background:#fff;color:var(--brand,#1e384e);font-weight:600;box-shadow:0 1px 2px rgba(0,0,0,.08)}
.msg-tabs{display:flex;gap:6px;margin-bottom:10px}
.msg-tabs button{flex:1;border:1px solid var(--line,#d9dee2);background:#fff;border-radius:999px;padding:6px 10px;font:inherit;font-size:12.5px;cursor:pointer;color:var(--ink-muted,#666d73)}
.msg-tabs button.active{background:var(--brand,#1e384e);border-color:var(--brand,#1e384e);color:#fff;font-weight:600}
.msg-box{width:100%;font:inherit;font-size:13px;line-height:1.55;border:1px solid var(--line,#d9dee2);border-radius:12px;padding:12px;background:var(--surface-2,#fbfcfc);resize:vertical;white-space:pre-wrap}
input[readonly]#shipInput{background:var(--surface-3,#eef0f2)}

.unit-field .unit.unit-toggle { pointer-events: auto; z-index: 3; }   /* v15: ปุ่มสลับ บาท/% กดได้ */
#discountInput { padding-right: 110px; }
.slip-thumb figcaption b { display:block; font-size: 11px; color: var(--ink-on-brand, #fff); }   /* v33.15: อ่านออกบนแถบมืด */

/* v15.2: ตารางงวดชำระในส่วนสลิป (สร้างออร์เดอร์) */
.slip-plan { width: 100%; border-collapse: collapse; font-size: 13px; }
.slip-plan th, .slip-plan td { padding: 6px 8px; border-bottom: 1px solid var(--line, #e3e6e9); text-align: left; }
.slip-plan th { font-weight: 600; color: var(--ink-muted, #6b737a); font-size: 12px; }
.slip-plan .num { text-align: right; }
.slip-plan tr.has-slip td { background: color-mix(in srgb, var(--brand, #1d4160) 6%, transparent); }

/* v15.3: ปุ่ม "เมนู" โชว์เฉพาะโทรศัพท์ + แผ่นรวมโมดูลแบบการ์ดใหญ่ */
.nav-item.nav-more { display: none; }
.menu-grid { display: grid; gap: 18px; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.menu-sec h3 { font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--ink-subtle); margin: 0 0 8px 2px; font-weight: var(--fw-bold); }
.menu-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.menu-card { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-align: left; color: var(--ink); font: inherit; cursor: pointer; }
.menu-card:active { background: var(--surface-nav); }
.menu-card.current { border-color: var(--mp-mint-600); background: var(--surface-nav); }
.menu-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-tint); color: var(--mp-green-700); }
.menu-ico svg { width: 22px; height: 22px; }
.menu-txt { min-width: 0; display: grid; gap: 2px; }
.menu-txt b { font-size: 14px; font-weight: var(--fw-bold); line-height: 1.2; }
.menu-txt small { font-size: 11px; color: var(--ink-subtle); line-height: 1.25; }
.menu-user { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-soft); }
.menu-user b { display: block; font-size: 14px; } .menu-user small { color: var(--ink-subtle); }
@media (max-width: 380px) { .menu-cards { grid-template-columns: 1fr; } .menu-card { min-height: 60px; } }

/* v15.4: ปุ่มคัดลอกเลขออร์เดอร์ */
.btn-copy { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-subtle); cursor: pointer; padding: 0; vertical-align: middle; }
.btn-copy svg { width: 15px; height: 15px; } .btn-copy:hover, .btn-copy:active { background: var(--surface-tint); color: var(--mp-green-700); }
#orderDialogTitle .btn-copy { width: 30px; height: 30px; } #orderDialogTitle .btn-copy svg { width: 17px; height: 17px; }
@media (max-width: 760px) { .orders-tools { margin-left: 0; width: 100%; } .orders-tools .btn { flex: 1 1 auto; justify-content: center; } }

/* ---------- v16: Information icon + tooltip (แทนข้อความคำอธิบายยาวในฟอร์ม) ---------- */
.i-tip { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; margin: 0 0 0 5px; border-radius: 50%; border: 1.5px solid var(--mp-mint-600); color: var(--mp-green-700); background: var(--surface); font: var(--fw-bold) 11px/1 'Sarabun', var(--font); vertical-align: -3px; cursor: help; user-select: none; flex: none; }
.i-tip::before { content: 'i'; font-style: italic; font-family: Georgia, 'Times New Roman', serif; font-size: 12px; }
.i-tip:hover, .i-tip:focus-visible, .i-tip.open { background: var(--mp-green-700); color: var(--ink-on-brand); border-color: var(--mp-green-700); outline: none; }
.i-tip-row { display: flex; align-items: center; gap: 4px; margin: -4px 0 12px; font-size: var(--fs-11); color: var(--ink-subtle); }
h2 .info, h3 .i-tip { vertical-align: 1px; }
.mp-tip { position: fixed; z-index: 2147483000; max-width: min(340px, calc(100vw - 24px)); padding: 9px 12px; border-radius: var(--r-md); background: var(--mp-green-800); color: var(--ink-on-brand); font-size: var(--fs-13); line-height: 1.6; box-shadow: 0 10px 30px #0e1d2b40; white-space: pre-line; pointer-events: none; opacity: 0; transition: opacity .12s; }
.mp-tip.show { opacity: 1; }
.mp-tip::after { content: ''; position: absolute; left: var(--ax, 14px); top: -6px; border: 6px solid transparent; border-top: 0; border-bottom-color: var(--mp-green-800); }
.mp-tip.above::after { top: auto; bottom: -6px; border-bottom: 0; border-top: 6px solid var(--mp-green-800); }

/* v19: ภาพตัวอย่างลักษณะคลอง / บ่อ (PRD) — แสดงก่อนช่องกรอกระยะ */
.shape-ref { margin: 0 0 14px; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: #fff; }
.shape-ref img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: contain; }
.shape-ref figcaption { padding: 8px 12px 10px; border-top: 1px solid var(--line); font-size: var(--fs-12); line-height: var(--lh-body); color: var(--ink-muted); background: var(--surface); }
.shape-ref figcaption.tip-cap { display: flex; align-items: center; gap: 2px; padding: 7px 12px; }   /* v33.65: คำอธิบายในไอคอน i */
/* v19.10: แก้ไขออร์เดอร์แล้ว — แจ้งว่าอัปเดตที่ลิงก์สถานะเดิมของลูกค้า (ไม่มีช่องลิงก์/ปุ่มคัดลอก) */
.note.link-updated { display: flex; gap: 10px; align-items: flex-start; text-align: left; margin: 14px 0 0; background: #eef3f7; border-color: #becfdd; color: var(--mp-green-700); }
.note.link-updated.hidden { display: none; } .note.link-updated [data-icon] { flex: none; width: 18px; height: 18px; margin-top: 1px; } .note.link-updated b { font-size: var(--fs-13); }

/* ===== v33 (1 ต.ค. 2569) ===== */
/* Type 6 การ์ด (+ อุปกรณ์อะไหล่): จอกว้างที่ฟอร์มอยู่คอลัมน์ซ้ายแคบ → 3 × 2 แบบแถวนอน · จอกลางฟอร์มเต็มกว้าง → 6 คอลัมน์ · มือถือ 2 คอลัมน์เดิม */
.type-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.type-picker .type-card { min-height: 58px; flex-direction: row; align-items: center; gap: 10px; padding: 11px 12px; }
@media (min-width: 761px) and (max-width: 1150px) { .type-picker { grid-template-columns: repeat(6, minmax(0, 1fr)); } .type-picker .type-card { min-height: 88px; flex-direction: column; align-items: flex-start; } }
@media (max-width: 760px) { .type-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* ราคาต่อหน่วยแก้ได้ (อุปกรณ์อะไหล่) */
.edit-tag { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: var(--r-xs); background: var(--ok-bg); color: var(--ok-ink); font-size: var(--fs-10); font-weight: var(--fw-bold); }
.edit-tag.hidden, .readonly-tag.hidden { display: none; }
/* ข้อความถึงลูกค้า — ประเมินราคาเบื้องต้น */
.estimate { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2, #f5f7f8); }
.estimate-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.estimate-head > b { font-size: var(--fs-13, 13px); color: var(--ink-strong); }
.estimate-head .btn { margin-left: auto; }
.estimate textarea { display: block; width: 100%; min-height: 64px; max-height: 420px; resize: vertical; font: inherit; font-size: 13px; line-height: 1.55; padding: 10px 12px; border: 1px solid var(--line-input, #d8dbde); border-radius: var(--r-md, 10px); background: var(--surface, #fff); color: var(--ink-strong); }
.estimate textarea:not(:placeholder-shown) { min-height: 240px; }
.estimate-pending { margin: 8px 0 0; color: var(--warn-ink); }
/* พิมพ์ — ต้องมีสลิปก่อน */
.print-blocked { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; }
.print-blocked .btn { margin-top: 8px; }
.batch-row-blocked { opacity: .62; }
.batch-row-blocked .badge { margin-left: 6px; }

/* v33.1: ลบออร์เดอร์ */
.order-table td.num .btn + .btn { margin-left: 2px; }
.btn-del { color: var(--danger-ink, #a5342b); }
.btn-del:hover { background: var(--danger-bg, #fdecea); }
.danger-zone .section-kicker { color: var(--danger-ink, #a5342b); }
.sheet-preview th, .sheet-preview td { white-space: nowrap; font-size: 12px; padding: 6px 10px; }

/* v33.2: ปุ่มลบแยกจากปุ่มแก้ไข — จอใหญ่: คอลัมน์สุดท้าย มีเส้นคั่น เว้นระยะ · มือถือ: แถวล่างสุดของการ์ด ชิดซ้าย (ปุ่มแก้ไขอยู่ขวาด้านบน) */
.order-table th.th-del { width: 84px; }
.order-table td.row-del { width: 84px; padding-left: 18px; border-left: 1px dashed var(--line); text-align: center; }
.order-table td.row-del:empty { border-left-color: transparent; }
.order-table td.row-del .del-text { display: none; }
@media (max-width: 760px) {
  .order-table td.row-del { grid-column: 1 / -1; width: auto; border-left: 0; border-top: 1px dashed var(--line); margin-top: 8px; padding: 10px 0 0; text-align: left; }
  .order-table td.row-del:empty { display: none; }
  .order-table td.row-del .btn-del { gap: 6px; }
  .order-table td.row-del .del-text { display: inline; font-size: var(--fs-12); font-weight: var(--fw-semibold); }
}
/* v33.2: ข้อความประเมินอยู่บนสุดของกล่องสรุป (เหนือเงื่อนไขชำระ) + ปุ่มแชร์ภาพ */
#paneSummary .estimate { margin: 0 0 12px; }
.estimate-head .estimate-actions { margin-left: auto; display: inline-flex; gap: 6px; flex-wrap: wrap; }
.estimate-head .estimate-actions .btn { margin-left: 0; }
.estimate-shot { display: block; width: 100%; height: auto; max-height: 62vh; object-fit: contain; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-soft); }

/* v33.5: แก้ยอดมัดจำในตารางงวด (หน้าสร้างออร์เดอร์) */
.slip-plan .dep-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.slip-plan .dep-input { width: 120px; max-width: 100%; text-align: right; font-weight: 700; padding: 6px 10px; min-height: 36px; border: 1.5px solid var(--accent, #2d577c); border-radius: 8px; background: var(--surface, #fff); font: inherit; font-weight: 700; }
.slip-plan .dep-input:focus { outline: 2px solid var(--accent, #2d577c); outline-offset: 1px; }
.slip-plan .dep-input[aria-invalid="true"], .dep-hint.dep-bad + * .dep-input { border-color: var(--danger, #b42318); }
.slip-plan .dep-reset { padding: 2px 8px; min-height: 0; font-size: 12px; }
.slip-plan .dep-calc { display: block; font-size: 11.5px; color: var(--muted, #666d73); font-weight: 400; white-space: nowrap; }
.dep-hint { margin: 6px 0 0; }
.dep-hint.dep-bad { color: var(--danger, #b42318); font-weight: 600; }
@media (max-width: 560px) { .slip-plan .dep-input { width: 96px; } .slip-plan .dep-calc { white-space: normal; } }

/* v33.6: รายการออร์เดอร์ — ช่องทางสั่งซื้อ + ยอดค้างชำระเด่น */
.order-table { min-width: 900px; }
.page-chip { display: inline-flex; align-items: center; max-width: 150px; padding: 3px 10px; border-radius: var(--r-full); background: var(--surface-tint); color: var(--ink-heading, var(--mp-green-800)); font-size: var(--fs-12); font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid var(--line); }
.page-none { color: var(--ink-subtle); font-size: var(--fs-12); }
.th-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.th-sort:hover, .th-sort:focus-visible { color: var(--mp-green-700); }
.pay-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pay-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.owe-amt { font-size: var(--fs-15, 15px); font-weight: var(--fw-bold); color: var(--danger-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.owe-amt.part { color: var(--warn-ink); }
.owe-summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; margin: 0 0 12px; padding: 12px 16px; border: 1px solid var(--danger-line); background: var(--danger-bg); border-radius: var(--r-lg, 12px); color: var(--danger-ink); }
.owe-summary span { font-size: var(--fs-13); font-weight: var(--fw-semibold); }
.owe-summary b { font-size: 20px; font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.owe-summary small { font-size: var(--fs-12); opacity: .85; }
.owe-summary.clear { border-color: var(--ok-line, var(--line)); background: var(--ok-bg); color: var(--ok-ink); }
@media (max-width: 760px) { .order-table { min-width: 0; } .owe-amt { font-size: var(--fs-15, 16px); } .order-table td[data-label="การชำระเงิน"] { grid-column: 1 / -1; } }   /* มือถือ: แถวการชำระเงินเต็มความกว้าง (ยอดค้างเด่น) · สถานะงาน|แก้ไข อยู่คู่กันเหมือนเดิม */

/* v33.10: เพิ่มเพจ / ช่องทางเอง */
.page-row { display: flex; gap: 8px; align-items: stretch; }
.page-row select { flex: 1; min-width: 0; }
.page-row .btn { flex: none; gap: 4px; }
.page-add { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.page-add input { flex: 1 1 180px; min-width: 0; }
/* v33.10: Type 7 แบบ (+ เคลม) → 4 คอลัมน์ (จอใหญ่/กลาง) · มือถือ 2 คอลัมน์ */
.type-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 761px) and (max-width: 1150px) { .type-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); } .type-picker .type-card { min-height: 64px; flex-direction: row; align-items: center; } }
@media (max-width: 760px) { .type-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 761px) { .type-picker .type-card { flex-direction: column; align-items: flex-start; gap: 6px; min-height: 76px; padding: 10px 11px; } }
.type-picker .type-card span { overflow-wrap: normal; word-break: normal; }

/* v33.13 (3 ต.ค. 2569): ตัวกรองหลายตัวเลือก + เรียง ก→ฮ · สถานะ COD */
.ofilters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.ofilter-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; max-width: 100%; padding: 6px 10px 6px 12px; border: 1px solid var(--line); border-radius: var(--r-full, 999px); background: var(--surface, #fff); color: var(--ink); font: inherit; font-size: var(--fs-13, 13px); cursor: pointer; }
.ofilter-btn:hover { border-color: var(--mp-green-700, #1e384e); }
.ofilter-btn:focus-visible { outline: 2px solid var(--mp-green-700, #1e384e); outline-offset: 2px; }
.ofilter-btn .ofilter-label { font-weight: var(--fw-semibold, 600); }
.ofilter-btn .ofilter-val { color: var(--ink-muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ofilter-btn .ic { width: 14px; height: 14px; flex: none; }
.ofilter-btn.on, .ofilter-btn.sorted { border-color: var(--mp-green-700, #1e384e); background: var(--surface-tint, #eef2f5); }
.ofilter-btn.on .ofilter-val { color: var(--mp-green-800, #162a3c); font-weight: var(--fw-semibold, 600); }
.ofilter-pop { position: absolute; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-height: min(460px, 70vh); padding: 12px; border: 1px solid var(--line); border-radius: var(--r-lg, 12px); background: var(--surface, #fff); color: var(--ink); box-shadow: var(--shadow-pop, 0 12px 32px rgba(0,0,0,.18)); }
.ofilter-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ofilter-head .sheet-close { position: static; width: 32px; height: 32px; }
.ofilter-sort { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ofilter-sort .btn { justify-content: center; }
.ofilter-search { width: 100%; }
.ofilter-list { overflow: auto; min-height: 0; flex: 1 1 auto; display: grid; gap: 2px; padding: 2px; }
.ofilter-opt { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 4px 8px; border-radius: 8px; cursor: pointer; font-size: var(--fs-14, 14px); }
.ofilter-opt:hover { background: var(--surface-tint, #eef2f5); }
.ofilter-opt input { width: 18px; height: 18px; flex: none; accent-color: var(--mp-green-700, #1e384e); }
.ofilter-opt span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.ofilter-opt small { color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.ofilter-opt.zero span, .ofilter-opt.zero small { opacity: .55; }
.ofilter-foot { display: flex; gap: 6px; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 8px; }
.ofilter-foot .btn-primary { margin-left: auto; }
.th-sort.on { color: var(--mp-green-700, #1e384e); text-decoration-style: solid; }
.th-sort[data-dir]:not([data-dir=""])::after { content: ' ' attr(data-dir); }
.badge.cod { background: var(--danger-ink, #9b1c1c); color: #fff; font-weight: var(--fw-bold, 700); letter-spacing: .04em; }
.cod-note { display: block; margin-top: 4px; color: var(--danger-ink, #9b1c1c); font-weight: var(--fw-semibold, 600); }
@media (max-width: 760px) { .ofilters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; } .ofilter-btn { flex: none; } }

/* v33.16 (3 ต.ค. 2569): Dashboard — ยอดขายตามช่องทางสั่งซื้อ */
.dash-pages { margin-bottom: 12px; }
.dash-page-table { width: 100%; border-collapse: collapse; font-size: var(--fs-13, 13px); }
.dash-page-table th, .dash-page-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.dash-page-table thead th { font-size: var(--fs-12, 12px); color: var(--ink-muted); font-weight: var(--fw-semibold, 600); }
.dash-page-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dash-page-table td .dash-meter { max-width: 220px; margin-top: 6px; }
.dash-page-table td small.dash-chg { display: block; margin-top: 2px; }
.dash-page-table tfoot th { border-bottom: 0; border-top: 2px solid var(--line); color: var(--ink); }
@media (max-width: 760px) {
  .dash-page-table thead { display: none; }
  .dash-page-table tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .dash-page-table tbody td { border: 0; padding: 0; }
  .dash-page-table tbody td:first-child { grid-column: 1 / -1; }
  .dash-page-table tbody td.num { text-align: left; }
  .dash-page-table tbody td.num::before { content: attr(data-label); display: block; font-size: 11px; color: var(--ink-muted); }
  .dash-page-table tfoot tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding-top: 10px; }
  .dash-page-table tfoot th, .dash-page-table tfoot th.num { border: 0; padding: 0; text-align: left; }
  .dash-page-table tfoot th:first-child { grid-column: 1 / -1; }
  .dash-page-table tfoot th.num::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 400; color: var(--ink-muted); }
}

/* v33.26: Dashboard — การจัดส่งตามจังหวัด (แท่งแนวนอน · เข้ม = ส่งมอบขนส่งแล้ว) */
.prov-bars { display: grid; gap: 8px; }
.prov-row { display: grid; grid-template-columns: 22px minmax(84px, 150px) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: var(--fs-13); }
.prov-row.muted .prov-name, .prov-row.muted .prov-val { color: var(--ink-muted); }
.prov-rank { color: var(--ink-subtle); font-variant-numeric: tabular-nums; text-align: right; }
.prov-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.prov-track { height: 14px; border-radius: 4px; background: var(--surface-sunk, #eef0f1); overflow: hidden; }
.prov-track i.all { display: block; height: 100%; border-radius: 4px; background: color-mix(in srgb, var(--mp-green-700, #1d4160) 32%, transparent); overflow: hidden; }
.prov-track i.done { display: block; height: 100%; background: var(--mp-green-700, #1d4160); }
.prov-val { white-space: nowrap; font-variant-numeric: tabular-nums; } .prov-val small { color: var(--ink-muted); }
@media (max-width: 640px) { .prov-row { grid-template-columns: 18px minmax(70px, 110px) minmax(0, 1fr); } .prov-val { grid-column: 2 / -1; white-space: normal; } }
/* v33.26: รายการออร์เดอร์ — การจัดส่ง (จังหวัด · ขนส่ง · Tracking) + คัดลอกเบอร์ */
.ship-cell .ship-prov { font-weight: 600; } .ship-cell .ship-none { color: var(--ink-subtle); }
.ship-cell .ship-trk { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono, ui-monospace, monospace); font-size: var(--fs-12, 12px); overflow-wrap: anywhere; }
.cust-phone { display: inline-flex; align-items: center; gap: 4px; }

/* v33.27: แบ่งหน้ารายการออร์เดอร์ */
.orders-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 12px 0 4px; font-size: var(--fs-13, 13px); color: var(--ink-muted); }
.orders-pager .pg-size { display: inline-flex; align-items: center; gap: 8px; margin: 0; white-space: nowrap; }
.orders-pager .pg-size select { width: auto; min-height: 36px; padding: 6px 30px 6px 10px; font-size: var(--fs-13, 13px); }
.orders-pager .pg-info { display: flex; flex-direction: column; gap: 2px; color: var(--ink); }
.orders-pager .pg-info small { color: var(--ink-subtle); font-size: var(--fs-12, 12px); }
.orders-pager .pg-nums { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.orders-pager .pg-btn { min-width: 36px; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-13, 13px); cursor: pointer; font-variant-numeric: tabular-nums; }
.orders-pager .pg-btn:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--ok-line); }
.orders-pager .pg-btn:disabled { cursor: default; opacity: .45; }
.orders-pager .pg-btn.on { background: var(--mp-green-700, #1e384e); border-color: var(--mp-green-700, #1e384e); color: var(--ink-on-brand, #fff); opacity: 1; font-weight: var(--fw-semibold, 600); }
.orders-pager .pg-prev, .orders-pager .pg-next { font-size: 18px; line-height: 1; }
.orders-pager .pg-gap { padding: 0 2px; color: var(--ink-subtle); }
@media (max-width: 760px) { .orders-pager .pg-nums { margin-left: 0; width: 100%; justify-content: center; } }

/* v33.31: ชื่อ Social ลูกค้า · ช่วงวันที่สร้าง */
.req { color: var(--danger-ink, #a5342b); font-weight: 700; }
.order-table td[data-label="ลูกค้า"] { min-width: 150px; }
.order-table td[data-label="การจัดส่ง"] { min-width: 110px; }
.order-table td[data-label="Type"] { min-width: 96px; }
.order-table td small.cust-social { display: block; color: var(--mp-green-700, #1e384e); font-weight: 600; word-break: break-word; }
.order-table td small.cust-social span { display: inline-block; width: 13px; height: 13px; margin-right: 4px; vertical-align: -2px; }
.order-table td small.cust-social svg { width: 13px; height: 13px; display: block; }
@media (max-width: 760px) { .order-table td[data-label="ลูกค้า"], .order-table td[data-label="การจัดส่ง"], .order-table td[data-label="Type"] { min-width: 0; } }
.date-range { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--fs-13, 13px); color: var(--ink-muted); }
.date-range input[type=date] { width: auto; min-height: 38px; padding: 6px 8px; }
@media (max-width: 760px) { .date-range { width: 100%; } .date-range input[type=date] { flex: 1; min-width: 0; } }

/* v33.33: ประเภทลูกค้า ลูกค้าทั่วไป / Dealer */
.cust-kind-field { max-width: 360px; }
.cust-kind-field select { width: 100%; }
.badge-dealer { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1.6; vertical-align: 1px; color: #7a4a00; background: #fdf0d5; border: 1px solid #f0cf8a; }
/* v33.34: ส่วนลดเกินค่าสินค้า */
.micro-hint.warn-text { color: #a4461b; font-weight: 600; }
/* v33.36: Pop up บังคับอัปเดตเวอร์ชัน */
.update-dialog { max-width: 440px; width: calc(100% - 32px); border: 0; border-radius: 16px; padding: 22px 22px 18px; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.update-dialog::backdrop { background: rgba(15, 30, 24, .55); }
.update-dialog h2 { margin: 0 0 6px; font-size: 1.2rem; }
.update-notes { margin: 10px 0 0; padding-left: 20px; line-height: 1.6; }
.update-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.update-actions .btn { min-width: 160px; justify-content: center; }
/* v33.38: Payment_Status ในช่องการชำระเงิน (ตอนเรียงตาม Payment_Status) */
.order-table td small.psts-chip { display: block; margin-top: 2px; color: var(--mp-green-700, #1e384e); font-weight: 600; }

/* v33.40: Dashboard แท็บ ภาพรวม (ไม่รวม Dealer) / Dealer · ตาราง Dealer · สร้าง Dealer ใหม่ */
.dash-tabs { display: inline-flex; flex-wrap: wrap; gap: 3px; margin-top: 12px; padding: 4px; border-radius: var(--r-md); background: var(--surface-sunk, #eef0f1); }
.dash-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--mp-green-700); font-weight: var(--fw-bold); box-shadow: var(--shadow-raise); }
.dash-tabs button small { font-weight: 400; color: var(--ink-subtle); }
.dash-excl { margin: 0 0 12px; }
.dash-dealer-table .dealer-id { display: inline-block; margin-left: 6px; font-size: 11px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.dash-dealer-table .creators { display: flex; flex-wrap: wrap; gap: 4px; }
.dash-dealer-table .creator-chip { display: inline-flex; gap: 4px; align-items: baseline; padding: 2px 8px; border-radius: var(--r-full); background: var(--surface-tint); font-size: 12px; white-space: nowrap; }
.dash-dealer-table .creator-chip b { font-weight: var(--fw-semibold, 600); }
.dash-dealer-table .last-order { font-size: 12px; line-height: 1.45; }
.dash-dealer-table .last-order b { display: block; font-size: 13px; }
.dash-dealer-table .last-order small { color: var(--ink-muted); }
@media (max-width: 760px) {
  .dash-dealer-table tbody td.dl-wide { grid-column: 1 / -1; }
  .dash-dealer-table tbody td.dl-wide::before { content: attr(data-label); display: block; font-size: 11px; color: var(--ink-muted); margin-bottom: 2px; }
  .dash-tabs { display: flex; width: 100%; } .dash-tabs button { flex: 1; }
}
.dealer-new { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 8px; }
.dealer-new-form { flex: 1 1 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; padding: 12px; border: 1px dashed var(--line); border-radius: var(--r-md); background: var(--surface-tint); }
.dealer-new-form .field { margin: 0; min-width: 0; }
.dealer-new-actions, #dealerNewStatus { grid-column: 1 / -1; }
.dealer-new-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 760px) { .dealer-new-form { grid-template-columns: 1fr; } }

/* v33.42: Sort เอกสารบัญชี (PEAK) แยกจากเมนูเรียงลำดับ */
.doc-sort { display: inline-flex; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; max-width: 100%; }
.doc-sort label { font-size: var(--fs-12); color: var(--ink-muted); white-space: nowrap; }
.doc-sort select { width: auto; min-width: 150px; max-width: 100%; }
.doc-sort-n { font-size: 11.5px; color: var(--ink-subtle); white-space: nowrap; }
.doc-chip { display: block; margin-top: 4px; color: var(--warn-ink, #8a5a00); font-weight: var(--fw-semibold, 600); }
@media (max-width: 760px) { .doc-sort { flex: 1 1 100%; } .doc-sort select { flex: 1; min-width: 0; } }

/* v33.45: เรียงลำดับ — Dropdown เดียว แยกหมวด เลือกได้หลายเงื่อนไข (แทน #ordersSort + เรียงหลายเงื่อนไข v33.44) */
.sortbox { position: relative; flex: 0 1 auto; min-width: 0; max-width: 100%; }
.sortbox > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; max-width: 100%; padding: 6px 10px 6px 12px; border: 1px solid var(--line-input, var(--line)); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font-size: var(--fs-13, 13px); white-space: nowrap; }
.sortbox > summary::-webkit-details-marker { display: none; }
.sortbox > summary:hover { border-color: var(--mp-green-700); }
.sortbox > summary:focus-visible { outline: 2px solid var(--mp-green-700); outline-offset: 2px; }
.sortbox > summary .ic, .sortbox > summary svg { width: 15px; height: 15px; flex: none; }
.sortbox-label { color: var(--ink-muted); }
.sortbox-val { font-weight: var(--fw-semibold, 600); min-width: 0; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.sortbox-caret { display: inline-flex; transition: transform var(--dur-fast, .12s) var(--ease, ease); }
.sortbox[open] .sortbox-caret { transform: rotate(180deg); }
.sortbox.on > summary { border-color: var(--mp-green-700); background: var(--surface-tint); }
.sortbox.on .sortbox-val { color: var(--mp-green-800, var(--mp-green-700)); }
.sortbox-pop { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; width: min(480px, calc(100vw - 32px)); max-height: min(640px, 78vh); overflow: auto; display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-lg, 12px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop, 0 12px 32px rgba(0,0,0,.18)); }
.sortbox-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.sortbox-head .micro-hint, .sortbox-hint { margin: 0; }
.sortbox-picked { list-style: none; margin: 0; padding: 8px; display: grid; gap: 4px; border-radius: var(--r-md); background: var(--surface-soft, var(--surface-tint)); }
.sort-pick { display: flex; align-items: center; gap: 8px; min-height: 36px; font-size: var(--fs-13, 13px); }
.sort-pick-txt { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.sort-pick-empty { font-size: var(--fs-12); color: var(--ink-muted); padding: 2px 4px; }
.sort-mv { flex: none; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: var(--r-sm, 6px); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; line-height: 1; cursor: pointer; }
.sort-mv:hover:not([disabled]) { border-color: var(--mp-green-700); color: var(--mp-green-700); }
.sort-mv[disabled] { opacity: .35; cursor: default; }
.sort-mv:focus-visible, .sort-opt:focus-visible { outline: 2px solid var(--mp-green-700); outline-offset: 1px; }
.sort-rm:hover:not([disabled]) { border-color: var(--danger, #b42318); color: var(--danger, #b42318); }
.sortbox-cats { display: grid; gap: 10px; }
.sort-cat-name { font-size: var(--fs-12); font-weight: var(--fw-semibold, 600); color: var(--ink-label, var(--ink-muted)); margin-bottom: 4px; }
.sort-cat-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.sort-opt { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 10px 4px 6px; border: 1px solid var(--line); border-radius: var(--r-full, 999px); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-13, 13px); text-align: left; cursor: pointer; }
.sort-opt:hover { border-color: var(--mp-green-700); }
.sort-n { flex: none; display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--r-full, 999px); border: 1px dashed var(--line); font-size: 11px; font-weight: var(--fw-bold, 700); font-variant-numeric: tabular-nums; color: var(--ink-muted); }
.sort-opt.on { border-color: var(--mp-green-700); background: var(--surface-tint); color: var(--mp-green-800, var(--mp-green-700)); font-weight: var(--fw-semibold, 600); }
.sort-opt.on .sort-n, .sort-pick .sort-n { border: 0; background: var(--mp-green-700); color: var(--ink-on-brand, #fff); }
.sort-opt.dflt { border-style: dashed; }
/* v33.46: การชำระเงิน / สถานะงาน หมวดเดียว (2 คอลัมน์) · Sale / Dealer / CS ติ๊กเลือก */
.sort-cat-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.sort-sub { min-width: 0; display: grid; gap: 4px; align-content: start; }
.sort-sub-name { font-size: 11.5px; color: var(--ink-muted); }
.sort-sub .sort-cat-opts { flex-direction: column; align-items: stretch; }
.sort-sub .sort-opt { width: 100%; border-radius: var(--r-md); }
.sort-opt-txt { min-width: 0; }
.sort-tick { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 12px 4px 10px; border: 1px solid var(--line); border-radius: var(--r-full, 999px); background: var(--surface); color: var(--ink); font-size: var(--fs-13, 13px); cursor: pointer; user-select: none; }
.sort-tick:hover { border-color: var(--mp-green-700); }
.sort-tick input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--mp-green-700); cursor: pointer; }
.sort-tick:focus-within { outline: 2px solid var(--mp-green-700); outline-offset: 1px; }
.sort-tick.on { border-color: var(--mp-green-700); background: var(--surface-tint); color: var(--mp-green-800, var(--mp-green-700)); font-weight: var(--fw-semibold, 600); }
.sort-tick-n:empty { display: none; }
.sort-tick-n { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: var(--r-full, 999px); border: 1.5px solid var(--mp-green-700); font-size: 10.5px; font-weight: var(--fw-bold, 700); font-variant-numeric: tabular-nums; color: var(--mp-green-700); }
.sort-lvl:empty { display: none; }
.sort-lvl { margin-left: 8px; padding: 1px 8px; border-radius: var(--r-full, 999px); background: var(--mp-green-700); color: var(--ink-on-brand, #fff); font-size: 10.5px; font-weight: var(--fw-bold, 700); vertical-align: 1px; }
.sort-cat-hint { margin: 6px 0 0; }
@media (max-width: 440px) { .sort-cat-cols { grid-template-columns: 1fr; } }
.sortbox-foot { display: flex; gap: 8px; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; }
.grp-chip { display: inline-block; margin-top: 3px; padding: 1px 8px; border-radius: var(--r-full); font-size: 11px; font-family: inherit; background: var(--surface-tint); color: var(--ink-muted); }
.grp-chip.grp-S { background: #e7f0ff; color: #1f4f9c; } .grp-chip.grp-D { background: #fff1dc; color: #8a5a00; } .grp-chip.grp-C { background: #ecf2f7; color: #1d486d; }
@media (max-width: 760px) { .sortbox { flex: 1 1 100%; } .sortbox > summary { width: 100%; } .sortbox-val { flex: 1 1 auto; max-width: none; } .sortbox-pop { position: static; width: auto; max-height: none; margin-top: 6px; box-shadow: none; } }   /* มือถือ = แผงต่อใต้ปุ่ม (ไม่ซ้อนแถบเมนูล่าง) */
.dash-dealer-search { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.dash-dealer-search .search { flex: 1 1 260px; min-width: 0; max-width: 420px; }
.dash-dealer-table tbody tr[hidden] { display: none !important; }

/* v33.52: หน้าคำนวณราคาสำหรับ Dealer (config.js CALC_ONLY: true) — หน้าเดียว · ไม่มีเมนู / ลูกค้า / สลิป / มัดจำ / ปุ่มบันทึก */
.calc-only .app-sidebar, .calc-only .calc-hide, .calc-only #workflow, .calc-only #editBanner, .calc-only #paneCustomer,
.calc-only #submitBtn, .calc-only #submitErrors, .calc-only #sheetMap, .calc-only #menuSheet { display: none !important; }
.calc-only .app-main { margin-left: 0 !important; }
.calc-only .topbar-logo { display: block; width: auto; height: 30px; object-fit: contain; flex: none; }
.calc-only .calc-status { margin: 0 0 16px; font-size: var(--fs-13, 13px); }
.calc-only .calc-status.info { background: color-mix(in srgb, var(--mp-green-700) 6%, var(--surface)); border-color: color-mix(in srgb, var(--mp-green-700) 24%, transparent); color: var(--mp-green-700); }
.calc-only .calc-status .btn { margin-left: 6px; }
.calc-only #calcReset.calc-armed { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-ink); }
@media (max-width: 760px) {
  .calc-only { --tabbar-h: 0px; }
  .calc-only body, body.calc-only { padding-bottom: env(safe-area-inset-bottom); }
  .calc-only .toast { bottom: calc(env(safe-area-inset-bottom) + 16px); }
  .calc-only .admin-chip .conn { display: none; }
  .calc-only #calcReload { padding: 6px 10px; min-height: 34px; font-size: 12px; }
}

/* v33.53: ออร์เดอร์ Dealer — D0 Dealer ส่ง Lead / D1 Dealer ส่ง Order (คอลัมน์ AW) */
.dsrc-group label { font-size: var(--fs-13, 13px); padding: 12px 14px; }
.dsrc-group label b { color: var(--mp-green-700); }
.dsrc-group.invalid label { border-color: var(--danger-line); background: var(--danger-bg); }
.badge-dsrc { margin-left: 6px; }

/* v33.54: รายการออร์เดอร์ — ช่างติดตั้งหน้างาน (งานปู / เชื่อมหน้างาน) */
.badge.onsite-badge { display: flex; width: fit-content; margin-top: 4px; background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }

/* v33.55: รายการออร์เดอร์ — จำนวนรายการตาม Sort · แถวค้างชำระ (รวมชำระบางส่วน) = แถบแดงทั้งแถว */
.sort-count-bar { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); font-size: var(--fs-13); color: var(--ink-muted); }
.sort-count-bar b { color: var(--ink-heading); font-size: var(--fs-14, 14px); font-variant-numeric: tabular-nums; }
.sort-count-bar .sc-lead { font-weight: var(--fw-semibold); color: var(--mp-green-700); }
.sort-count-bar .sc-item i { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 4px; border-radius: 999px; background: var(--mp-green-700); color: #fff; font-style: normal; font-size: 11px; font-weight: 700; }
.sort-count-bar .sc-all { margin-left: auto; font-size: var(--fs-12); }
.sort-opt .sort-cnt { margin-left: auto; padding: 0 7px; border-radius: 999px; background: var(--surface-soft); color: var(--ink-muted); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sort-opt.on .sort-cnt { background: var(--surface); color: var(--mp-green-700); }
.order-table tbody tr.row-owe { background: var(--danger-bg); box-shadow: inset 4px 0 0 var(--danger); }
.order-table tbody tr.row-owe:hover { background: color-mix(in srgb, var(--danger-bg) 70%, var(--danger-line)); }
.order-table tbody tr.row-owe td { border-bottom-color: var(--danger-line); }
@media (max-width: 760px) { .order-table tr.row-owe { background: var(--danger-bg); border-color: var(--danger-line); box-shadow: inset 4px 0 0 var(--danger); } }
/* v33.58: หน้าคำนวณราคา Dealer — ข้อความถึงลูกค้าแก้ได้ */
.estimate-edit { margin: 8px 0 0; color: var(--ink-label); }
.estimate-edit.warn-text { color: var(--warn-ink); }
body.calc-only .estimate textarea { background: #fff; cursor: text; }
/* v33.59: หน้าคำนวณราคา Dealer — ชื่อ / รหัส Dealer เหนือข้อความ */
.estimate .calc-dealer { margin: 0 0 10px; }
.estimate .calc-dealer input { width: 100%; }
.estimate .calc-dealer .micro-hint { margin: 4px 0 0; }

/* v33.73: ติ๊ก แสดงยอดค้างชำระ (COD) บนใบจ่าหน้า */
.label-amt { margin-top: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ============================================================ v33.83: ชุด 4 พ.ย. */
/* ตัวเลือกแบบปุ่มกลุ่ม (สินค้า · ผู้ใช้) */
#prodFilter, .users-active { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 4px; border-radius: var(--r-md); background: var(--surface-sunk, #eef0f1); }
#prodFilter button[aria-pressed="true"], .users-active button[aria-pressed="true"] { background: var(--surface); color: var(--mp-green-700); font-weight: var(--fw-bold); box-shadow: var(--shadow-raise); }
.users-active button { min-height: 32px; padding: 4px 10px; }
.users-active button small { font-weight: 400; color: var(--ink-subtle); }
/* สวิตช์ เปิด / ปิด */
.sw { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; min-height: 32px; }
.sw-in { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw-track { position: relative; width: 38px; height: 22px; flex: none; border-radius: 999px; background: var(--line, #cfd4d8); transition: background .15s; }
.sw-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.sw-in:checked + .sw-track { background: var(--mp-green-700); }
.sw-in:checked + .sw-track::after { transform: translateX(16px); }
.sw-in:focus-visible + .sw-track { outline: 2px solid var(--mp-green-700); outline-offset: 2px; }
.sw-in:disabled + .sw-track { opacity: .5; }
.sw-txt { font-size: var(--fs-12); color: var(--ink-muted); }
.sw-in:checked ~ .sw-txt { color: var(--mp-green-700); font-weight: var(--fw-semibold); }
/* หน้าสินค้า */
.prod-table tr.prod-group td { background: var(--surface-sunk, #f3f5f6); }
.prod-table tr.prod-group small { color: var(--ink-subtle); font-weight: 400; }
.prod-table tr.prod-row td:first-child { padding-left: 28px; }
.prod-table tr.is-hidden td { color: var(--ink-subtle); }
.prod-table tr.prod-row.is-hidden td:nth-child(2) { text-decoration: line-through; text-decoration-color: var(--line); }
/* ผู้ใช้ที่ปิดการใช้งาน */
#usersBody tr.user-off td { color: var(--ink-subtle); }
/* แถบอัปเดตสถานะหลายออร์เดอร์ */
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line-soft, #e3e6e9); border-radius: var(--r-md); background: var(--surface); position: sticky; top: 0; z-index: 3; }
.bulk-bar .bulk-ico { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--mp-green-700); color: #fff; }
.bulk-bar .bulk-ico .ic { width: 14px; height: 14px; }
.bulk-bar #bulkCount { font-size: var(--fs-13, 13px); }
.bulk-bar .bulk-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-left: auto; }
.bulk-bar select, .bulk-bar input[type=text] { width: auto; min-width: 0; flex: 0 1 auto; min-height: 34px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font: inherit; font-size: var(--fs-12); }
.bulk-bar input[type=text] { width: 240px; max-width: 100%; }
.bulk-bar select { max-width: 180px; }
.sel-all { display: inline-flex; align-items: center; margin-right: 6px; vertical-align: middle; }
.sel-all.hidden { display: none; }
.row-sel { order: -1; }
.row-sel, #selAllPage { width: 18px; height: 18px; margin: 0 4px 0 0; accent-color: var(--mp-green-700); cursor: pointer; flex: none; }
/* จุดสถานะงาน 5 ขั้นในแถว */
.stage-dots { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.stage-dots .sdot { position: relative; width: 16px; height: 16px; padding: 0; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); cursor: pointer; }
.stage-dots .sdot + .sdot::before { content: ''; position: absolute; right: 100%; top: 50%; width: 4px; height: 2px; margin-right: 2px; background: var(--line); }
.stage-dots .sdot.done { background: var(--mp-green-700); border-color: var(--mp-green-700); }
.stage-dots .sdot.part { background: linear-gradient(90deg, var(--mp-green-700) 50%, var(--surface) 50%); border-color: var(--mp-green-700); }
.stage-dots .sdot:disabled { cursor: default; opacity: .75; }
.stage-dots .sdot:not(:disabled):hover { box-shadow: 0 0 0 3px rgba(4, 92, 70, .18); }
.stage-dots .sdot:focus-visible { outline: 2px solid var(--mp-green-700); outline-offset: 2px; }
/* stepper 4 หรือ 5 ขั้น · ขั้นที่กดได้ */
.stepper { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.step-btn { display: block; width: 100%; padding: 0; margin: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; text-align: center; line-height: inherit; }
.step-btn:focus-visible { outline: 2px solid var(--mp-green-700); outline-offset: 4px; border-radius: 6px; }
.step.can i { box-shadow: 0 0 0 3px rgba(4, 92, 70, .14); }
.step.can:hover i { box-shadow: 0 0 0 4px rgba(4, 92, 70, .28); }
/* สลิป: ปุ่มลบคู่ปุ่มดู · ประวัติการเงิน */
.slip-chip { display: inline-flex; align-items: center; gap: 0; }
.slip-chip .slip-del { min-width: 28px; padding: 0 6px; color: var(--danger-ink, #b42318); }
.pay-log { width: 100%; border-collapse: collapse; font-size: var(--fs-12); }
.pay-log th, .pay-log td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line-soft, #e3e6e9); vertical-align: top; }
.ask-dialog textarea { width: 100%; resize: vertical; font: inherit; }
@media (max-width: 760px) {
  .bulk-bar { position: static; }
  .bulk-bar .bulk-tools { margin-left: 0; width: 100%; }
  .bulk-bar .bulk-tools select, .bulk-bar .bulk-tools input[type=text] { flex: 1 1 40%; width: auto; }
  .bulk-bar #bulkGo { flex: 1 1 100%; }
  .prod-table tr.prod-row td:first-child { padding-left: 14px; }
}
/* v33.83: กล่องโต้ตอบเล็ก (ยืนยัน + เหตุผล · ประวัติ · สลิป · ผลติ๊กสถานะ) — เดิมเป็นกรอบเบราว์เซอร์ */
dialog.dialog { border: 0; border-radius: var(--r-xl, 16px); padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-modal, 0 24px 60px rgba(15, 30, 24, .28)); max-height: 92dvh; overflow: auto; }
dialog.dialog::backdrop { background: var(--scrim, rgba(15, 30, 24, .45)); backdrop-filter: blur(3px); }

/* ============================================================ v33.84: Tag Sale / CS · ใบกำกับภาษี · ตัวกรองสถานะ */
.tag-rows { display: grid; gap: 8px; }
.tag-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag-lbl { min-width: 70px; font-size: var(--fs-12); color: var(--ink-muted); font-weight: var(--fw-semibold); }
.tag-chips { display: contents; }
.tag-row select { min-height: 32px; padding: 3px 8px; border: 1px dashed var(--line); border-radius: 999px; background: var(--surface); font: inherit; font-size: var(--fs-12); color: var(--ink-muted); width: auto; max-width: 220px; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 2px 6px 2px 10px; border-radius: 999px; background: var(--surface-sunk, #eef0f1); font-size: var(--fs-12); }
.tag-chip.owner { padding-right: 10px; background: var(--mp-green-50, #e7edf2); color: var(--mp-green-700); font-weight: var(--fw-semibold); }
.tag-chip.cs { background: var(--info-bg, #eaf2fb); }
.tag-x { border: 0; background: none; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; color: var(--ink-muted); }
.tag-x:hover { color: var(--danger-ink, #b42318); }
.tax-box { display: grid; gap: 10px; margin-top: 10px; padding: 12px; border: 1px solid var(--line-soft, #e3e6e9); border-radius: var(--r-md); background: var(--surface-sunk, #f6f7f8); }
.tax-box textarea, .tax-box input, .tax-box select { width: 100%; }
.tax-box label .btn { margin-left: 6px; min-height: 26px; padding: 0 8px; }
.people-line { display: block; color: var(--ink-subtle); font-size: var(--fs-11); margin-top: 2px; }
.tax-chip { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 999px; font-size: var(--fs-10); background: var(--surface-sunk, #eef0f1); color: var(--ink-muted); }
.tax-chip.tax-need_info { background: var(--warn-bg); color: var(--warn-ink); }
.tax-chip.tax-ready { background: var(--info-bg, #eaf2fb); color: var(--info-ink, #1d4f8a); }
.tax-chip.tax-issued, .tax-chip.tax-sent { background: var(--mp-green-50, #e7edf2); color: var(--mp-green-700); }
.tag-pick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tag-pick { border: 1px solid var(--line-soft, #e3e6e9); border-radius: var(--r-md); padding: 8px 12px; display: grid; gap: 4px; max-height: 46vh; overflow: auto; }
.tag-pick legend { font-weight: var(--fw-semibold); font-size: var(--fs-12); padding: 0 4px; }
#taxTabs { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 4px; border-radius: var(--r-md); background: var(--surface-sunk, #eef0f1); }
#taxTabs button[aria-pressed="true"] { background: var(--surface); color: var(--mp-green-700); font-weight: var(--fw-bold); box-shadow: var(--shadow-raise); }
#taxTabs button small { color: var(--ink-subtle); font-weight: 400; }
.tax-table td small { display: block; color: var(--ink-subtle); }
.tax-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-weight: var(--fw-semibold); color: var(--mp-green-700); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.sort-count-bar .sc-clear { margin-left: auto; }
@media (max-width: 760px) { .tax-acts { justify-content: flex-start; } .tag-lbl { min-width: 100%; } }

/* ============================================================ v33.85: Kanban ตามหนี้ */
#debtFilter { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 4px; border-radius: var(--r-md); background: var(--surface-sunk, #eef0f1); }
#debtFilter button[aria-pressed="true"] { background: var(--surface); color: var(--mp-green-700); font-weight: var(--fw-bold); box-shadow: var(--shadow-raise); }
#debtFilter button small { color: var(--ink-subtle); font-weight: 400; }
.debt-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.debt-col { background: var(--surface-sunk, #f1f3f4); border-radius: var(--r-lg, 14px); padding: 10px; min-height: 200px; border: 2px solid transparent; transition: border-color .12s, background .12s; }
.debt-col.over { border-color: var(--mp-green-700); background: var(--mp-green-50, #e7edf2); }
.debt-col.debt-paid.over { border-color: var(--danger-line, #f0c2bd); background: var(--danger-bg, #fdecea); }
.debt-col > header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 8px; }
.debt-col > header b { font-size: var(--fs-13, 14px); color: var(--ink-heading); }
.debt-col > header .debt-n { min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--surface); font-size: var(--fs-11); text-align: center; font-weight: var(--fw-bold); }
.debt-col > header small { color: var(--ink-muted); font-size: var(--fs-11); }
.debt-col > header .debt-hint { flex-basis: 100%; color: var(--ink-subtle); font-size: var(--fs-10); }
.debt-due > header b { color: var(--danger-ink, #b42318); }
.debt-list { display: grid; gap: 8px; }
.debt-card { background: var(--surface); border: 1px solid var(--line-soft, #e3e6e9); border-radius: var(--r-md); padding: 10px 12px; display: grid; gap: 4px; cursor: grab; box-shadow: var(--shadow-raise); }
.debt-card[draggable="false"] { cursor: default; opacity: .85; }
.debt-card.dragging { opacity: .45; }
.debt-card.due { border-left: 3px solid var(--danger-ink, #b42318); }
.debt-card.broken { background: var(--danger-bg, #fdecea); }
.debt-card:focus-visible { outline: 2px solid var(--mp-green-700); outline-offset: 2px; }
.debt-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.debt-amt { color: var(--danger-ink, #b42318); font-variant-numeric: tabular-nums; white-space: nowrap; }
.debt-amt.ok { color: var(--mp-green-700); }
.debt-cust { font-size: var(--fs-12); font-weight: var(--fw-semibold); }
.debt-cust small, .debt-meta, .debt-people { color: var(--ink-muted); font-size: var(--fs-11); font-weight: 400; }
.debt-follow { font-size: var(--fs-11); padding: 4px 8px; border-radius: var(--r-sm); background: var(--info-bg, #eaf2fb); color: var(--info-ink, #1d4f8a); }
.debt-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.debt-badges:empty { display: none; }
.debt-acts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.debt-acts .btn { min-height: 28px; padding: 0 8px; font-size: var(--fs-11); }
.debt-empty { text-align: center; margin: 16px 0; }
@media (max-width: 760px) { .debt-board { grid-auto-columns: 82vw; scroll-snap-type: x mandatory; } .debt-col { scroll-snap-align: start; } }
.debt-top { flex-wrap: wrap; }
.debt-top .link-btn { white-space: nowrap; font-size: var(--fs-12); }
.debt-top .debt-amt { font-size: var(--fs-12); }
/* v33.85.1: Kanban ตามหนี้บนมือถือ — แท็บเลือกช่อง แสดงทีละช่องเต็มจอ (ไม่ต้องลาก) */
.debt-lane-tabs { display: none; }
@media (max-width: 760px), (pointer: coarse) and (max-width: 1024px) {
  .debt-lane-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; margin-bottom: 4px; scrollbar-width: none; position: sticky; top: 0; z-index: 2; background: var(--bg, #f6f7f8); }
  .debt-lane-tabs::-webkit-scrollbar { display: none; }
  .debt-lane-tabs button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: inherit; font-size: var(--fs-12); color: var(--ink-muted); cursor: pointer; }
  .debt-lane-tabs button b { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-sunk, #eef0f1); font-size: var(--fs-11); }
  .debt-lane-tabs button[aria-selected="true"] { background: var(--mp-green-700); border-color: var(--mp-green-700); color: #fff; font-weight: var(--fw-semibold); }
  .debt-lane-tabs button[aria-selected="true"] b { background: rgba(255, 255, 255, .22); color: #fff; }
  .debt-lane-tabs button.lane-due:not([aria-selected="true"]) b { background: var(--danger-bg, #fdecea); color: var(--danger-ink, #b42318); }
  .debt-board { display: block; overflow: visible; scroll-snap-type: none; }
  .debt-col { display: none; min-height: 0; }
  .debt-col.active { display: block; }
  .debt-col > header .debt-n { display: none; }
  .debt-card { cursor: default; }
  .debt-acts .btn { min-height: 38px; padding: 0 12px; font-size: var(--fs-12); flex: 1 1 auto; }
}
/* v33.87: ปุ่มเปลี่ยนรหัสผ่าน — มือถือย้ายไปอยู่ในแผ่น "เมนู" (หัวจอแคบ) */
@media (max-width: 760px) { #pwBtn { display: none; } .menu-user .btn + .btn { margin-left: 6px; } }

/* ===== v33.90: ตั้งค่าระบบ (S51 / S52) ===== */
.sys-trial-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; padding: 10px 14px; border-radius: var(--r-sm, 10px); background: var(--warn-bg); color: var(--warn-ink); }
.sys-trial-bar > span:nth-child(2) { flex: 1 1 260px; }
.sys-trial-bar.hidden { display: none; }
.ro-bar { background: var(--danger-bg, #fde8e7); color: var(--danger-ink, #b42318); }
.set-list { display: grid; gap: 10px; margin: 14px 0; }
.set-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(240px, 1.2fr); gap: 14px; padding: 12px 14px; border: 1px solid var(--line, #e3e5e0); border-radius: var(--r-sm, 10px); background: var(--surface, #fff); }
.set-lbl { display: flex; flex-direction: column; gap: 4px; } .set-lbl small { color: var(--ink-muted); line-height: 1.45; } .set-lbl .badge { align-self: flex-start; }
.set-val { display: flex; gap: 8px; align-items: flex-start; } .set-val input, .set-val textarea { flex: 1 1 auto; min-width: 0; }
.set-val textarea.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.set-foot { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; } .set-foot .grow { flex: 1 1 220px; }
#setSysHint.err { color: var(--danger-ink, #b42318); }
.set-tpl-pick { display: inline-flex; margin: 14px 0 10px; flex-wrap: wrap; }
.set-vers td.set-act { white-space: nowrap; display: flex; gap: 6px; }
.set-tpl { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(300px, 1.1fr); gap: 16px; margin-top: 14px; align-items: start; }
.set-tpl-form { display: flex; flex-direction: column; gap: 10px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.set-chks { display: flex; flex-wrap: wrap; gap: 6px 14px; } .set-chk { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-13); cursor: pointer; } .set-chk.dis { opacity: .55; cursor: not-allowed; }
.set-chk input { width: 18px; height: 18px; accent-color: var(--mp-green-700); }
.set-order { margin: 0; padding-left: 22px; display: grid; gap: 4px; } .set-order li { display: flex; align-items: center; gap: 6px; } .set-order li > span { flex: 1 1 auto; }
.set-find { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 10px; } .set-find .grow { flex: 1 1 auto; }
.set-tpl-side { position: sticky; top: 12px; }
.set-ba { max-width: 320px; overflow-wrap: anywhere; font-size: var(--fs-12, 12px); }
@media (max-width: 860px) { .set-row, .set-tpl { grid-template-columns: 1fr; } .set-tpl-side { position: static; } }
@media print { .sys-trial-bar { display: none !important; } }
/* v33.90: ตั้งค่าระบบ ▸ การขนส่ง */
.ship-card { margin: 14px 0; padding: 16px 18px; border: 1px solid var(--line, #e3e5e0); border-radius: var(--r-md, 12px); background: var(--surface, #fff); display: flex; flex-direction: column; gap: 14px; }
.ship-card h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: var(--fs-15, 15px); }
.ship-row { display: grid; grid-template-columns: 140px minmax(0, 1fr) 220px; gap: 14px; align-items: start; }
.ship-row:nth-of-type(2) { grid-template-columns: 140px minmax(0, 260px); }
.ship-lbl { padding-top: 7px; color: var(--ink-muted); font-size: var(--fs-13, 13px); }
.ship-chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 38px; max-height: 190px; overflow: auto; padding: 2px; }
.ship-chip { display: inline-flex; align-items: center; gap: 2px; padding: 4px 4px 4px 6px; border-radius: 8px; background: var(--mp-green-700, #1b3246); color: #fff; font-size: var(--fs-13, 13px); font-weight: 600; }
.ship-chip.main { box-shadow: 0 0 0 2px var(--warn-ink, #b7791f); }
.ship-chip.main > span::after { content: ' ★'; }
.ship-chip button { border: 0; background: rgba(255,255,255,.18); color: #fff; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-size: 14px; line-height: 1; display: inline-grid; place-items: center; }
.ship-chip button.ship-mv { background: none; width: 16px; }
.ship-chip button:disabled { opacity: .3; cursor: default; }
.ship-chip > span { padding: 0 4px; }
.ship-add select, .ship-row > select { width: 100%; }
.ship-own { display: flex; gap: 6px; margin-top: 8px; } .ship-own input { flex: 1 1 auto; min-width: 0; } .ship-own.hidden { display: none; }
@media (max-width: 860px) { .ship-row, .ship-row:nth-of-type(2) { grid-template-columns: 1fr; } .ship-lbl { padding-top: 0; } }
/* v33.106: ตั้งค่าระบบ ▸ การขนส่ง ▸ วิธีคิดค่าส่ง (แก้ตัวเลขในสูตรเดิม) */
.rate-card > .micro-hint { margin: 0; }
#setRateForm { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rate-grp { border: 1px solid var(--line, #e3e5e0); border-radius: var(--r-sm, 10px); padding: 12px 14px; min-width: 0; }
.rate-grp h4 { margin: 0 0 10px; font-size: var(--fs-14, 14px); }
.rate-grp > .micro-hint { margin: 8px 0 0; }
.rate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; }
.rate-f { margin: 0; min-width: 0; }
.rate-f .field-label { margin-bottom: 4px; }
.rate-in { display: flex; align-items: center; gap: 8px; }
.rate-in input { flex: 1 1 auto; min-width: 0; width: 100%; }
.rate-u { flex: none; color: var(--ink-muted); font-size: var(--fs-12, 12px); white-space: nowrap; }
.rate-help { display: block; margin-top: 4px; color: var(--ink-subtle); font-size: var(--fs-11, 11px); line-height: 1.45; }
.rate-foot { display: flex; align-items: center; min-height: 28px; margin-top: 2px; }
.rate-tip { color: var(--ink-subtle); font-size: var(--fs-11, 11px); }
.rate-back { min-height: 28px; padding: 2px 8px; font-size: var(--fs-12, 12px); }
.rate-back[hidden], .rate-tip[hidden] { display: none; }
.rate-tiers { margin-bottom: 12px; min-width: 0; }
.rate-sub { font-size: var(--fs-12, 12px); font-weight: 600; color: var(--ink-muted); margin-bottom: 6px; }
.rate-tlist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 14px; font-size: var(--fs-13, 13px); }
.rate-tlist li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--line, #e3e5e0); }
.rate-table { display: flex; flex-direction: column; gap: 6px; max-width: 520px; }
.rate-trow { display: grid; grid-template-columns: 74px minmax(0, 1fr) minmax(0, 1fr) 40px; gap: 8px; align-items: center; }
.rate-thead { font-size: var(--fs-11, 11px); color: var(--ink-muted); }
.rate-from { font-size: var(--fs-13, 13px); color: var(--ink-muted); text-align: right; padding-right: 4px; }
.rate-from::after { content: ' –'; }
.rate-trow input { width: 100%; min-width: 0; }
.rate-del { width: 40px; padding: 0; justify-content: center; }
.rate-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.rate-prevbox { border-top: 1px dashed var(--line, #e3e5e0); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rate-pvin { display: flex; flex-wrap: wrap; gap: 10px 14px; } .rate-pvin .field { margin: 0; flex: 0 1 180px; min-width: 0; } .rate-pvin input { width: 100%; }
.rate-pv { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-13, 13px); overflow-wrap: anywhere; }
.rate-pv .rate-new { color: var(--ok-ink, #1d6b3a); }
.rate-was { color: var(--ink-subtle); }
#setRatePrev .err { color: var(--danger-ink, #b42318); }
@media (max-width: 760px) {
  .rate-card { padding: 14px 12px; }
  .rate-grp { padding: 10px 10px; }
  .rate-grid { grid-template-columns: 1fr; }
  .rate-trow { grid-template-columns: 54px minmax(0, 1fr) minmax(0, 1fr) 40px; gap: 6px; }
  .rate-back { min-height: 36px; }
  .rate-pvin .field { flex: 1 1 40%; }
}
/* v33.91: โมดูลสินค้า (เฟส 2A) */
dialog.sheet.wide { width: min(1040px, calc(100vw - 24px)); }
@media (max-width: 760px) { dialog.sheet.wide { width: 100vw; } }   /* v33.95: มือถือ — หน้าต่างกว้าง (ผู้ติดต่อ / เช่าบ่อ / …) เต็มจอแบบ sheet อื่น (เดิมกว้าง 100vw − 24px ชิดซ้าย) */
.pc-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 12px 0 6px; } .pc-toolbar .search { flex: 1 1 220px; min-width: 0; }
.pc-row { cursor: pointer; } .pc-row:hover td { background: var(--surface-sunk, #f2f4f5); } .pc-row.is-hidden td, .order-table tr.is-hidden td { opacity: .6; }
.pc-cats { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.pd-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.pd-cat { border: 1px solid var(--line, #e3e5e0); border-radius: 10px; padding: 8px 10px; } .pd-cat.on { border-color: var(--mp-green-700, #1b3246); background: var(--surface-sunk, #f2f4f5); }
.pd-cat-f { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; margin-top: 6px; font-size: var(--fs-12, 12px); } .pd-cat-f select { min-width: 0; font-size: var(--fs-12, 12px); }
/* v33.106: ช่องสูตร + ปุ่มสร้างสูตรใหม่ · คำแนะนำรหัสอัตโนมัติ */
.pd-fsel { display: flex; gap: 6px; align-items: center; min-width: 0; } .pd-fsel select { flex: 1 1 auto; } .pd-fsel .pd-fadd { flex: 0 0 auto; white-space: nowrap; padding-inline: 8px; }
.pd-codehint { margin: -4px 0 8px; }
/* v33.107: รหัสสินค้าหลัก = ตัวอักษร + เลขที่ระบบออก · เลือกสินค้าหลักเดิม / ย้ายสินค้าย่อยมารวม */
.pd-code { display: flex; align-items: stretch; min-width: 0; } .pd-code input { flex: 1 1 auto; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; text-transform: uppercase; }
.pd-code-n { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-left: 0; border-radius: 0 var(--r-md, 10px) var(--r-md, 10px) 0; background: var(--surface-sunk, #f2f4f5); color: var(--ink-subtle); font-weight: 700; white-space: nowrap; }
.pd-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; padding: 16px; margin-bottom: 14px; border: 1px dashed var(--mp-mint-600, #2f7d6d); border-radius: var(--r-lg, 12px); background: var(--surface-sel); color: var(--mp-green-700); text-align: left; cursor: pointer; font: inherit; }
.pd-choice b { font-size: 15px; } .pd-choice small { color: var(--ink-subtle); }
#pdPickQ, #pdMoveQ { width: 100%; margin: 6px 0; }
.pd-pick-list { display: flex; flex-direction: column; gap: 6px; max-height: min(420px, 50vh); overflow: auto; }
.pd-pick { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; width: 100%; min-height: 48px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-md, 10px); background: var(--surface); text-align: left; cursor: pointer; font: inherit; color: var(--ink-strong); }
.pd-pick:hover { background: var(--surface-hover); } .pd-pick small { color: var(--ink-subtle); white-space: nowrap; } .pd-pick span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* v33.108: คลังสูตร — สูตรที่ตั้งเอง (เปลี่ยนชื่อในแถว) + คำอธิบายการคำนวณเดิม */
.pf-empty { padding: 16px; text-align: center; } .pf-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; min-width: 300px; } .pf-act .pf-del { color: var(--danger, #b42318); }
.pf-ren { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } .pf-ren-in { flex: 1 1 180px; min-width: 0; }
.pf-builtin { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--r-lg, 12px); padding: 10px 14px; background: var(--surface); }
.pf-builtin > summary { cursor: pointer; font-weight: 700; color: var(--mp-green-700); min-height: 32px; display: flex; align-items: center; }
.pf-bl { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin-top: 8px; }
.pf-bi { border: 1px solid var(--line); border-radius: var(--r-md, 10px); padding: 10px 12px; background: var(--surface-sunk, #f6f7f8); }
.pf-bi b { display: block; } .pf-bi .pf-bi-aud { font-size: 12px; color: var(--ink-subtle); } .pf-bi p { margin: 6px 0 4px; font-size: 13px; line-height: 1.55; }
@media (max-width: 760px) { .pf-ren-in { font-size: 16px; } .pf-acts { min-width: 0; justify-content: flex-start; } }
.pd-move { margin-top: 8px; } .pd-move-list { max-height: 260px; } .pd-moved { display: block; color: var(--mp-orange-600, #c2410c); }
@media (max-width: 760px) { #pdPickQ, #pdMoveQ, .pd-code input { font-size: 16px; } .pd-pick { grid-template-columns: auto 1fr; } .pd-pick small { grid-column: 2; } }
.pd-vars input[type=text] { width: 100%; min-width: 4em; } .pd-flag input { width: 16px; height: 16px; } .pd-vars td { vertical-align: middle; }
.pd-flags { display: flex; flex-wrap: wrap; gap: 4px 10px; } .pd-flag { display: inline-flex; gap: 4px; align-items: center; font-size: var(--fs-12, 12px); white-space: nowrap; }
.pd-act { white-space: nowrap; } .pd-vbar { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.pf-in { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; } .pf-in input { min-width: 0; }
.pf-res.ok { color: var(--ok-ink, #1b6b3a); font-weight: 600; } .pf-res.bad { color: var(--danger-ink, #b42318); font-weight: 600; } #pfErr.err { color: var(--danger-ink, #b42318); }

.pc-toolbar .search { width: auto; } .pc-toolbar select { width: auto; flex: 0 1 220px; min-width: 140px; } #pcStatus { align-self: auto; }
#prodDialog .sheet-foot .grow, #prodDialog .sheet-foot .field { flex: 1 1 260px; } #pdSave { flex: 0 0 auto; min-width: 140px; }
/* v33.91 (เฟส 2C): ช่องกรอกค่าสูตรในหน้าสร้างออร์เดอร์ */
.fx-box { margin-top: 14px; padding: 12px 14px; border: 1px dashed var(--line, #d7dde2); border-radius: 12px; background: var(--surface-soft, #f6f8fa); }
.fx-box .input-grid { margin-top: 8px; }
/* v33.91 (เฟส 3A): ผู้ติดต่อ S20 / S21 */
.ct-toolbar { flex-wrap: wrap; align-items: center; } .ct-toolbar .search { flex: 1 1 240px; width: auto; } .ct-toolbar select { width: auto; flex: 0 1 200px; } #ctKind { align-self: auto; }
.ct-row { cursor: pointer; } .ct-row:hover td { background: var(--surface-soft, #f6f8fa); } .ct-row.is-hidden td { opacity: .6; }
.ct-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ct-stat { padding: 10px 12px; border: 1px solid var(--line, #e0e4e8); border-radius: 12px; background: var(--surface-soft, #f7f8f9); display: flex; flex-direction: column; gap: 2px; }
.ct-stat small { color: var(--muted, #5b646b); font-size: 12px; } .ct-stat b { font-size: 16px; } .ct-stat.warn b { color: #a4461b; }
.ct-tabs { margin-bottom: 14px; }
.ct-info textarea { width: 100%; }
.ct-addrs { display: grid; gap: 12px; margin-bottom: 12px; }
.ct-addr { padding: 12px 14px; border: 1px solid var(--line, #e0e4e8); border-radius: 12px; } .ct-addr.on { border-color: var(--brand, #1b3246); box-shadow: inset 3px 0 0 var(--brand, #1b3246); }
.ct-addr-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ct-tax, .ct-hist { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; } .ct-tax li, .ct-hist li { padding: 10px 12px; border: 1px solid var(--line-soft, #edeff1); border-radius: 10px; }
.ct-diff { margin-top: 6px; font-size: 13px; display: grid; gap: 2px; } .ct-diff s { color: var(--muted, #5b646b); }
.ct-orders tbody tr { cursor: pointer; } .ct-orders tr.is-hidden td { opacity: .55; }
/* v33.95 (3B): รวม / ย้ายผู้ติดต่อ */
.ct-mtab { display: grid; gap: 14px; } .ct-mtab > p { margin: 0; }
.ct-merge, .ct-move { padding: 12px 14px; border: 1px solid var(--line, #e0e4e8); border-radius: 12px; margin: 0; }
.ct-msug { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 6px 0 10px; }
.ct-mchip { all: unset; box-sizing: border-box; cursor: pointer; display: block; border-radius: 10px; }
.ct-mchip:focus-visible { outline: 2px solid var(--brand, #1b3246); outline-offset: 2px; }
.ct-mcard { padding: 9px 11px; border: 1px solid var(--line, #e0e4e8); border-radius: 10px; background: var(--surface, #fff); display: grid; gap: 3px; font-size: 14px; min-height: 100%; box-sizing: border-box; }
.ct-mchip:hover .ct-mcard { border-color: var(--brand, #1b3246); } .ct-mchip.on .ct-mcard, .ct-mcard.on { border-color: var(--brand, #1b3246); box-shadow: inset 3px 0 0 var(--brand, #1b3246); }
.ct-mplan { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line, #e0e4e8); display: grid; gap: 10px; }
.ct-mkeep { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.ct-mrow { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; } .ct-mside { display: grid; gap: 4px; }
.ct-marrow { font-size: 22px; color: var(--muted, #5b646b); }
.ct-mnote { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
@media (max-width: 560px) { .ct-mrow { grid-template-columns: 1fr; } .ct-marrow { transform: rotate(90deg); justify-self: center; } }
/* v33.91 (เฟส 4A): ค่าบริการเป็นบรรทัดรหัส SRV */
.sku-tag { display: inline-block; white-space: nowrap; padding: 0 6px; border-radius: 6px; font: 600 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--brand, #1b3246); background: color-mix(in srgb, var(--brand, #1b3246) 9%, transparent); vertical-align: 1px; }
.sku-tag.hidden { display: none; }
.totals .srv-line dt { color: var(--muted, #5b646b); }
/* v33.91 (เฟส 5): ค่าคอม */
.cr-bar { align-items: flex-end; flex-wrap: wrap; } .cr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cm-card { padding: 12px 14px; border: 1px solid var(--line, #e0e4e8); border-radius: 12px; margin-bottom: 12px; } .cm-card.is-hidden { opacity: .6; }
.cm-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.cm-tiers, .cm-ed { width: 100%; } .cm-ed input, .cm-ed select { width: 100%; min-width: 80px; }
.cm-payee { cursor: pointer; } .cm-payee:hover td { background: var(--surface-soft, #f6f8fa); } .cm-detail > td { padding: 0 0 12px 18px; background: var(--surface-soft, #f7f8f9); }
.cm-lines tr.cm-adj td { color: #a4461b; } .cm-plan { margin: 10px 0; } .cm-plan summary { cursor: pointer; font-weight: 600; }

/* v33.93 (เฟส 6): เช่าบ่อ S40 / S41 */
.rent-filter { flex-wrap: wrap; }
.rent-filter button b { font-weight: 700; margin-left: 2px; }
.rent-filter button.is-danger b { color: var(--danger-ink, #a5342b); }
.rent-table tr.rent-row { cursor: pointer; }
.rent-table tr.rent-row:focus-visible { outline: 2px solid var(--brand, #175082); outline-offset: -2px; }
.danger-text { color: var(--danger-ink, #a5342b); font-weight: 600; }
.ct-stat.is-danger b { color: var(--danger-ink, #a5342b); } .ct-stat.is-warn b { color: #a4461b; }
.rd-head { margin-bottom: 12px; line-height: 1.6; }
.rd-quick { display: flex; gap: 6px; align-items: flex-end; padding-bottom: 6px; }
.rd-settle td { padding: 6px 10px; } .rd-settle tr.rd-net td { border-top: 2px solid var(--line, #e0e4e8); font-size: 16px; }
.rd-edit > summary { cursor: pointer; font-weight: 600; padding: 4px 0 10px; }
.rd-hist td { vertical-align: top; font-size: 13px; }
.rent-cal { overflow-x: auto; border: 1px solid var(--line, #e0e4e8); border-radius: 12px; background: var(--surface, #fff); }
.rent-cal .rc-head, .rent-cal .rc-row { display: grid; grid-template-columns: minmax(150px, 1.4fr) repeat(var(--days, 14), minmax(30px, 1fr)); min-width: 620px; }
.rent-cal .rc-head { position: sticky; top: 0; background: var(--surface-soft, #f7f8f9); font-size: 12px; border-bottom: 1px solid var(--line, #e0e4e8); }
.rent-cal .rc-day { text-align: center; padding: 6px 0; line-height: 1.1; } .rent-cal .rc-day small { display: block; color: var(--muted, #5b646b); font-size: 10px; }
.rent-cal .rc-day.is-today { color: var(--brand, #175082); font-weight: 700; }
.rent-cal .rc-row { border-bottom: 1px solid var(--line, #eef0f2); cursor: pointer; } .rent-cal .rc-row:hover { background: var(--surface-soft, #f7f8f9); }
.rent-cal .rc-name { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; } .rent-cal .rc-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .rent-cal .rc-name small { font-size: 11px; color: var(--muted, #5b646b); }
.rent-cal .rc-cell { margin: 10px 0; height: 18px; border-left: 1px dashed transparent; }
.rent-cal .rc-cell.is-today { border-left-color: var(--brand, #175082); }
.rent-cal .rc-cell.on { background: #2c6aa1; } .rent-cal .rc-cell.plan { background: repeating-linear-gradient(45deg, #cedce9, #cedce9 4px, #e9eff5 4px, #e9eff5 8px); }
.rent-cal .rc-cell.over { background: var(--danger, #ef4444); } .rent-cal .rc-cell.back { box-shadow: inset -3px 0 0 #333; }
.rent-table .warn-text { color: #a4461b; font-size: 12px; font-weight: 600; }
.rd-actions { margin: 0 0 14px; display: flex; justify-content: flex-end; }
.ct-mtab .row-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
/* v33.96: ค่าคอม — หมวดที่ไม่นับ · ปรับยอด / เช่าบ่อ — ค่าต่อรหัส */
.cm-cats { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 6px 0 12px; align-items: center; } .cm-cats > small { flex-basis: 100%; }
.cm-adjform { margin: 0 0 12px; padding: 12px 14px; border: 1px dashed var(--line, #e0e4e8); border-radius: 12px; }
.cm-lines tr.cm-adj td { background: var(--surface-soft, #f7f8f9); }
.rc-skus input { width: 120px; max-width: 100%; }
.rd-feenote { margin: 4px 0 0; }
.cm-subhead { margin: 18px 0 6px; font-weight: 700; padding-top: 12px; border-top: 1px solid var(--line, #e0e4e8); }
/* v33.106: แผน Dealer — 2 ส่วน (ค่าคอมที่ Dealer ได้ / ค่าคอมของพนักงานที่สร้างออร์เดอร์) + ตัวอย่างสด · บรรทัดผู้สร้างออร์เดอร์ Dealer */
.cm-sec { margin: 14px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line, #e0e4e8); }
.cm-sec-title { margin: 0 0 4px; font-size: var(--fs-14, 14px); font-weight: 700; line-height: 1.5; color: var(--ink-section, inherit); }
.cm-card .cm-sec-title { font-size: var(--fs-12, 12px); font-weight: 600; color: var(--ink-muted, #5b646b); }
.cm-dl-explain { margin: -6px 0 12px; } .cm-dl-explain b { color: var(--ink, inherit); }
.cm-cr-sum { margin: 8px 0 0; font-size: var(--fs-13, 13px); font-weight: 600; }
.cm-cr-help { margin: 6px 0 0; padding-left: 18px; } .cm-cr-help li { margin: 2px 0; }
.cm-ex { margin: 14px 0 6px; padding: 10px 14px; border-radius: 12px; background: var(--surface-soft, #f6f8fa); font-size: var(--fs-13, 13px); }
.cm-ex-title { font-weight: 600; margin-bottom: 4px; } .cm-ex ul { margin: 0; padding-left: 18px; } .cm-ex li { margin: 2px 0; overflow-wrap: anywhere; }
.cm-lines tr.cm-creator td { background: #f3f7fb; }
@media (max-width: 760px) {
  #cdBody .cm-ed tr { grid-template-columns: 1fr 1fr; }
  #cdBody .cm-ed td.cm-ed-rm { grid-column: 1 / -1; text-align: right; }
  #cdBody .cm-ed td::before { white-space: normal; }
  #cdBody .cm-ed input, #cdBody .cm-ed select { min-width: 0; }
  #cdBody .cm-sec .set-grid { grid-template-columns: 1fr; }
}
/* v33.97: Dashboard ลีดจาก Tag */
.dash-tags .dash-grid { margin-top: 10px; } .dash-tag-table td small { color: var(--muted, #5b646b); }

/* v33.98: แกลเลอรีสลิป (Gateway v2 · V2_Slips.gs) */
.slip-tools { flex-wrap: wrap; align-items: center; gap: 8px; }
.slip-dates { display: flex; align-items: center; gap: 6px; }
.slip-dates input[type=date] { min-height: 38px; padding: 4px 8px; border: 1px solid var(--line, #dfe3e7); border-radius: var(--r-sm, 8px); background: var(--surface, #fff); color: var(--ink, #141d25); }
#sgFilter { margin: 8px 0 4px; }
.slip-folders { display: grid; gap: 6px; margin: 10px 0; padding: 10px 14px; border: 1px dashed var(--line, #dfe3e7); border-radius: var(--r-md, 12px); background: var(--surface-soft, #f7f8f9); font-size: 13px; }
.slip-folders .btn { margin-left: 4px; }
.slip-folders code { font-size: 12px; padding: 1px 5px; border-radius: 4px; background: var(--surface-sunk, #eef0f1); }
.slip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 12px; margin-top: 10px; }
.slip-card { display: flex; flex-direction: column; border: 1px solid var(--line, #e0e4e8); border-radius: var(--r-lg, 14px); background: var(--surface, #fff); overflow: hidden; min-width: 0; }
.slip-card.is-cancel { opacity: .6; }
.slip-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 3 / 4; padding: 0; border: 0; border-bottom: 1px solid var(--line, #e0e4e8); background: var(--surface-sunk, #eef0f1); cursor: zoom-in; overflow: hidden; }
.slip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slip-thumb:focus-visible { outline: 2px solid var(--mp-green-700, #175082); outline-offset: -2px; }
.slip-ph { padding: 10px; font-size: 12px; color: var(--ink-muted, #5b646b); text-align: center; }
.slip-k { position: absolute; top: 8px; right: 8px; padding: 2px 7px; border-radius: 999px; background: rgba(20, 37, 28, .72); color: #fff; font-size: 11px; font-weight: 700; }
.slip-meta { display: grid; gap: 3px; padding: 9px 11px 11px; font-size: 13px; min-width: 0; }
.slip-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 6px; min-width: 0; }
.slip-top .linkish { min-width: 0; overflow-wrap: anywhere; font-size: 12px; text-align: left; }
.slip-amt { font-weight: 700; font-size: 15px; } .slip-amt small { font-weight: 400; color: var(--ink-muted, #5b646b); font-size: 12px; }
.slip-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slip-more { display: flex; justify-content: center; margin: 16px 0 4px; }
button.linkish { padding: 0; border: 0; background: none; color: var(--mp-green-700, #175082); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
dialog.slip-viewer { width: min(820px, 96vw); max-width: 96vw; }
.slip-v-body { display: grid; gap: 10px; padding: 14px 16px; }
.slip-v-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.slip-v-img { display: grid; place-items: center; min-height: 200px; background: var(--surface-sunk, #eef0f1); border-radius: var(--r-md, 12px); overflow: hidden; }
.slip-full { max-width: 100%; max-height: 68vh; display: block; }
.slip-v-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.slip-scan-sum { margin: 10px 0; font-size: 13px; }
.slip-scan-table td .small { font-size: 12px; word-break: break-all; }
@media (max-width: 760px) {
  .slip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .slip-tools .search { flex: 1 1 100%; }
  .slip-dates { flex: 1 1 100%; } .slip-dates input[type=date] { flex: 1; min-width: 0; font-size: 16px; }
  .slip-meta { padding: 7px 8px 9px; font-size: 12px; } .slip-amt { font-size: 14px; }
  .slip-v-body { padding: 12px; } .slip-full { max-height: 60vh; }
}

/* v33.99: สร้าง / แก้สูตรแบบเป็นขั้น (mp-formula.js) */
#fmlDialog .sheet-body { display: grid; gap: 18px; }
.fx-sec { display: grid; gap: 10px; }
.fx-sec-h { display: flex; gap: 10px; align-items: flex-start; }
.fx-sec-h h3 { margin: 0; font-size: 16px; line-height: 1.5; }
.fx-sec-h p { margin: 0; font-size: 12.5px; color: var(--ink-muted, #5b646b); line-height: 1.6; }
.fx-num { flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--mp-green-700, #1d405e); color: #fff; font-size: 13px; font-weight: 700; margin-top: 1px; }
.fx-choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.fx-choice.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fx-choice.two.fx-aud3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }   /* v33.106: ราคาขาย / ช่าง / น้ำหนัก */
.fx-card { position: relative; display: flex; gap: 10px; align-items: flex-start; min-height: 64px; padding: 12px 12px; border: 1.5px solid var(--line, #dfe3e7); border-radius: var(--r-lg, 14px); background: var(--surface, #fff); cursor: pointer; transition: border-color .15s, background .15s; }
.fx-card:hover { border-color: var(--ok-line, #9cc9b2); }
.fx-card.on { border-color: var(--mp-green-700, #1d405e); background: var(--ok-bg, #eaf0f5); box-shadow: inset 0 0 0 1px var(--mp-green-700, #1d405e); }
.fx-card.dis { cursor: default; opacity: .75; } .fx-card.dis.on { opacity: 1; }
.fx-card .fx-radio { position: absolute; opacity: 0; pointer-events: none; }
.fx-card:focus-within { outline: 2px solid var(--mp-green-700, #1d405e); outline-offset: 2px; }
.fx-ic { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-sunk, #eef0f1); font-size: 17px; line-height: 1; }
.fx-card.on .fx-ic { background: #fff; }
.fx-ct { display: grid; gap: 2px; min-width: 0; } .fx-ct b { font-size: 14px; line-height: 1.45; } .fx-ct small { font-size: 12px; color: var(--ink-muted, #5b646b); line-height: 1.5; }
.fx-wait { margin: 0; padding: 14px; border: 1px dashed var(--line, #dfe3e7); border-radius: 12px; color: var(--ink-muted, #5b646b); text-align: center; font-size: 13px; }
.fx-fields { display: grid; gap: 6px; }
.fx-fixed, .fx-in { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fx-fixed small { color: var(--ink-muted, #5b646b); font-size: 12px; }
.fx-in input { min-width: 0; flex: 1 1 auto; min-height: 42px; } .fx-in input.fx-unit { flex: 0 0 5.5em; }
.fx-tag { flex: none; display: inline-flex; align-items: center; min-height: 26px; padding: 2px 9px; border-radius: 999px; background: var(--surface-sunk, #eef0f1); font-size: 12px; font-weight: 600; white-space: nowrap; }
.fx-tag.new { background: var(--ok-bg, #eaf0f5); color: var(--mp-green-700, #1d405e); }
.fx-key { flex: none; font-size: 11.5px; padding: 2px 6px; border-radius: 6px; background: var(--surface-sunk, #eef0f1); color: var(--ink-muted, #5b646b); }
.fx-opts { display: grid; gap: 6px; }
.fx-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 1px solid var(--line, #dfe3e7); border-radius: 12px; background: var(--surface, #fff); }
.fx-opt:not(.on) { background: var(--surface-soft, #f7f8f9); }
.fx-opt-l { display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; }
.fx-opt-l > span { display: grid; gap: 1px; min-width: 0; } .fx-opt-l b { font-size: 13.5px; } .fx-opt-l small { font-size: 11.5px; color: var(--ink-muted, #5b646b); line-height: 1.45; }
.fx-optin { display: flex; align-items: center; gap: 6px; flex: none; } .fx-optin .unit { font-size: 12px; color: var(--ink-muted, #5b646b); min-width: 2.2em; }
.fx-optv { width: 6.5em; min-height: 40px; text-align: right; }
.fx-opt:not(.on) .fx-optv { opacity: .45; }
.fx-sw { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 44px; height: 26px; margin: 0; border-radius: 999px; background: #c9ced3; cursor: pointer; transition: background .15s; }
.fx-sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.fx-sw:checked { background: var(--mp-green-700, #1d405e); } .fx-sw:checked::after { transform: translateX(18px); }
.fx-sw:focus-visible { outline: 2px solid var(--mp-green-700, #1d405e); outline-offset: 2px; }
.fx-addp { display: flex; gap: 6px; } .fx-addp .fx-pk { flex: 1 1 auto; min-width: 0; min-height: 40px; }
.fx-chips { display: grid; gap: 6px; }
.fx-chiprow { display: flex; flex-wrap: wrap; gap: 6px; }
.fx-chip { min-height: 36px; padding: 4px 11px; border: 1px solid var(--line, #dfe3e7); border-radius: 999px; background: var(--surface, #fff); font: inherit; font-size: 13px; cursor: pointer; }
.fx-chip.var { background: var(--ok-bg, #eaf0f5); border-color: var(--ok-line, #9cc9b2); color: var(--mp-green-700, #1d405e); font-weight: 600; }
.fx-chip.par { background: #fff7e6; border-color: #f0d9a8; color: #7a4b00; font-weight: 600; }
.fx-chip.op { min-width: 40px; font-size: 16px; font-weight: 700; }
.fx-chip:active { transform: translateY(1px); }
#fxExpr { font-size: 15px; line-height: 1.6; }
.fx-read { margin: 0; }
.fx-try-in { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.fx-try-in .field { margin: 0; } .fx-try-in input { min-height: 42px; }
.fx-result { display: flex; align-items: center; min-height: 64px; padding: 12px 16px; border-radius: 14px; background: var(--ok-bg, #eaf0f5); }
.fx-result > span { display: grid; gap: 2px; } .fx-result small { font-size: 12px; color: var(--ink-muted, #5b646b); }
.fx-result strong { font-size: 26px; line-height: 1.35; color: var(--mp-green-700, #1d405e); } .fx-result em { font-style: normal; font-size: 13px; color: var(--ink, #141d25); }
.fx-result .fx-bad { color: var(--danger-ink, #b42318); font-weight: 600; font-size: 13px; }
.fx-okrow { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line, #dfe3e7); border-radius: 12px; cursor: pointer; }
.fx-okrow input { width: 22px; height: 22px; flex: none; margin-top: 2px; accent-color: var(--mp-green-700, #1d405e); }
.fx-okrow span { display: grid; gap: 1px; } .fx-okrow small { font-size: 12px; color: var(--ink-muted, #5b646b); line-height: 1.5; }
.fx-tests { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.fx-tests li { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 10px; border-radius: 10px; background: var(--surface-soft, #f7f8f9); }
.fx-tests li.ok b { color: var(--ok-ink, #1b6b3a); } .fx-tests li.bad { background: var(--warn-bg, #fff4e5); } .fx-chg { display: flex; align-items: center; gap: 6px; color: var(--warn-ink, #8a4b00); font-weight: 600; }
.fx-adv { border-top: 1px solid var(--line, #dfe3e7); padding-top: 12px; } .fx-adv summary { cursor: pointer; font-size: 13px; color: var(--ink-muted, #5b646b); min-height: 32px; }
.fx-expr { display: block; margin: 8px 0 4px; padding: 8px 10px; border-radius: 8px; background: var(--surface-sunk, #eef0f1); font-size: 13px; overflow-wrap: anywhere; }
.fx-why { flex: 1 1 100%; margin: 0; text-align: center; } .fx-why:empty { display: none; }
.pf-how { font-size: 12.5px; color: var(--ink-muted, #5b646b); max-width: 340px; }
@media (max-width: 760px) {
  .fx-choice, .fx-choice.two { grid-template-columns: 1fr; }
  .fx-choice.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fx-choice.two .fx-card { flex-direction: column; gap: 6px; }
  .fx-choice.two.fx-aud3 { grid-template-columns: 1fr; } .fx-choice.two.fx-aud3 .fx-card { flex-direction: row; gap: 10px; }   /* v33.106: 3 ชนิด = แถวละ 1 บนมือถือ */
  .fx-opt { flex-wrap: wrap; } .fx-optin { margin-left: auto; }
  .fx-try-in { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fx-in input, .fx-optv, .fx-try-in input, .fx-addp .fx-pk { font-size: 16px; }
}
.fx-picked { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--mp-green-700, #02335e); border-radius: var(--r-lg, 14px); background: var(--ok-bg, #eafaef); }
.fx-picked .fx-ic { background: #fff; } .fx-picked .fx-ct { flex: 1; } .fx-picked .fx-ct small { font-size: 11.5px; }
.fx-outrow { display: flex; align-items: center; gap: 8px; } .fx-outrow input { flex: 1 1 0; min-width: 0; min-height: 42px; }
.fx-num-ph { flex: none; padding: 6px 10px; border-radius: 8px; background: var(--ok-bg, #eafaef); color: var(--mp-green-700, #02335e); font-weight: 700; font-size: 13px; }
#fmlDialog .fx-optv { width: 6.5em; flex: none; } .fx-optin .unit { white-space: nowrap; }
@media (max-width: 760px) { #fmlDialog .sheet-foot .btn { flex: 1 1 0; } .fx-outrow input { font-size: 16px; } }
.fx-opt:not(.on) .fx-optin { display: none; }   /* ตัวเลือกที่ปิด: ซ่อนช่องตัวเลข */
/* v33.100: แบบสูตรเพิ่ม — จัดกลุ่มการ์ด · ตัวเลือกหลายค่า (ขั้นบันได) · ตารางราคาขั้นบันได · ปุ่มทำสำเนา */
.fx-group + .fx-group { margin-top: 12px; }
.fx-group-h { font-size: 12.5px; font-weight: 600; color: var(--ink-muted, #5b646b); margin: 0 0 6px; }
.fx-opt.multi { flex-wrap: wrap; } .fx-opt.multi .fx-optin { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.fx-mv { display: inline-flex; align-items: center; gap: 5px; } .fx-mv > small { font-size: 12px; color: var(--ink-muted, #5b646b); white-space: nowrap; }
.fx-mv .fx-optv { width: 5.2em; }
.fx-opt.lock { opacity: .7; }
.fx-tier { margin-top: 10px; }
.fx-tier-t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.fx-tier-t td { padding: 7px 10px; border-bottom: 1px solid var(--line, #dfe3e7); } .fx-tier-t td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.fx-tier-t tr:first-child td { border-top: 1px solid var(--line, #dfe3e7); }
.pf-empty { padding: 16px; text-align: center; } .pf-act { white-space: nowrap; } .pf-act .btn + .btn { margin-left: 4px; }
@media (max-width: 640px) { .fx-opt.multi .fx-optin { width: 100%; justify-content: flex-start; margin-left: 34px; } #fmlDialog .fx-mv .fx-optv { width: 5.2em; } }

/* ================= v33.101: หน้าสร้างออร์เดอร์ใช้ง่ายบนมือถือ (รีวิว 8 พ.ย. รอบ 1 + 2) — ลำดับช่อง / การคำนวณ / ข้อมูลที่บันทึกเหมือนเดิม ================= */
/* #3 เลขลำดับชุดเดียว = แถบขั้นด้านบน (ตัดวงกลมเลขในกล่อง + เลข 01–07) */
.form-section > .section-kicker::before { content: none; display: none; }
.ws-s { display: none; }
.workflow-step { cursor: pointer; border-radius: 999px; padding: 4px 12px 4px 4px; transition: background var(--dur, .15s); }
@media (hover: hover) { .workflow-step:hover { background: var(--surface-hover); } }
.workflow-step:focus-visible { outline: 2px solid var(--mp-green-700); outline-offset: 2px; }
.workflow-step.done b { font-size: 12px; }
/* #5 #7 สวิตช์เต็มแถว (แทนช่องติ๊ก 16 px) — ชื่อบรรทัดบน · เงื่อนไขบรรทัดล่าง */
.sw-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 48px; padding: 6px 0; cursor: pointer; }
.sw-row + .sw-row { border-top: 1px solid var(--line-soft, var(--line)); }
.sw-txt { display: grid; gap: 1px; min-width: 0; }
.sw-txt b { font-weight: var(--fw-semibold, 600); font-size: var(--fs-14, 14px); color: var(--ink-heading); line-height: 1.45; }
.sw-txt small { font-size: 12.5px; color: var(--ink-muted); line-height: 1.45; font-weight: var(--fw-regular, 400); }
input.sw { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 48px; height: 28px; margin: 0; border-radius: 999px; background: #c9ced3; cursor: pointer; transition: background .15s; }
input.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
input.sw:checked { background: var(--mp-green-700, #1d405e); } input.sw:checked::after { transform: translateX(20px); }
input.sw:focus-visible { outline: 2px solid var(--mp-green-700, #1d405e); outline-offset: 2px; }
input.sw:disabled { opacity: .5; cursor: not-allowed; }
.sw-row.label-amt { margin-top: 10px; }
.sub-block > .sw-row:first-child { padding-top: 0; }
#hydroBlock .field .sw-row { min-height: 44px; }
/* #2 ช่องค้นลูกค้าช่องเดียว: ผลเช็คเบอร์ / ลงทะเบียนใหม่ใต้ช่อง */
.phone-status { margin-top: 8px; } .phone-status:empty { display: none; }
.phone-status .note { display: grid; gap: 6px; }
.phone-status .phone-hit { display: block; } .phone-status .phone-hit .btn { margin-left: 6px; }
.phone-new input[type=text] { margin: 2px 0; background: var(--surface); }
.phone-new .btn { justify-self: start; }
.seg-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg-choice label { position: relative; display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-md, 10px); background: var(--surface); font-weight: var(--fw-semibold, 600); color: var(--ink-muted); cursor: pointer; }
.seg-choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-choice label:has(input:checked) { border-color: var(--mp-green-700); color: var(--mp-green-700); background: var(--ok-bg); box-shadow: inset 0 0 0 1px var(--mp-green-700); }
.seg-choice label:has(input:focus-visible) { outline: 2px solid var(--mp-green-700); outline-offset: 2px; }
.seg-choice.invalid label { border-color: var(--danger-line); background: var(--danger-bg); }
#custKindField { margin-top: 12px; }
#custKindField .opt { font-weight: var(--fw-regular, 400); }
/* #9 รหัสภายใน (SRV / PT) เฉพาะผู้ดูแล */
body:not(.show-codes) #viewCreate .sku-tag, body:not(.show-codes) .int-code { display: none !important; }
/* #4 ถามก่อนบันทึก: รายการที่กรอกค้าง */
.pending-item { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg, 12px); background: var(--surface-soft); }
.pending-item span { color: var(--ink-muted); font-size: var(--fs-13, 13px); }
.pending-acts { display: grid; gap: 8px; }
/* #10 ภาพ 3D: ปุ่มดูภาพใต้ผลคำนวณ (จอ ≤ 1150) · ปุ่มปิดตอนเต็มจอ */
.view3d-btn { flex: 0 0 auto; }
.studio-close { display: none; }
.studio:fullscreen .studio-close, .studio.is-fullscreen .studio-close { display: inline-flex; min-height: 44px; margin-left: 8px; }
.studio:fullscreen .studio-head, .studio.is-fullscreen .studio-head { position: sticky; top: 0; z-index: 2; background: var(--surface); padding-top: max(14px, env(safe-area-inset-top)); }
@media (min-width: 1151px) { .view3d-btn { display: none !important; } }
/* #11 ตัวอักษรเล็กสุด 12.5 px */
.live-pill { font-size: 12px; letter-spacing: 0; }
.workflow-step b { font-size: 12px; }
#viewCreate .spec-strip small, #viewCreate .badge, #sheetMap { font-size: 12.5px; }
#viewCreate .estimate-head .badge { font-size: 12px; }
#viewCreate .opt, #itemCount, #slipCount, #viewCreate .micro-hint { font-size: 12.5px; }
#itemCount, #slipCount { font-weight: var(--fw-regular, 400); color: var(--ink-muted); }
/* #1 แถบยอดเงินติดจอล่าง (จอ ≤ 1150 px) */
.create-bar { display: none; }
@media (max-width: 1150px) {
  .create-bar { display: flex; position: fixed; left: var(--sidebar-w, 0px); right: 0; bottom: 0; z-index: 45; align-items: center; gap: 12px; padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(0,0,0,.06); }
  .cb-sum { flex: 1 1 auto; min-width: 0; display: grid; line-height: 1.3; }
  .cb-sum small { font-size: 12.5px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cb-sum b { font-size: 19px; color: var(--ink-heading); font-variant-numeric: tabular-nums; white-space: nowrap; }
  #cbNext { flex: none; min-height: 46px; padding: 0 18px; max-width: 58%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; justify-content: center; }
  #viewCreate { padding-bottom: 80px; }
  html { scroll-padding-bottom: 96px; scroll-padding-top: 60px; }
  /* #3 แถบขั้นติดจอบน */
  #workflow.workflow-strip { position: sticky; top: 0; z-index: 30; margin-left: -6px; margin-right: -6px; padding: 8px 6px; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
  .workflow-step.here { background: var(--surface-nav, var(--ok-bg)); color: var(--mp-green-700); font-weight: var(--fw-semibold, 600); }
  /* ข้อความแจ้งอยู่บน ไม่ทับแถบยอดเงิน */
  .toast { top: 14px; bottom: auto; transform: translate(-50%, -15px); }
  .toast.show { transform: translate(-50%, 0); }
}
@media (max-width: 760px) {
  .create-bar { left: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 8px 12px; gap: 10px; }
  .cb-sum b { font-size: 18px; }
  #cbNext { min-height: 46px; padding: 0 14px; }
  #viewCreate { padding-bottom: 72px; }
  html { scroll-padding-top: calc(52px + 52px + env(safe-area-inset-top)); scroll-padding-bottom: calc(var(--tabbar-h) + 84px); }
  #workflow.workflow-strip { top: calc(52px + env(safe-area-inset-top)); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: -18px -14px 14px; padding: 0 4px; background: color-mix(in srgb, var(--surface) 96%, transparent); border-bottom: 1px solid var(--line); }
  .workflow-step { justify-content: center; gap: 5px; padding: 10px 2px 9px; border-radius: 0; border-bottom: 3px solid transparent; font-size: 13px; white-space: nowrap; }
  .workflow-step.here { background: transparent; border-bottom-color: var(--mp-green-700); }
  .workflow-step b { width: 21px; height: 21px; font-size: 12px; flex: none; }
  .ws-l { display: none; } .ws-s { display: inline; }
  #viewCreate .page-heading p { display: none; }
  .toast { top: calc(108px + env(safe-area-inset-top)); left: 50%; max-width: calc(100vw - 24px); font-size: 14px; }   /* ใต้แถบขั้น · ไม่ทับแถบยอดเงิน */
  /* #6 ช่องกรอกทุกช่องในหน้าสร้างออร์เดอร์ 16 px (iPhone ไม่ซูมเอง) */
  #viewCreate select, #viewCreate textarea, #viewCreate input:not([type=checkbox]):not([type=radio]):not([type=file]), .phone-status input { font-size: 16px; }
  #viewCreate input::placeholder, #viewCreate textarea::placeholder { font-size: 14px; }
  /* #5 ปุ่ม / ช่องกดได้ 44 px */
  #viewCreate .btn-sm, #viewCreate .btn { min-height: 44px; }
  .estimate-head .estimate-actions { width: 100%; } .estimate-head .estimate-actions .btn { flex: 1 1 0; justify-content: center; }
  .tag-row select { min-height: 44px; font-size: 16px; flex: 1 1 100%; width: 100%; max-width: 100%; }
  .tag-row .tag-lbl { min-width: 0; flex: 1 1 100%; }
  .tag-chips .chip, .tag-chips button { min-height: 36px; }
  .unit-field:has(#discountUnit) { display: flex; gap: 8px; align-items: stretch; }
  .unit-field:has(#discountUnit) input { padding-right: 12px; flex: 1 1 auto; min-width: 0; }
  #discountUnit.unit { position: static; transform: none; flex: none; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: var(--r-md, 10px); }
  #discountUnit.unit { padding: 2px; }
  #discountUnit button { min-width: 48px; min-height: 44px; font-size: 15px; }
  .inline-check input { width: 22px; height: 22px; }
  .add-row { flex-wrap: nowrap !important; } .add-row .btn { min-height: 48px; }
  #view3dBtn { padding: 0 12px; }
}
@media print { .create-bar { display: none !important; } }
@media (max-width: 1150px) { .calc-only .toast { top: calc(64px + env(safe-area-inset-top)); bottom: auto; } }   /* v33.101: หน้า Dealer — ข้อความแจ้งด้านบน (ไม่ยืดเต็มจอ) */

/* ================= v33.102: CI ใหม่ (โลโก้ MANUTHAM + สี ดำ / กรมท่า / เทาเข้ม / ฟ้าหม่น / ส้ม) ================= */
.brand-mark { width: 168px; height: auto; max-height: 48px; margin: 6px auto 26px; }
.topbar-logo { object-fit: contain; }
@media (min-width: 761px) and (max-width: 1150px) {
  .brand-mark { content: url("icons/manutham-mark.svg"); width: 40px; height: 40px; max-height: none; margin: 2px auto 18px; }   /* แถบเมนูแคบ = สัญลักษณ์ */
}
@media (max-width: 760px) {
  .topbar-logo { width: 30px; height: 30px; }
}
.calc-only .topbar-logo { width: auto; height: 30px; }
.workflow-step.here { box-shadow: inset 0 -3px 0 var(--ci-orange, #fe730d); }
@media (max-width: 760px) { .workflow-step.here { box-shadow: none; border-bottom-color: var(--ci-orange, #fe730d); } }
.btn-soft { background: var(--surface-sel); border-color: #c5d3e0; }   /* v33.102: ปุ่มรองโทนกรมท่า (เดิมใช้พื้นเขียวของสถานะสำเร็จ) */
.btn-soft:hover:not(:disabled) { background: var(--surface-nav); }
.seg-choice label:has(input:checked) { background: var(--surface-sel); }
.picked, .calc-box.ready, .camera-tools button.active { border-color: #c5d3e0; }
.orders-pager .pg-btn:hover:not(:disabled) { border-color: #c5d3e0; }
.pin-logo { display: block; width: 150px; height: auto; margin: 0 0 14px; }   /* v33.102: โลโก้ในหน้าเข้าสู่ระบบ */
@media (max-width: 760px) { .calc-only .topbar-logo { content: url("icons/manutham-mark.svg"); width: 30px; height: 30px; } }   /* หน้า Dealer มือถือ: สัญลักษณ์ (ชื่อหน้าไม่ถูกตัด) */

/* ================= v33.103: โลโก้แต่ละจุดตามค่าตั้ง (ใหม่ 2 บรรทัด / แนวนอน / สัญลักษณ์ / เดิม / ไม่แสดง) ================= */
.brand-mark[hidden], .topbar-logo[hidden], .pin-logo[hidden] { display: none !important; }
.brand-mark.lg-h { width: 184px; max-height: 28px; }
.brand-mark.lg-mark { width: 56px; height: 56px; max-height: none; }
.brand-mark.lg-old { width: 138px; height: 76px; max-height: none; }
@media (min-width: 761px) and (max-width: 1150px) {
  .brand-mark.lg-old { content: normal; width: 72px; height: 42px; }
}
@media (max-width: 760px) {
  .topbar-logo.lg-stack { width: auto; height: 26px; }
  .topbar-logo.lg-h { width: auto; height: 17px; max-width: 150px; }
  .topbar-logo.lg-old { width: 46px; height: 28px; }
  .calc-only .topbar-logo:not(.lg-auto) { content: normal; width: auto; height: 28px; }
  .calc-only .topbar-logo.lg-mark { width: 30px; height: 30px; }
}
.pin-logo.lg-h { width: 210px; } .pin-logo.lg-old { width: 120px; }
/* หน้าตั้งค่า ▸ โลโก้ */
.lg-grid { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); overflow: hidden; }
.lg-row { display: grid; grid-template-columns: minmax(180px, 1.1fr) minmax(200px, 1fr) minmax(160px, 1fr); gap: 14px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--line-soft); }
.lg-row:first-child { border-top: 0; }
.lg-row b { display: block; color: var(--ink-heading); } .lg-row small { display: block; color: var(--ink-muted); font-size: 12.5px; line-height: 1.45; }
.lg-prev { display: flex; align-items: center; justify-content: center; min-height: 64px; padding: 8px; border-radius: var(--r-md); background: var(--surface-soft); border: 1px dashed var(--line); }
.lg-prev img { max-width: 100%; max-height: 52px; object-fit: contain; } .lg-prev.icon img { width: 52px; height: 52px; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.lg-prev .none { color: var(--ink-subtle); font-size: 13px; }
.lg-row.changed { background: var(--surface-sel); }
.lg-quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.lg-note { margin: 12px 0 0; }
@media (max-width: 760px) { .lg-row { grid-template-columns: 1fr; gap: 8px; } }

/* ===================== v33.104: แถบเมนูล่างตามตำแหน่ง (ตั้งในสิทธิการเข้าถึง) ===================== */
@media (max-width: 760px) {
  .nav > .nav-item { order: var(--tab-order, 50); }
  .nav > .nav-item.nav-more { order: 99; }
  .nav-item .nav-label::after { font-size: 11.5px; }
}
.tab-pick { margin: 18px 0 4px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2, #f6f8fa); }
.tab-pick-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tab-pick-head h3 { margin: 0; font-size: 15px; color: var(--ink-heading); }
.tab-pick .micro-hint { margin: 4px 0 10px; }
.tab-preview { display: flex; gap: 2px; padding: 6px 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 12px; }
.tp-slot { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; color: var(--ink); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 4px 2px; }
.tp-slot.tp-more { color: var(--ink-subtle); }
.tp-ico svg { width: 20px; height: 20px; }
.tab-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tab-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 6px 14px 6px 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; }
.tab-chip .tc-no { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2, #eef2f5); color: var(--ink-subtle); font-weight: 700; font-size: 13px; }
.tab-chip.on { border-color: var(--brand, #143551); background: color-mix(in srgb, var(--brand, #143551) 8%, var(--surface)); color: var(--brand, #143551); font-weight: 600; }
.tab-chip.on .tc-no { background: var(--brand, #143551); color: #fff; }
.tab-chip:disabled { opacity: .45; cursor: not-allowed; }
.tab-chip:focus-visible { outline: 3px solid var(--accent, #FE730D); outline-offset: 2px; }

/* ===================== v33.104 รอบ 1: อ่านง่าย · กดง่ายบนมือถือ ===================== */
/* คำอธิบายใต้หัวข้อ = 1 บรรทัด (รายละเอียดอยู่ใน ⓘ) */
.page-heading p.head-desc { font-size: var(--fs-13, 13px); }
.page-heading p.head-desc .i-tip { vertical-align: -3px; }
/* แท็บเลื่อนข้างได้ + จางที่ขอบเมื่อยังมีแท็บซ่อนอยู่ */
.tabs-line, .seg.dash-tabs, .tax-tabs, .debt-lane-tabs, .print-toolbar .seg, .rent-filter, .seg.users-active { scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs-line::-webkit-scrollbar, .seg.dash-tabs::-webkit-scrollbar, .tax-tabs::-webkit-scrollbar, .debt-lane-tabs::-webkit-scrollbar, .print-toolbar .seg::-webkit-scrollbar { display: none; }
.tabs-line button { flex: 0 0 auto; white-space: nowrap; }
[data-fade="r"] { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); }
[data-fade="l"] { -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px); mask-image: linear-gradient(90deg, transparent, #000 40px); }
[data-fade="lr"] { -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent); }
/* หน้าว่างพาไปสถานะอื่น */
.empty-jumps { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
/* กล่องข้อมูลเทคนิค (ซ่อนไว้ กดเปิด) */
details.adv-box { display: block; }
details.adv-box > summary { cursor: pointer; font-weight: var(--fw-semibold, 600); color: var(--ink-muted); min-height: 32px; display: flex; align-items: center; gap: 6px; }
details.adv-box[open] > summary { margin-bottom: 6px; }
details.adv-box > div { margin-top: 6px; }

@media (max-width: 760px) {
  /* แถบบน: ปุ่มเปลี่ยนรหัส / ออกจากระบบ อยู่ใน "เมนู" (แถบล่าง) */
  body:not(.calc-only) #logoutBtn, body:not(.calc-only) #pwBtn { display: none !important; }
  .admin-chip .conn { max-width: 120px; font-size: 11px; }
  /* ปุ่มโหลดใหม่ = ไอคอนกลม มุมขวาบน */
  .page-heading { position: relative; }
  .page-heading > .btn-reload, .page-heading .btn-reload { position: absolute; top: -4px; right: 0; width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; border-radius: 50%; }
  .page-heading:has(.btn-reload) > div:first-child { padding-right: 52px; }
  .btn-reload .btn-txt { display: none; }
  .btn-reload svg { width: 20px; height: 20px; margin: 0; }
  .page-heading p.head-desc { font-size: 14px; margin-top: 4px; }
  /* ชิป / ปุ่มกลุ่ม ตัวใหญ่ขึ้น กดง่าย */
  .seg button, .dash-range button, .tax-tabs button, .debt-lane-tabs button, .seg.users-active button { font-size: 14px; min-height: 42px; padding: 8px 14px; }
  .seg button small, .seg button b, .tax-tabs button small, .debt-lane-tabs button small, .debt-lane-tabs button b { font-size: 12.5px; }
  .tabs-line button { font-size: 14px; min-height: 44px; }
  .btn-sm { min-height: 40px; }
  /* ช่องกรอก 16 px (iPhone ไม่ซูมเอง) */
  .main-content input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), .main-content select, .main-content textarea, dialog input:not([type=checkbox]):not([type=radio]), dialog select, dialog textarea { font-size: 16px; }
  .main-content input[type=month], .main-content input[type=date] { min-height: 44px; }
  /* หน้าพิมพ์: ไม่ล้นจอ */
  .print-toolbar { padding: 14px; gap: 14px; }
  .print-toolbar .grow { min-width: 0; }
  #printFind { flex-wrap: wrap; }
  #printFind > div { flex: 1 1 100%; min-width: 0; }
  #printFind > .btn { flex: 1 1 100%; justify-content: center; }
  .print-toolbar .field { min-width: 0; max-width: 100%; }
  .print-toolbar .seg { overflow-x: auto; max-width: 100%; }
  .print-toolbar .seg button { flex: 0 0 auto; }
  #printGo { width: 100%; justify-content: center; }
  .print-pick { display: flex; flex-wrap: wrap; gap: 8px 18px; }
  .print-pick label { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; }
  .print-batch summary { min-height: 44px; }
}

/* ===================== v33.104 รอบ 2: รายการออร์เดอร์บนมือถือ ===================== */
.ord-mob-bar { display: none; }
.of-sheet .sheet-body { display: grid; gap: 14px; align-content: start; }
.of-sheet .date-range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.of-sheet .date-range label { flex: 1 1 100%; font-weight: var(--fw-semibold, 600); }
.of-sheet .date-range input { flex: 1 1 0; min-width: 0; }
.of-sheet .doc-sort { display: grid; gap: 6px; } .of-sheet .doc-sort select { width: 100%; }
.of-sheet .ofilters { flex-wrap: wrap; overflow: visible; margin: 0; }
.of-sheet .ofilter-btn { flex: 1 1 100%; min-height: 48px; justify-content: space-between; border-radius: var(--r-md, 12px); }
.of-sheet .ofilter-btn .ofilter-val { margin-left: auto; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ofilter-pop.of-inline { position: static !important; width: auto !important; left: auto !important; top: auto !important; max-height: none; box-shadow: none; margin-top: -4px; }
.of-sheet .orders-tools { display: grid !important; gap: 10px; margin: 0 !important; }
.of-sheet .orders-tools .btn { width: 100%; justify-content: flex-start; min-height: 48px; font-size: 15px; }
.bulk-bar.bulk-idle { padding: 8px 12px; }
.bulk-bar.bulk-idle #bulkClear, .bulk-bar.bulk-idle .bulk-tools { display: none; }
.tel-link { color: inherit; text-decoration: none; border-bottom: 1px dashed currentColor; }
@media (min-width: 761px) { .tel-link { pointer-events: none; border-bottom: 0; } }   /* คอม: คลิกแถว = เปิดรายละเอียด (โทรเฉพาะมือถือ) */
/* คอม: ปุ่มยกเลิกในแถวเป็นไอคอนเงียบ ๆ (แดงเมื่อชี้) — ยกเลิกจริงต้องยืนยันเสมอ */
@media (min-width: 761px) {
  .order-table .btn-del { color: var(--ink-subtle); border-color: transparent; background: none; }
  .order-table .btn-del { gap: 4px; padding-inline: 6px; }
  .order-table td.row-del .btn-del .del-text { display: inline; font-size: var(--fs-12); }   /* v33.110 (🟠6): แสดงคำว่า ยกเลิก */
  .order-table .btn-del:hover, .order-table .btn-del:focus-visible { color: var(--danger-ink, #b42318); background: var(--danger-bg, #fdecea); }
}
@media (max-width: 760px) {
  #viewOrders > .toolbar { display: grid !important; grid-template-columns: 1fr; gap: 8px; }
  .ord-mob-bar { display: flex; gap: 8px; }
  .ord-mob-bar .of-btn { flex: 1 1 auto; justify-content: center; min-height: 44px; font-size: 15px; }
  .ord-mob-bar .of-btn.on { border-color: var(--brand, #143551); color: var(--brand, #143551); }
  .of-btn .of-n:not(:empty) { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent, #FE730D); color: #fff; font-size: 13px; font-weight: 700; }
  .ord-mob-bar .of-more { flex: 0 0 48px; min-height: 44px; font-size: 22px; line-height: 1; justify-content: center; padding: 0; }
  .bulk-bar.bulk-idle { display: none !important; }
  /* การ์ดออร์เดอร์ 3 บรรทัด: เลข + ยอด · ลูกค้า + ช่องทาง · ชำระ + สถานะงาน (กดการ์ด = ดูรายละเอียด / แก้ / ยกเลิก) */
  #viewOrders .order-table tr { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 12px 14px; }
  #viewOrders .order-table td::before { content: none; }
  #viewOrders .order-table td.o-no { grid-column: 1; font-size: 15px; }
  #viewOrders .order-table td.o-no { min-width: 0; }
  #viewOrders .order-table td.o-no small { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-subtle); font-family: var(--font-sans, inherit); font-weight: 400; }
  #viewOrders .order-table td.o-net { grid-column: 2; grid-row: 1; text-align: right; font-weight: 700; font-size: 15px; white-space: nowrap; }
  #viewOrders .order-table td.o-cust { grid-column: 1; font-size: 14px; }
  #viewOrders .order-table td.o-cust .o-name { font-weight: 600; }
  #viewOrders .order-table td.o-cust .cust-social, #viewOrders .order-table td.o-cust .people-line, #viewOrders .order-table td.o-cust .tag-row { display: none; }
  #viewOrders .order-table td.o-cust .cust-phone { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; font-size: 13px; }
  #viewOrders .order-table td.o-page { grid-column: 2; align-self: start; text-align: right; }
  #viewOrders .order-table td.o-pay, #viewOrders .order-table td.o-work { font-size: 13px; }
  #viewOrders .order-table td.o-pay { grid-column: 1; }
  #viewOrders .order-table td.o-work { grid-column: 2; text-align: right; }
  #viewOrders .order-table td.o-pay small, #viewOrders .order-table td.o-pay .doc-chip, #viewOrders .order-table td.o-pay .tax-chip, #viewOrders .order-table td.o-work small, #viewOrders .order-table td.o-work .stage-dots { display: none; }
  #viewOrders .order-table td.o-pay .owe-amt { display: inline; font-size: 13px; margin-left: 4px; }
  #viewOrders .order-table td.o-ship, #viewOrders .order-table td.o-type, #viewOrders .order-table td.o-edit, #viewOrders .order-table td.row-del { display: none; }
}
/* v33.104: คอม — แผงเรียงลำดับที่ปิดอยู่ไม่ดันหน้าให้ล้น · ตารางออร์เดอร์ไม่โดนตัดคอลัมน์สถานะ */
.sortbox:not([open]) > .sortbox-pop { display: none; }
@media (min-width: 1100px) { #viewOrders .sortbox-pop { left: auto; right: 0; } }
@media (min-width: 761px) and (max-width: 1499px) {
  #viewOrders .order-table th:has(> .th-sort[data-of="type"]), #viewOrders .order-table td.o-type { display: none; }
  #viewOrders .order-table td.o-pay { max-width: 200px; }
}
@media (min-width: 761px) { #viewOrders .order-table td.o-edit, #viewOrders .order-table td.row-del { width: 1%; padding-left: 4px; padding-right: 4px; } #viewOrders .order-table td.row-del { padding-left: 30px; } }   /* ยกเลิกห่างแก้ไข (กันกดพลาด) */
/* v33.104: ตำแหน่งและสิทธิ — คอมเห็นตารางเต็ม · มือถือเห็นสรุป + ปุ่มกำหนดสิทธิ */
.pos-short { color: var(--ink-muted); }
.role-sum small { display: block; }
.role-tabs { color: var(--ink-subtle); margin-top: 2px; }
@media (min-width: 761px) { .order-table .role-sum { display: none; } }
@media (max-width: 760px) {
  #rolesBody td.perm-td { display: none; }
  #rolesBody td.role-sum { grid-column: 1 / -1; font-size: 14px; }
  #rolesBody td.role-sum::before { content: none; }
}
/* v33.104 (รอบ 2): Dashboard ช่วงเวลา = ตัวเลือกเดียวบนมือถือ */
.dash-range-wrap { display: none; }
@media (max-width: 760px) {
  #dashRange { display: none; }
  .dash-range-wrap { display: grid; gap: 4px; }
  .dash-range-wrap select { min-height: 44px; font-size: 16px; }
  #dashTabs, #dashMode { width: 100%; display: flex; }
  #dashTabs button, #dashMode button { flex: 1 1 0; }
}
/* ตั้งค่าระบบ: ขั้นสูง (ปิดไว้ก่อน) */
.set-adv { margin-top: 18px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--r-md, 12px); background: var(--surface-sunk, #f3f5f7); }
.set-adv[open] { background: transparent; }
.set-adv > summary { font-size: 15px; }
/* ผู้ติดต่อ: การ์ดมือถือ = ชื่อก่อน · โทรได้ · ยอดค้างเด่น */
@media (min-width: 761px) { .c-unit { display: none; } }
@media (max-width: 760px) {
  #ctBody tr { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 12px 14px; }
  #ctBody td::before { content: none; }
  #ctBody td.c-name { order: -2; grid-column: 1; font-size: 15px; }
  #ctBody td.c-name .c-nm { font-weight: 700; }
  #ctBody td.c-name .c-social { display: none; }
  #ctBody td.c-bal { order: -1; grid-column: 2; text-align: right; font-weight: 700; white-space: nowrap; }
  #ctBody td.c-bal.c-zero { visibility: hidden; }
  #ctBody td.c-phone { grid-column: 1; font-size: 15px; font-family: inherit; }
  #ctBody td.c-phone .tel-link { display: inline-flex; align-items: center; min-height: 32px; }
  #ctBody td.c-orders { grid-column: 2; text-align: right; color: var(--ink-muted); font-size: 13px; }
  #ctBody td.c-prov { grid-column: 1; color: var(--ink-muted); font-size: 13px; }
  #ctBody td.c-total { grid-column: 2; text-align: right; color: var(--ink-muted); font-size: 13px; }
  #ctBody td.c-id, #ctBody td.c-last { display: none; }
  body.show-codes #ctBody td.c-id { display: block; grid-column: 1 / -1; font-size: 12px; color: var(--ink-subtle); order: 9; }
  /* สินค้า: ชื่อก่อนรหัส */
  #pcBody tr, #prodBody tr.prod-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
  #pcBody td.p-name, #prodBody td.p-name { order: -2; grid-column: 1 / -1; font-size: 15px; }
  #pcBody td.p-name::before, #prodBody td.p-name::before { content: none; }
  #pcBody td.p-code, #prodBody td.p-code { grid-column: 1; font-size: 12px; color: var(--ink-subtle); }
  #pcBody td.p-price, #prodBody td.p-price { font-weight: 700; }
}
/* v33.104: เช่าบ่อ — สถานะ 8 ปุ่มเป็นแถวเดียวเลื่อนข้าง (มือถือ) */
@media (max-width: 760px) { .rent-filter { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; } .rent-filter button { flex: 0 0 auto; } }
/* v33.104: มือถือ — ป้ายสถานะ / ช่องเลือก / ลิงก์โทร อ่าน-แตะง่ายขึ้น */
@media (max-width: 760px) {
  .main-content .badge, .main-content .page-chip { font-size: 12.5px; }
  #ordersPerPage { font-size: 16px; }
  #viewOrders .row-sel { width: 22px; height: 22px; }
  #viewOrders .tel-link { display: inline-block; padding: 8px 0; }
}

/* v33.105: หัวหมวดเมนูภาษาไทย — ไม่เว้นระยะตัวอักษร (สระ / วรรณยุกต์ไม่ลอย) · ชื่อเมนูยาวไม่ตัด 2 บรรทัด */
@media (min-width:1151px){.nav .nav-item .nav-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}
@media (min-width:761px) and (max-width:1150px){.nav-group-label{font-size:0;padding:6px 0 0;margin-top:6px}.nav-group-label.nav-first{padding-top:0}}   /* แถบข้างแบบย่อ (92px): เหลือเส้นคั่นหมวด ไม่ใส่ชื่อหมวด */
/* v33.109: สินค้าเดี่ยว / สินค้าเซต / แยกสินค้าแบบกลุ่มเดิม */
.badge.info { background: var(--info-bg); color: var(--info-ink); }
.pc-split { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 4px 0 10px; padding: 12px 14px; border: 1px solid var(--warn-line); border-radius: var(--r-md, 10px); background: var(--warn-bg); }
.pc-split p { margin: 2px 0 0; } .pc-split .btn { flex: 0 0 auto; }
.pd-sell { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.pd-flags.pd-flags { margin: 10px 0 6px; gap: 6px 16px; } .pd-flags .set-chk { font-size: var(--fs-13, 13px); }
.pd-set-on { font-weight: 600; } .pd-set-box { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md, 10px); background: var(--surface-sunk, #f6f7f5); }
.pd-set .pd-set-qty { width: 6em; text-align: right; } .pd-set td { vertical-align: middle; }
.pd-set-sum { margin: 10px 0 4px; font-size: var(--fs-14, 14px); }
.pd-split-note { padding: 12px 14px; border-radius: var(--r-md, 10px); background: var(--info-bg); color: var(--ink); margin-bottom: 12px; } .pd-split-note ul { margin: 6px 0 0; padding-left: 20px; }
.pd-split-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; max-height: min(460px, 52vh); overflow: auto; }
.pd-split-g { border: 1px solid var(--line); border-radius: var(--r-md, 10px); padding: 8px 12px; } .pd-split-g p { margin: 0 0 4px; } .pd-split-g ul { margin: 0; padding-left: 18px; font-size: var(--fs-13, 13px); }
@media (max-width: 760px) { #pdSetQ, .pd-set-qty, #pdPrice, #pdUnit, #pdWeight, #pdName { font-size: 16px; } }

/* v33.110 (🟠6): จุดสถานะงาน — หัวคอลัมน์บอกลำดับขั้น · ชี้ / โฟกัสที่จุด = ป้ายชื่อขั้นขึ้นทันที */
.order-table th .th-sub { display: block; font-size: var(--fs-11, 11px); font-weight: var(--fw-regular, 400); color: var(--ink-subtle); white-space: nowrap; margin-top: 2px; }
.stage-dots .sdot:hover::after, .stage-dots .sdot:focus-visible::after { content: attr(data-short); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink, #1f2937); color: #fff; font-size: 11px; line-height: 1.4; padding: 2px 6px; border-radius: 4px; white-space: nowrap; z-index: 5; pointer-events: none; }
#printStatus.print-status-error { color: var(--danger-ink); font-weight: var(--fw-semibold); }   /* v33.110 (🟠7): ไม่พบออร์เดอร์ = สีแดง */
.shape-ref img.zoomable { cursor: zoom-in; }
.img-zoom { width: min(1000px, 96vw); max-width: 96vw; }   /* v33.110 (🟢5) */
.ship-free-btn { display: inline-flex; margin: 6px 0 0 8px; }   /* v33.110 (🟢7) */
/* v33.110 (🟢8): เมนูไม่มีแถบเลื่อนแนวนอน (ชื่อเมนูยาว = ตัดบรรทัด) */
.app-sidebar, .app-sidebar .nav, #menuGrid { overflow-x: hidden; }
.app-sidebar .nav a, .app-sidebar .nav button { min-width: 0; overflow-wrap: anywhere; }
.sw-row .cod-note { display: block; margin-top: 4px; color: var(--ink); font-weight: var(--fw-medium); }   /* v33.110 (🟢9) */
.sw-row .cod-note:empty { display: none; }

/* v33.121: คิวส่งเบื้องหลัง (Outbox) — ปุ่มลอยมุมจอ */
.ob-pill{position:fixed;right:18px;bottom:18px;z-index:60;display:inline-flex;align-items:center;gap:8px;padding:9px 14px;border-radius:999px;border:1px solid #d8e0e8;background:#fff;color:#143551;font:600 13px/1.2 inherit;box-shadow:0 6px 20px rgba(15,30,44,.14);cursor:pointer}
.ob-pill.hidden{display:none}
.ob-pill.warn{background:#fff4ed;border-color:#f6c3a3;color:#9a3b06}
.ob-pill.off{background:#f3f5f7;color:#434c53}
.ob-dot{width:9px;height:9px;border-radius:50%;background:#2e8b57;flex:none}
.ob-pill.warn .ob-dot{background:#fe730d}.ob-pill.off .ob-dot{background:#8a96a3}
.ob-dot.spin{background:transparent;border:2px solid #c7d2dc;border-top-color:#143551;animation:obspin .8s linear infinite;width:11px;height:11px}
@keyframes obspin{to{transform:rotate(360deg)}}
.ob-list{list-style:none;margin:0;padding:0;display:grid;gap:8px}
.ob-list li{border:1px solid #e2e8ef;border-radius:12px;padding:10px 12px;display:grid;gap:4px}
.ob-row{display:flex;justify-content:space-between;gap:8px;align-items:center}
.ob-acts{display:flex;gap:6px;margin-top:4px}
@media screen and (max-width:1024px){.ob-pill{bottom:calc(96px + env(safe-area-inset-bottom,0px));right:12px}}
@media print{.ob-pill{display:none!important}}

/* v33.123: ช่องลิงก์ Google Map */
.map-row { display: flex; gap: 8px; align-items: center; } .map-row input { flex: 1; min-width: 0; } .map-row .btn { flex: none; }
#mapLinkInput.invalid { border-color: var(--danger, #b42318); } #mapLinkHint.err { color: var(--danger, #b42318); }
.od-map .od-maplink { font-weight: 600; text-decoration: underline; }
/* v33.124 (COM-3): ค่าคอม ▸ ค่าตั้ง — ช่องเรียงตรง · คำอธิบายใต้ช่อง · หมวดเป็นตาราง / รอบรายเดือน ▸ รายการออร์เดอร์ */
#ccBody .cm-kick { justify-content: space-between; flex-wrap: wrap; row-gap: 6px; }
#ccBody .cm-kick-t { font-size: inherit; color: inherit; font-weight: inherit; }
#ccBody .cm-sum { font-size: var(--fs-11, 11px); }
#ccBody .cm-kick-hint { margin: -6px 0 12px; }
#ccBody .cm-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; margin-bottom: 14px; }
#ccBody .cm-f { margin: 0; min-width: 0; }
#ccBody .cm-f .field-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ccBody .cm-f .cm-f-hint { display: block; margin: 6px 0 0; min-height: 1.5em; }
#ccBody .cm-subhead { margin: 20px 0 10px; }
#ccBody .cm-opt { margin: 0 0 12px; }
#ccBody .cm-opt .inline-check { align-items: flex-start; font-size: var(--fs-13, 13.5px); line-height: 1.5; }
#ccBody .cm-opt .inline-check input { flex: none; margin-top: 2px; }
#ccBody .cm-opt-hint { display: block; margin: 4px 0 0 24px; max-width: 96ch; }
#ccBody .cm-cats-box { margin: 4px 0 0; }
#ccBody .cm-cats-box .field-label { display: block; margin-bottom: 8px; }
#ccBody .cm-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin: 0 0 16px; }
#ccBody .cm-cats > small { display: none; }
#ccBody .cm-cat { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line, #e0e4e8); border-radius: 10px; cursor: pointer; background: var(--surface, #fff); }
#ccBody .cm-cat:hover { border-color: var(--ink-subtle, #9aa3ab); }
#ccBody .cm-cat:has(input:checked) { border-color: var(--brand, #1e384e); background: var(--surface-soft, #f6f8fa); }
#ccBody .cm-cat input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--brand, #1e384e); }
#ccBody .cm-cat-name { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: var(--fs-13, 13px); line-height: 1.35; }
#ccBody .cm-cat-id { flex: none; font-size: var(--fs-11, 11px); color: var(--ink-subtle, #8a939b); font-variant-numeric: tabular-nums; }
#ccBody .cm-cat.is-off { opacity: .6; }
#ccBody .cm-save { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line, #e0e4e8); }
.cm-lists { margin-top: 18px; display: grid; gap: 12px; }
.cm-list { border: 1px solid var(--line, #e0e4e8); border-radius: 12px; padding: 0 14px; background: var(--surface, #fff); }
.cm-list > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 12px 0; cursor: pointer; list-style: none; }
.cm-list > summary::-webkit-details-marker { display: none; }
.cm-list > summary::before { content: '▸'; color: var(--ink-subtle, #8a939b); transition: transform .15s; }
.cm-list[open] > summary::before { transform: rotate(90deg); }
.cm-list-t { font-weight: 700; font-size: var(--fs-14, 14px); }
.cm-list-n { font-size: var(--fs-12, 12px); color: var(--ink-muted, #5b646b); }
.cm-list[open] > summary { border-bottom: 1px solid var(--line, #e0e4e8); margin-bottom: 10px; }
.cm-list > .table-wrap, .cm-list > .micro-hint { margin-bottom: 12px; }
.cm-ords td.nowrap, .cm-ords th:first-child { white-space: nowrap; }
.cm-ords .cm-due { color: var(--warn-ink, #8a4b00); }
.cm-ords .badge-dealer { margin-left: 6px; }
#cmMineBody .cm-list { margin: 14px 0; }
@media (max-width: 760px) { .cm-ords td.nowrap { white-space: normal; } .cm-ords td[data-label="ลูกค้า"] { grid-column: 1 / -1; } }
@media (max-width: 720px) {
  #ccBody .cm-grid3 { grid-template-columns: 1fr 1fr; }
  #ccBody .cm-cats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 460px) {
  #ccBody .cm-grid3, #ccBody .cm-cats { grid-template-columns: 1fr; }
}
/* v33.125: รหัสสินค้าอัตโนมัติตามหมวด */
.pd-code-auto { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-height: 44px; padding: 8px 12px; border: 1px dashed var(--line, #d6dbe0); border-radius: 10px; background: var(--surface-soft, #f6f8fa); }
.pd-code-auto b { font-size: var(--fs-16, 16px); letter-spacing: .02em; }
.pd-code-auto select { width: auto; min-width: 0; max-width: 100%; }
.pd-code-man { font-size: var(--fs-12, 12px); margin-left: auto; }
label.field > .pd-code-man { display: inline-block; margin: 6px 0 0; }
.pd-pfx { margin-left: 6px; }
/* v33.125 (COM-4): ช่วงวันที่ค่าคอม */
.cm-range-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; }
.cm-range-bar .cm-rf { margin: 0; min-width: 0; }
.cm-range-bar input[type=date] { min-height: 42px; }
.cm-range-bar .cm-range-pre { min-width: 150px; }
.cm-range-bar .cm-range-runs { min-width: 200px; max-width: 320px; }
#commRun .cr-bar { flex-wrap: wrap; align-items: flex-end; gap: 10px; }
@media (max-width: 760px) {
  .cm-range-bar { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .cm-range-bar .cm-rf:first-child, .cm-range-bar .cm-rf:last-child:nth-child(4) { grid-column: 1 / -1; }
  .cm-range-bar input[type=date] { font-size: 16px; }
  .cm-range-bar .cm-range-runs { max-width: none; }
}
/* v33.126: ตารางหมวดหมู่พอดีจอ (iPad ไม่ล้นขวา · ชื่อหมวดไม่ตัดกลางคำ) */
.cat-table .cat-ord-btns { display: flex; gap: 4px; flex-wrap: nowrap; }
.cat-table .cat-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cat-table .cat-cell .cat-thumb { margin-right: 0; flex: none; }
.cat-table .cat-cell-t { min-width: 0; }
.cat-table .cat-cell-t b { display: block; line-height: 1.35; }
.cat-table .cat-cell-m { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 2px; }
.cat-table .cat-cell-m .micro-hint { margin: 0; }
.cat-table .cat-cell-m .pd-pfx { margin-left: 0; }
.cat-table td[data-label="หมวด"] { min-width: 210px; }
.cat-table .cat-fml small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.45; }
@media (min-width: 761px) and (max-width: 1150px) {
  .cat-table { table-layout: auto; min-width: 0; width: 100%; }
  .cat-table th, .cat-table td { padding-left: 8px; padding-right: 8px; }
  .cat-table td[data-label="หมวด"] { min-width: 190px; }
  .cat-table td.cat-fml { min-width: 160px; max-width: 220px; }
  .cat-table td[data-label="ฟอร์ม"] { min-width: 96px; }
}

/* ============================================================ v33.130 · KIT-2 (mp-kit.js): ช่องเงิน · Multi-select · ค้นหา · ออฟไลน์ · ปุ่มตอบกลับ · Selected · รูปกำลังอัป */
/* ช่องยอดเงิน: ฿ ข้างหน้า + ลูกน้ำอัตโนมัติ */
input.cur-in { padding-left: 30px !important; font-variant-numeric: tabular-nums; background-repeat: no-repeat; background-position: 11px 50%; background-size: 13px 15px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 13 15'%3E%3Ctext x='6.5' y='12.5' text-anchor='middle' font-family='Arial,sans-serif' font-size='13' font-weight='700' fill='%235b6b7a'%3E%E0%B8%BF%3C/text%3E%3C/svg%3E"); }
input.cur-in.cur-pct { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 13 15'%3E%3Ctext x='6.5' y='12.5' text-anchor='middle' font-family='Arial,sans-serif' font-size='12' font-weight='700' fill='%235b6b7a'%3E%25%3C/text%3E%3C/svg%3E"); }
input.cur-in:focus { background-color: var(--surface, #fff); }

/* Multi-select ชิป */
.ms { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 42px; padding: 5px 8px; border: 1.5px solid var(--line-input, #d8ded9); border-radius: 12px; background: var(--surface, #fff); cursor: text; }
.ms.open, .ms:focus-within { border-color: var(--mp-green-700); box-shadow: 0 0 0 3px var(--focus-ring, rgba(31, 110, 80, .18)); }
.ms.ms-dis { opacity: .6; cursor: default; }
.ms-chips { display: contents; }
.ms-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--surface-sel, #e8f3ee); color: var(--mp-green-700); font-size: var(--fs-12, 12px); font-weight: var(--fw-semibold, 600); line-height: 1.3; }
.ms-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-x { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 16px; line-height: 1; cursor: pointer; }
.ms-x:hover, .ms-x:focus-visible { background: rgba(0, 0, 0, .08); }
.ms-input { flex: 1 1 120px; min-width: 90px; border: 0 !important; outline: 0; background: transparent !important; box-shadow: none !important; padding: 4px 2px !important; min-height: 28px !important; font: inherit; }
.ms-count { font-size: var(--fs-11, 11px); color: var(--ink-muted); white-space: nowrap; }
.ms-list { position: absolute; left: -1.5px; right: -1.5px; top: calc(100% + 4px); z-index: 80; max-height: 260px; overflow: auto; margin: 0; padding: 4px; list-style: none; background: var(--surface, #fff); border: 1px solid var(--line, #e3e8ec); border-radius: 12px; box-shadow: var(--shadow-pop, 0 10px 30px rgba(15, 30, 44, .16)); }
.ms-opt { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 0 6px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.ms-opt small { grid-column: 2; color: var(--ink-muted); font-size: var(--fs-11, 11px); }
.ms-opt.act, .ms-opt:hover { background: var(--surface-hover, #f3f6f8); }
.ms-opt.on { color: var(--mp-green-700); font-weight: var(--fw-semibold, 600); }
.ms-opt.dis { opacity: .45; }
.ms-check { display: inline-grid; place-items: center; width: 18px; height: 18px; border: 1.5px solid var(--line-input, #cfd8de); border-radius: 5px; font-size: 12px; color: #fff; }
.ms-opt.on .ms-check { background: var(--mp-green-700); border-color: var(--mp-green-700); }
.ms-empty { padding: 10px; color: var(--ink-muted); font-size: var(--fs-12, 12px); }
.of-picked { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 2px 8px; }
.of-picked:empty { display: none; }

/* ช่องค้นหา: จำนวนที่เจอ · ไฮไลต์ · คำแนะนำ */
.sr-badge { transform: translate(-100%, -50%); z-index: 1000; pointer-events: none; padding: 2px 8px; border-radius: 999px; background: var(--surface-sel, #e8f3ee); color: var(--mp-green-700); font-size: 11px; font-weight: 700; line-height: 1.5; white-space: nowrap; }
.sr-badge.none { background: var(--warn-bg, #fff4e5); color: var(--warn-ink, #8a4b00); }
.sr-sug { z-index: 1000; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: min(92vw, 520px); padding: 8px 10px; border-radius: 10px; background: var(--surface, #fff); border: 1px solid var(--warn-line, #f1d3a5); box-shadow: var(--shadow-pop, 0 10px 30px rgba(15, 30, 44, .16)); font-size: var(--fs-12, 12px); color: var(--ink); }
.sr-sug[hidden] { display: none; }
.sr-sug-btn { border: 1px solid var(--mp-green-700); background: var(--surface, #fff); color: var(--mp-green-700); border-radius: 999px; padding: 3px 10px; font: inherit; font-weight: 700; cursor: pointer; }
.sr-sug-btn:hover, .sr-sug-btn:focus-visible { background: var(--surface-sel, #e8f3ee); }
mark.sr-mark { background: #ffe58a; color: inherit; border-radius: 3px; padding: 0 1px; box-shadow: 0 0 0 1px rgba(214, 160, 0, .25); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ออฟไลน์ */
.net-bar { position: fixed; z-index: 2147483600; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; max-width: min(94vw, 720px); padding: 9px 16px; border-radius: 999px; font-size: var(--fs-12, 12px); font-weight: 600; box-shadow: var(--shadow-toast, 0 8px 24px rgba(0, 0, 0, .18)); transition: opacity .2s; }
.net-bar.hidden { display: none; }
.net-bar.down { background: #2b2f33; color: #fff; }
.net-bar.up { background: var(--ok-bg, #e7f6ee); color: var(--ok-ink, #136c3d); border: 1px solid var(--ok-line, #b6e2c8); }
.net-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: #ff6b5b; box-shadow: 0 0 0 4px rgba(255, 107, 91, .25); }
.net-bar.up .net-dot { background: #22a565; box-shadow: 0 0 0 4px rgba(34, 165, 101, .2); }

/* ปุ่มที่กด: กำลังทำ → เสร็จ + แถบความคืบหน้า */
.mp-prog { position: fixed; z-index: 2147483500; top: 0; left: 0; right: 0; height: 3px; pointer-events: none; opacity: 0; transition: opacity .2s; overflow: hidden; }
.mp-prog.on { opacity: 1; }
.mp-prog i { position: absolute; top: 0; bottom: 0; width: 35%; background: linear-gradient(90deg, transparent, var(--mp-mint-500, #2fb37c), transparent); animation: mpProg 1.1s ease-in-out infinite; }
@keyframes mpProg { from { left: -35%; } to { left: 100%; } }
.fb-busy { cursor: progress !important; }
.fb-dot { z-index: 70; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; pointer-events: none; font: 800 11px/1 Arial, sans-serif; color: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.fb-dot.busy { background: #fff; border: 2.5px solid var(--surface-sel, #dbeee5); border-top-color: var(--mp-green-700, #1f6e50); animation: fbSpin .7s linear infinite; box-sizing: border-box; }
.fb-dot.ok { background: #22a565; animation: fbPop .25s ease-out; }
.fb-dot.err { background: var(--danger, #d64545); animation: fbPop .25s ease-out; }
@keyframes fbSpin { to { transform: rotate(360deg); } }
@keyframes fbPop { from { transform: scale(.4); } to { transform: scale(1); } }
.fb-err:not(.nav-item) { animation: fbShake .32s ease-in-out; }
@keyframes fbShake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

/* Selected state */
:is(button, .btn, [role=button], .chip, .tab-chip, .owner-chip, .ofilter-btn, .type-opt, .nav-item):active:not(:disabled) { transform: scale(.97); }
:is(button, a, input, select, textarea, [tabindex]):focus-visible { outline: 3px solid var(--focus-ring, rgba(31, 110, 80, .35)); outline-offset: 2px; }
tbody > tr.is-picked > td { background: var(--surface-sel, #e8f3ee) !important; }
tbody > tr.is-picked > td:first-child { box-shadow: inset 3px 0 0 var(--mp-green-700); }
:is(.slip-card, .debt-card, .lead-card, .kb-card, article.card).is-picked { outline: 2px solid var(--mp-green-700); outline-offset: 1px; }
:is(.chip, .tab-chip, .seg button, .tabs-line button, .ofilter-opt):is([aria-pressed=true], [aria-selected=true], .on) { box-shadow: inset 0 0 0 1.5px var(--mp-green-700); }
.ofilter-opt:has(input:checked) { background: var(--surface-sel, #e8f3ee); color: var(--mp-green-700); font-weight: var(--fw-semibold, 600); border-radius: 8px; }
label:has(> input[type=checkbox]:checked):is(.inline-check, .set-chk) { color: var(--mp-green-700); font-weight: var(--fw-semibold, 600); }
label:has(> input[type=radio]:checked) { color: var(--mp-green-700); }

/* รูปกำลังอัปโหลด (Thumbnail overlay) */
.ut { position: relative; display: inline-block; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--surface-sunk, #eef2f4); flex: none; vertical-align: top; }
.ut > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ut-file { display: grid; place-items: center; height: 100%; font-size: 10px; color: var(--ink-muted); padding: 4px; text-align: center; word-break: break-all; }
.ut-shade { position: absolute; inset: 0; background: rgba(10, 20, 30, .55); transition: opacity .25s; }
.ut-ring { position: absolute; left: 50%; top: 44%; width: 34px; height: 34px; transform: translate(-50%, -50%); }
.ut-ring svg { width: 100%; height: 100%; }
.ut-track { fill: none; stroke: rgba(255, 255, 255, .3); stroke-width: 3.5; }
.ut-arc { fill: none; stroke: #fff; stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 30 100; transform-origin: 50% 50%; animation: fbSpin .9s linear infinite; }
.ut-ic { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font: 800 16px/1 Arial, sans-serif; }
.ut-cap { position: absolute; left: 0; right: 0; bottom: 3px; text-align: center; color: #fff; font-size: 9.5px; font-weight: 700; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.ut-wait .ut-arc { animation-duration: 2.4s; stroke-dasharray: 8 100; }
.ut-ok .ut-shade { opacity: .25; } .ut-ok .ut-arc, .ut-ok .ut-track { display: none; }
.ut-ok .ut-ic { width: 26px; height: 26px; inset: auto; left: 50%; top: 44%; transform: translate(-50%, -50%); border-radius: 50%; background: #22a565; font-size: 13px; }
.ut-err .ut-shade { background: rgba(120, 20, 20, .55); } .ut-err .ut-arc { display: none; }
.ut-err .ut-ic { width: 26px; height: 26px; inset: auto; left: 50%; top: 40%; transform: translate(-50%, -50%); border-radius: 50%; background: var(--danger, #d64545); }
.ut-retry { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); border: 0; border-radius: 999px; padding: 2px 8px; background: #fff; color: var(--danger-ink, #a12626); font: 700 10px/1.4 inherit; cursor: pointer; }
.ut-err .ut-cap { display: none; }
.ut-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }

@media (prefers-reduced-motion: reduce) { .ut-arc, .fb-dot.busy, .mp-prog i { animation-duration: 3s; } .fb-err { animation: none; } }
.tag-row .ms { flex: 1 1 260px; min-width: 220px; }
.tag-pick .ms { margin-top: 6px; }
.cm-ex-chips { margin: 6px 0 8px; }
.ut-idle .ut-shade, .ut-idle .ut-ring, .ut-idle .ut-cap { display: none; }
/* v33.130: กล่องรอส่งขึ้นระบบ (หน้ารายการ) + สถานะรายแถว */
.ob-new { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--line, #e3e8ec); border-radius: 16px; background: var(--surface-soft, #f7f9fa); display: grid; gap: 10px; }
.ob-new-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.ob-new-head small { color: var(--ink-muted); font-size: var(--fs-11, 11px); }
.ob-new-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: var(--surface, #fff); border: 1px solid var(--line-soft, #edf1f3); }
.ob-new-row.st-err { border-color: var(--danger-line, #f3c1c1); background: var(--danger-bg, #fdf1f1); }
.ob-new-row.st-ok { border-color: var(--ok-line, #b6e2c8); }
.ob-new-row .ut-row { margin: 0; }
.ob-new-row .ut { width: 54px; height: 54px; }
.ob-new-main { display: grid; gap: 2px; min-width: 0; }
.ob-new-main small { color: var(--ink-muted); font-size: var(--fs-11, 11px); }
.ob-new-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.ob-st { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12, 12px); font-weight: 600; color: var(--info-ink, #1f5d8a); }
.ob-st.err { color: var(--danger-ink, #a12626); } .ob-st.ok { color: var(--ok-ink, #136c3d); } .ob-st.wait { color: var(--warn-ink, #8a4b00); }
.bg-spin { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: fbSpin .8s linear infinite; vertical-align: -1px; }
.bg-wait { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-muted); font-size: 16px; }
.bg-wait.err { color: var(--danger-ink, #a12626); }
.bg-status { margin: 8px 0 0; font-size: var(--fs-12, 12px); font-weight: 600; color: var(--info-ink, #1f5d8a); }
.bg-status.err { color: var(--danger-ink, #a12626); } .bg-status.ok { color: var(--ok-ink, #136c3d); } .bg-status.wait { color: var(--warn-ink, #8a4b00); }
.row-ob { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; white-space: nowrap; background: var(--info-bg, #eaf3fb); color: var(--info-ink, #1f5d8a); }
.row-ob.wait { background: var(--warn-bg, #fff4e5); color: var(--warn-ink, #8a4b00); }
.row-ob.err { background: var(--danger-bg, #fdecea); color: var(--danger-ink, #a12626); }
.row-ob .bg-spin { width: 9px; height: 9px; border-width: 1.5px; }
.row-ob-retry { border: 0; border-radius: 999px; padding: 0 7px; margin-left: 4px; background: #fff; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; }
tr.row-failed > td { background: var(--danger-bg, #fdf1f1); }
@media (max-width: 640px) { .ob-new-row { grid-template-columns: auto 1fr; } .ob-new-acts { grid-column: 1 / -1; justify-content: flex-start; } }
/* v33.130: Coach mark (mp-tour.js) */
.tour-block { position: fixed; inset: 0; z-index: 2147483300; background: transparent; }
.tour-spot { position: fixed; z-index: 2147483301; border-radius: 12px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(12, 22, 32, .55), 0 0 0 3px var(--mp-mint-500, #2fb37c); transition: left .2s, top .2s, width .2s, height .2s; }
.tour-tip { position: fixed; z-index: 2147483302; padding: 14px 16px 12px; border-radius: 14px; background: var(--surface, #fff); color: var(--ink); box-shadow: 0 18px 50px rgba(0, 0, 0, .3); outline: none; }
.tour-tip h3 { margin: 2px 0 6px; font-size: var(--fs-16, 16px); color: var(--ink-heading); }
.tour-n { margin: 0; font-size: var(--fs-11, 11px); color: var(--mp-mint-700, #1c7a55); font-weight: 700; }
.tour-txt { margin: 0 0 12px; font-size: var(--fs-13, 13px); line-height: 1.55; color: var(--ink-label, #3d4b57); }
.tour-acts { display: flex; align-items: center; gap: 6px; }
.tour-gap { flex: 1; }
.tour-arrow { position: absolute; top: -7px; width: 14px; height: 14px; margin-left: -7px; background: var(--surface, #fff); transform: rotate(45deg); border-radius: 2px; }
.tour-tip.up .tour-arrow { top: auto; bottom: -7px; }
@media (prefers-reduced-motion: reduce) { .tour-spot { transition: none; } }
#successDialog.bg-pending .success-mark, #successDialog.bg-failed .success-mark { position: relative; color: transparent; }
#successDialog.bg-pending .success-mark > *, #successDialog.bg-failed .success-mark > * { visibility: hidden; }
#successDialog.bg-pending .success-mark::after { content: ''; position: absolute; inset: 14px; border-radius: 50%; border: 3px solid var(--surface-sel, #dbeee5); border-top-color: var(--mp-green-700); animation: fbSpin .8s linear infinite; }
#successDialog.bg-failed .success-mark { background: var(--danger-bg, #fdecea); }
#successDialog.bg-failed .success-mark::after { content: '!'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--danger-ink, #a12626); font: 800 24px/1 Arial, sans-serif; }
.ut-retry[hidden], .tour-prev[hidden] { display: none !important; }
.ob-new-row .ut-retry { display: none !important; }
