/* Manutham Order Management — v33.111 หน้าตาแนว Fastwork (ผู้ใช้ 17 พ.ย. 2569)
 * "ขอ Design เหมือน Fastwork.com แต่ Brand CI ยังเป็นของ Manutham และการทำงานของระบบทั้งหมดยังเหมือนเดิม"
 * ไฟล์นี้เปลี่ยนเฉพาะหน้าตาบนจอ (@media screen) — ไม่แตะใบงาน / ใบจ่าหน้า ตอนพิมพ์ (print.css) · ไม่เปลี่ยนลำดับขั้น ปุ่ม หรือข้อมูล
 * ลบไฟล์นี้ออกจาก index.html = กลับเป็นหน้าตาเดิมทันที
 * สี CI: กรมท่า #143551 (ปุ่มหลัก) · ดำ #0F1E2C (แถบลอย) · ส้ม #FE730D (จุดเน้น) · ฟ้าหม่น #B8C8D7 · พื้น #EEF2F6
 */
@media screen {
  :root {
    --font: 'IBM Plex Sans Thai', 'Sarabun', 'Noto Sans Thai', 'Tahoma', sans-serif;
    --bg: #eef2f6;
    --ink-subtle: #5e6a75;   /* เดิม #8a9197 (3.0 : 1) → 5.5 : 1 */
    --ink-muted: #434c53;
    --line: #e2e8ef;
    --line-soft: #edf2f6;
    --line-input: #dfe7ef;
    --r-md: 12px;
    --r-xl: 20px;
    --r-2xl: 24px;
    --fw-ink: #0f1e2c;
    --fw-chip: #eef2f6;
    --fw-field: #f5f7fa;
  }
  body { background: var(--bg); }
  h1 { font-size: 32px; line-height: 1.3; font-weight: 700; color: var(--fw-ink); letter-spacing: 0; }
  .page-heading .eyebrow { display: none; }

  /* ---------- ปุ่ม · ช่องกรอก · ชิป (ทรงแคปซูล) ---------- */
  .btn { border-radius: 999px; }
  .btn-primary { background: #143551; }
  .btn-ghost { background: var(--fw-chip); border-color: transparent; color: var(--fw-ink); font-size: 14px; }
  .btn-ghost:hover:not(:disabled) { background: #e2e8ef; }
  .btn-soft { background: #e6edf4; border-color: transparent; color: #143551; }
  .btn-sm { min-height: 38px; }
  .sheet-close { border-radius: 999px; }
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]), select, textarea { border-radius: 12px; border-color: var(--line-input); background-color: var(--fw-field); }
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):focus, select:focus, textarea:focus { background-color: #fff; }
  .seg { border-radius: 999px; }
  .seg > button, .seg > label { border-radius: 999px; }
  .badge { border-radius: 999px; font-size: 12.5px; padding: 3px 10px; }
  .of-btn { border-radius: 999px; }

  /* ---------- การ์ด / แผง ---------- */
  .form-pane, .dash-card, .table-wrap, .studio, .type-card { border-color: #e6ecf2; }
  .form-pane, .dash-card, .table-wrap, .studio { border-radius: 20px; }
  .type-card { border-radius: 16px; }
  dialog.sheet { border-radius: 24px; }

  /* ---------- ปุ่มคัดลอก (ใหญ่ขึ้น · กดง่าย) ---------- */
  .btn-copy { width: 32px; height: 32px; border-radius: 999px; background: var(--fw-chip); color: #143551; }
  .btn-copy:hover, .btn-copy:active { background: #dfe7ef; }

  /* ---------- รายการออร์เดอร์: เน้นเลขออร์เดอร์ · ค้างชำระ · ชื่อ Social คัดลอกได้ ---------- */
  .order-table td.o-no { font-size: 16px; font-weight: 700; color: #143551; }
  .order-table td.o-no small { font-weight: 400; }
  .owe-amt { font-size: 18px; }
  .order-table tbody tr.row-owe { background: #fff; box-shadow: none; }
  .order-table tbody tr.row-owe:hover { background: #fbf6f5; }
  .order-table tbody tr.row-owe td { border-bottom-color: var(--line); }
  .order-table td small.cust-social { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
  .o-thumb { display: inline-block; width: 44px; height: 33px; border-radius: 8px; object-fit: cover; vertical-align: middle; margin-right: 8px; }
  .o-thumb.none { box-sizing: border-box; border: 1.5px dashed #b8c8d7; background: var(--fw-field); }

  /* ---------- รายละเอียดออร์เดอร์ ---------- */
  #orderDialog { width: min(900px, calc(100vw - 24px)); }
  #orderDialogTitle { font-size: 24px; color: #143551; }
  #orderDialogBody .form-section { border: 1px solid #e6ecf2; border-radius: 16px; padding: 16px 18px; margin: 0 0 12px; }
  #orderDialogBody .form-section.danger-zone { border-style: dashed; }
  #orderDialogBody .step-btn { border-radius: 999px; }

  /* ---------- หมวดหมู่สินค้า: รูปหมวด (แนบเอง) ---------- */
  .cat-thumb { display: inline-block; width: 48px; height: 36px; border-radius: 8px; object-fit: cover; vertical-align: middle; margin-right: 10px; }
  .cat-thumb.none { box-sizing: border-box; border: 1.5px dashed #b8c8d7; background: var(--fw-field); }
  .cat-img-field { margin: 4px 0 14px; }
  .cat-img-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
  .cat-img-preview { width: 160px; height: 120px; border-radius: 12px; object-fit: cover; }
  .cat-img-preview.none { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; border: 1.5px dashed #b8c8d7; background: var(--fw-field); color: var(--ink-subtle); font-size: 13px; }
  .cat-img-acts { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

  /* ---------- กล่องสรุป: ขาวเรียบ ตัวเลขยังเป็นสีเตือน ---------- */
  .owe-summary { background: #fff; border-color: #e6ecf2; border-radius: 16px; color: var(--fw-ink); }
  .owe-summary b { color: var(--danger-ink); }
  .owe-summary small { color: var(--ink-subtle); opacity: 1; }
  .note.info.dash-excl { background: #f5f7fa; border: 0; border-radius: 16px; }
  .note { border-radius: 14px; }
  .note:not(.info):not(.warn):not(.danger):not(.ok):not(.success) { border-color: #e2e8ef; background: #f5f7fa; }
  .order-table td.o-cust .o-thumb { float: left; width: 44px; height: 44px; margin: 2px 10px 0 0; border-radius: 10px; }
  .order-table td.o-cust { overflow: hidden; }

  /* ---------- หน้าเข้าสู่ระบบ: อีเมล + รหัสผ่าน (เหมือนเดิม) บนฉากการ์ดลอย ---------- */
  .fw-login-stage { display: none; }
  body:has(#pinDialog[open]) .fw-login-stage { display: block; position: fixed; inset: 0; z-index: 9000; background: var(--bg); overflow: hidden; }
  #pinDialog::backdrop { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
  #pinDialog { margin-top: max(250px, 31vh); border-radius: 18px; box-shadow: 0 10px 34px rgba(15, 30, 44, .12); }
  #pinDialog .pin-logo { display: none; }
  #pinDialog .sheet-head h2 { font-size: 20px; }
  #pinDialog .sheet-foot .btn { width: 100%; min-height: 50px; font-size: 16px; }
  .pw-wrap { position: relative; display: block; }
  .pw-wrap input { width: 100%; padding-right: 52px !important; box-sizing: border-box; }
  .pw-eye { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 46px; height: 44px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-muted); display: inline-grid; place-items: center; cursor: pointer; }
  .pw-eye[aria-pressed="true"] { color: #143551; }
  .fw-login-logo { position: absolute; top: 28px; left: 50%; transform: translateX(-50%); height: 22px; width: auto; }
  .fw-login-head { position: absolute; top: max(86px, 10vh); left: 16px; right: 16px; text-align: center; display: flex; flex-direction: column; gap: 6px; }
  .fw-login-head b { font-size: 40px; line-height: 1.3; font-weight: 700; color: var(--fw-ink); }
  .fw-login-head span { font-size: 16px; color: var(--ink-muted); }
  .fw-float { position: absolute; width: 230px; margin: 0; padding: 8px 8px 12px; box-sizing: border-box; background: #fff; border-radius: 16px; box-shadow: 0 12px 32px rgba(15, 30, 44, .14); }
  .fw-float img { display: block; width: 100%; height: 172px; object-fit: cover; border-radius: 10px; }
  .fw-float figcaption { display: flex; align-items: center; gap: 8px; padding: 10px 4px 0; }
  .fw-float figcaption i { width: 28px; height: 28px; flex: none; border-radius: 999px; background: radial-gradient(circle, #143551 0 5px, transparent 5.5px) center / 14px 14px no-repeat, linear-gradient(#fff, #fff) center / 14px 14px no-repeat, #143551; }
  .fw-float figcaption span { display: flex; flex-direction: column; min-width: 0; }
  .fw-float figcaption b { font-size: 14px; color: var(--fw-ink); }
  .fw-float figcaption small { font-size: 13px; color: var(--ink-subtle); }
  .fw-float.f1 { left: 5%; top: 90px; transform: rotate(-7deg); }
  .fw-float.f2 { left: 9%; top: 460px; transform: rotate(5deg); width: 210px; }
  .fw-float.f3 { right: 6%; top: 110px; transform: rotate(6deg); }
  .fw-float.f4 { right: 10%; top: 480px; transform: rotate(-5deg); width: 210px; }
}

/* ======================= v33.112: ตามวิดีโอ Fastwork ชุดที่ 2 (17 พ.ย. 2569) =======================
 * วิดีโอ 1-2 = มือถือ + iPad → แถบเมนูล่างลอยสีขาว (ช่องที่เลือก = แคปซูลขาวนูน ตัวหนา) + ปุ่มเมนูกลมขาวมุมซ้ายบน
 * วิดีโอ 3-4 = คอม → รางไอคอนพื้นเทาอ่อน + แผงขาว · ตัวเลขสถิติแบบการ์ดโปรไฟล์ · ป้ายสถานะสีพาสเทล
 * ทุกปุ่ม / เมนู / ลำดับขั้น ยังเป็นตัวเดิม — เปลี่ยนแค่ตำแหน่งและหน้าตาบนจอ */
@media screen {
  :root { --bg: #f3f5f7; }
  /* ป้ายสถานะ: แคปซูลสีพาสเทล (เหลือง = รอ / เขียว = ครบ / ฟ้า = กำลังทำ) */
  .badge { font-weight: 600; background: #eceff2; color: #3a434b; }
  .badge.ok { background: #2a7a43; color: #fff; }
  .badge.warn { background: #ffe38a; color: #4d3800; }
  .badge.info { background: #dcebff; color: #1d4a85; }
  .line-body .badge.ok, .line-body .badge.warn { background: transparent; }
  /* ตัวเลขสถิติ: ตัวเลขใหญ่อยู่บน ชื่ออยู่ล่าง (แบบการ์ดโปรไฟล์) */
  .dash-kpi { border-color: #e9edf1; border-radius: 18px; gap: 2px; }
  .dash-kpi > b { order: -1; font-size: 26px; font-weight: 700; color: var(--fw-ink); }
  .dash-kpi > span { font-size: 13.5px; color: var(--ink-subtle); }
  /* แท็บ: เส้นใต้สีเข้ม */
  .tabs-line button[aria-selected="true"] { color: var(--fw-ink); border-bottom-color: var(--fw-ink); font-weight: 600; }
}

/* ---------- คอม (≥ 1025): รางไอคอนพื้นเทาอ่อน + แผงขาว ---------- */
@media screen and (min-width: 1025px) {
  :root { --sidebar-w: 240px; }
  .app-sidebar { background: transparent; border-right: 0; padding: 18px 14px 16px; align-items: stretch; overflow-y: auto; scrollbar-width: none; }
  .app-sidebar .nav { overflow: visible; flex: 1 0 auto; gap: 2px; }   /* เดิม: เมนูเป็นกล่องเลื่อนในตัว ซ่อนเมนูท้าย */
  .brand-mark { content: normal; width: 140px; height: auto; max-height: 44px; margin: 10px 12px 40px; object-fit: contain; object-position: left center; }   /* v33.115: เว้นระยะจากโลโก้มากขึ้น (ผู้ใช้: ไม่ต้องชิด Logo มาก) */
  .brand-mark.lg-mark { width: 44px; height: 44px; }
  .nav-caption, .nav-bottom { display: none; }
  /* v33.114: เมนูด้านข้าง = หัวข้อใหญ่ + Dropdown หัวข้อย่อย (กดหัวหมวดเพื่อเปิด / ปิด) · หมวด ระบบ ชิดล่างสุด */
  .nav-item { flex-direction: row; justify-content: flex-start; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px; border-radius: 12px; text-align: left; color: #434c53; }
  .nav-item svg { width: 20px; height: 20px; flex: none; }
  .nav-item .nav-label { font-size: 15px; line-height: 1.3; font-weight: 600; }
  .nav-item .nav-label::after { content: none; }
  .nav-item:hover:not([aria-current="page"]) { background: rgba(255, 255, 255, .75); }
  .nav-item[aria-current="page"] { background: #fff; color: var(--fw-ink); box-shadow: none; }
  .nav-item[aria-current="page"] .nav-label { font-weight: 700; }
  .nav-item[aria-current="page"] svg { stroke-width: 2.4; }
  .nav-item[aria-current="page"]::after { display: none; }
  .nav-group-label { height: auto; width: auto; margin: 6px 4px 0; padding: 0; background: none; border: 0; font-size: 15px; line-height: normal; letter-spacing: 0; text-transform: none; overflow: visible; }
  .nav-group-label::before { content: none; }
  .nav-grp-btn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 12px; background: none; color: var(--fw-ink); font: inherit; font-size: 15px; font-weight: 700; text-align: left; cursor: pointer; }
  .nav-grp-btn:hover { background: rgba(255, 255, 255, .75); }
  .nav-grp-btn:focus-visible { outline: 2px solid #143551; outline-offset: 2px; }
  .nav-grp-btn .ic { width: 20px; height: 20px; flex: none; }
  .nav-grp-name { flex: 1; min-width: 0; }
  .nav-grp-caret { display: inline-grid; color: var(--ink-subtle); }
  .nav-grp-caret .ic { width: 16px; height: 16px; transition: transform .2s ease; }
  .nav-group-label.open .nav-grp-caret .ic { transform: rotate(180deg); }
  .nav-group-label.has-cur:not(.open) .nav-grp-btn { background: #fff; }
  .nav-item[data-grp] { position: relative; min-height: 40px; padding: 7px 12px 7px 44px; }
  .nav-item[data-grp] svg { display: none; }
  .nav-item[data-grp] .nav-label { font-size: 14.5px; font-weight: 500; }
  .nav-item[data-grp]::before { content: ''; position: absolute; left: 21px; top: 4px; bottom: 4px; width: 2px; border-radius: 2px; background: #dde3e9; }
  .nav-item[data-grp][aria-current="page"]::before { background: #fe730d; }
  .nav-item.grp-closed { display: none; }
  .nav-group-label.nav-grp-sys { margin-top: auto; padding-top: 8px; border-top: 1px solid #dde3e9; }
  .app-main { margin: 6px 6px 6px var(--sidebar-w); background: #fff; border-radius: 24px; min-height: calc(100vh - 12px); box-shadow: none; }
  .topbar { background: transparent; border-bottom: 1px solid var(--line-soft); border-radius: 24px 24px 0 0; height: 60px; padding: 0 28px; }
  .main-content { padding: 28px 36px 48px; }
}
@media screen and (min-width: 1025px) and (max-width: 1100px) { .fw-float { display: none; } }

/* ---------- มือถือ + iPad (≤ 1024): แถบเมนูล่างลอยสีขาว + ปุ่มเมนูกลมมุมซ้ายบน ---------- */
@media screen and (max-width: 1024px) {
  .app-sidebar { background: transparent; border-top: 0; backdrop-filter: none; -webkit-backdrop-filter: none; pointer-events: none; }
  .app-sidebar .nav { pointer-events: auto; height: 64px; width: 100%; max-width: 560px; flex: none; margin: 0 auto; padding: 5px; box-sizing: border-box; overflow: visible;
    background: #fcfcfd; border: 1px solid #e3e7ec; border-radius: 999px; box-shadow: 0 8px 28px rgba(15, 30, 44, .12); }
  .nav-item { color: #5e6a75; border-radius: 999px; gap: 2px; min-height: 0; height: 100%; padding: 4px 2px; }
  .nav-item svg { width: 22px; height: 22px; }
  .nav-item .nav-label::after { font-size: 12.5px; font-weight: 500; }
  .nav-item[aria-current="page"] { background: #fff; color: var(--fw-ink); box-shadow: 0 2px 8px rgba(15, 30, 44, .12); }
  .nav-item[aria-current="page"] svg { background: transparent; padding: 0; width: 22px; height: 22px; stroke-width: 2.4; }
  .nav-item[aria-current="page"] .nav-label::after { font-weight: 700; }
  /* v33.113: ปุ่ม "เมนูทั้งหมด" (ขีด 3) อยู่ท้ายแถบเมนูกลาง ขวาสุด — ปุ่มกลมขาว */
  .nav .nav-item.nav-more { flex: 0 0 52px; width: 52px; height: 52px; align-self: center; padding: 0; margin-left: 4px; border-radius: 999px; background: #fff; color: var(--fw-ink); box-shadow: 0 1px 6px rgba(15, 30, 44, .14); }
  .nav .nav-item.nav-more .nav-label { display: none; }
  .nav .nav-item.nav-more svg { width: 22px; height: 22px; stroke-width: 2; }
  .nav .nav-item.nav-more[aria-current="page"] { background: var(--fw-ink); color: #fff; }
  .topbar { background: color-mix(in srgb, #fff 92%, transparent); border-bottom: 0; }
  .app-main { background: #fff; }
  body { background: #fff; }
}

/* iPad (761–1024): ใช้แถบล่างแบบเดียวกับมือถือ — เนื้อหายังเป็นตารางเหมือนคอม */
@media screen and (min-width: 761px) and (max-width: 1024px) {
  :root { --sidebar-w: 0px; --tabbar-h: 84px; }
  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 24px calc(12px + env(safe-area-inset-bottom)); border-right: 0; z-index: 60; display: flex; flex-direction: column; justify-content: flex-end; }
  .brand-mark, .nav-caption, .nav-bottom, .nav-group-label { display: none; }
  .nav-item.nav-overflow { display: none; }
  .nav { flex-direction: row; gap: 0; flex: none; }
  .nav > .nav-item { order: var(--tab-order, 50); }
  .nav > .nav-item.nav-more { order: 99; }
  .nav .nav-item.nav-more { display: flex; }
  .nav-item { flex: 1 1 0; min-width: 0; width: auto; flex-direction: column; justify-content: center; text-align: center; }
  .nav-item .nav-label { font-size: 0; }
  .nav-item .nav-label::after { content: attr(data-short); }
  .nav-item[aria-current="page"]::after { display: none; }
  .app-main { margin: 0; border-radius: 0; min-height: 100vh; }
  .topbar { position: sticky; top: 0; z-index: 40; height: calc(56px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); padding-right: 24px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  .topbar-logo { display: block; width: 32px; height: 32px; object-fit: contain; flex: none; }
  .breadcrumb { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .breadcrumb .crumb-root { display: none; }
  .main-content { padding: 24px 28px 40px; }
  .toast { top: calc(14px + env(safe-area-inset-top)); bottom: auto; }   /* v33.126: แก้ข้อความแจ้งยืดสูงเต็มจอ (iPad · มีทั้ง top จาก app.css และ bottom) — อยู่ด้านบนเหมือนจอแคบ ไม่ทับแถบยอดเงิน / เมนูล่าง */
  .create-bar { left: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  #viewCreate { padding-bottom: 96px; }
  html { scroll-padding-bottom: calc(var(--tabbar-h) + 84px); }
  .calc-only { --tabbar-h: 0px; }
  .fw-float { display: none; }
}

/* ---------- มือถือ (≤ 760): การ์ดออร์เดอร์ ---------- */
@media screen and (max-width: 760px) {
  :root { --tabbar-h: 78px; }
  .app-sidebar { padding: 0 14px calc(12px + env(safe-area-inset-bottom)); }
  .topbar { height: calc(56px + env(safe-area-inset-top)); }
  h1 { font-size: 28px; }
  .btn-copy { width: 40px; height: 40px; }
  /* การ์ดออร์เดอร์: เลขออร์เดอร์ใหญ่ · ลูกค้า + ชื่อ Social (คัดลอกได้) · ค้างชำระตัวใหญ่ · สถานะงาน */
  #viewOrders .order-table tr { background: #fff; padding: 14px 14px 12px 16px; border: 1px solid #edf0f3; border-radius: 18px; box-shadow: none; gap: 8px 10px; }
  #viewOrders .order-table tr.row-owe { background: #fff; border-color: #edf0f3; box-shadow: none; }
  #viewOrders .order-table td.o-no { grid-column: 1; grid-row: 1; font-size: 19px; }
  #viewOrders .order-table td.o-no small { font-size: 13px; }
  #viewOrders .order-table td.o-page { grid-column: 2; grid-row: 1; }
  #viewOrders .order-table td.o-cust { grid-column: 1 / -1; overflow: hidden; font-size: 15px; }
  #viewOrders .order-table td.o-cust .cust-social { display: flex; font-size: 14px; color: var(--ink-muted); font-weight: 500; }
  #viewOrders .order-table td.o-cust .cust-phone { margin-left: 0; display: inline-flex; }
  #viewOrders .order-table td.o-cust { grid-row: 2; }
  #viewOrders .order-table td.o-pay { grid-column: 1; grid-row: 3; border-top: 1px solid var(--line-soft); padding-top: 8px; }
  #viewOrders .order-table td.o-pay .owe-amt { display: block; font-size: 22px; margin: 2px 0 0; }
  #viewOrders .order-table td.o-net { grid-column: 2; grid-row: 3; align-self: stretch; text-align: right; border-top: 1px solid var(--line-soft); padding-top: 8px; font-size: 13px; font-weight: 400; color: var(--ink-subtle); }
  #viewOrders .order-table td.o-net::before { content: 'ยอดสุทธิ '; display: inline; }
  #viewOrders .order-table td.o-work { grid-column: 1 / -1; grid-row: 4; text-align: left; }
  #viewOrders .order-table td.o-work .stage-dots { display: inline-flex; margin-left: 8px; vertical-align: middle; }
  .fw-float { width: 160px; padding: 6px 6px 9px; }
  .fw-float img { height: 92px; }
  .fw-float figcaption i { display: none; }
  .fw-float figcaption small { display: none; }
  .fw-float.f1 { left: -24px; top: 62px; }
  .fw-float.f3 { right: -28px; top: 78px; }
  .fw-float.f2, .fw-float.f4 { display: none; }
  .fw-login-head { display: none; }
}

/* ======================= v33.113 (17 พ.ย. 2569 17:03) ======================= */
@media screen {
  /* ---------- ตัวกรอง: ปุ่มเดียว "ตัวกรอง" → เลือกหัวข้อ → เลือกค่า · หัวข้อที่เลือกค่าไว้แสดงเป็นชิป ---------- */
  .ofilter-main { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px; border: 1px solid #dfe5eb; border-radius: 999px; background: #fff; color: var(--fw-ink); font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer; }
  .ofilter-main:hover { border-color: #b8c8d7; }
  .ofilter-main.on { border-color: #143551; background: #eef3f8; }
  .ofilter-main .ic { width: 16px; height: 16px; }
  .ofilter-main .ofm-n:not(:empty) { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #143551; color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
  #ordersFilters .ofilter-btn:not(.on) { display: none; }
  #ordersFilters .ofilter-btn.on { border-color: #143551; background: #eef3f8; }
  #ordFilterSheet #ordersFilters .ofilter-main { display: none; }
  #ordFilterSheet #ordersFilters .ofilter-btn:not(.hidden) { display: inline-flex; }
  .ofilter-menu { padding: 10px; }
  .ofm-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
  .ofm-item { display: grid; grid-template-columns: 1fr auto 16px; align-items: center; gap: 10px; min-height: 46px; padding: 8px 10px; border: 0; border-radius: 12px; background: transparent; color: var(--fw-ink); font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
  .ofm-item:hover, .ofm-item:focus-visible { background: #f1f4f7; }
  .ofm-item .ofm-label { font-weight: 600; }
  .ofm-item .ofm-val { color: var(--ink-subtle); font-size: 13.5px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ofm-item.on .ofm-val { color: #143551; font-weight: 600; }
  .ofm-item .ic { width: 14px; height: 14px; transform: rotate(-90deg); color: var(--ink-subtle); }
  .ofilter-back { width: 32px; height: 32px; margin-right: 6px; border: 0; border-radius: 999px; background: #eef2f6; color: var(--fw-ink); font-size: 20px; line-height: 1; cursor: pointer; }
  .ofilter-head { display: flex; align-items: center; }
  .ofilter-head b { flex: 1; }

  /* ---------- ยกเลิกออร์เดอร์: ปัดแถวไปทางซ้าย ---------- */
  #viewOrders .order-table th.th-del { display: none; }
  #viewOrders .order-table tr.can-swipe { position: relative; }
  #viewOrders .order-table tr.can-swipe > td:not(.row-del) { transition: transform .2s ease; }
  #viewOrders .order-table tr.can-swipe.swiping > td:not(.row-del) { transform: translateX(var(--sx, 0)); transition: none; }
  #viewOrders .order-table tr.can-swipe.swiped > td:not(.row-del) { transform: translateX(-128px); }
  #viewOrders .order-table tr.can-swipe > td.row-del { display: flex; position: absolute; top: 0; right: 0; bottom: 0; width: 128px; margin: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; transition: opacity .15s; }
  #viewOrders .order-table tr.can-swipe.swiping > td.row-del, #viewOrders .order-table tr.can-swipe.swiped > td.row-del, #viewOrders .order-table tr.can-swipe > td.row-del:focus-within { opacity: 1; pointer-events: auto; }
  #viewOrders .order-table tr.can-swipe:has(> td.row-del:focus-within) > td:not(.row-del) { transform: translateX(-128px); }
  #viewOrders .order-table td.row-del .btn-del { flex: 1; flex-direction: column; justify-content: center; gap: 4px; height: auto; min-height: 0; border: 0; border-radius: 0; background: #c0392b; color: #fff; font-size: 14px; font-weight: 600; }
  #viewOrders .order-table td.row-del .btn-del:hover, #viewOrders .order-table td.row-del .btn-del:focus-visible { background: #a93226; color: #fff; }
  #viewOrders .order-table td.row-del .btn-del .del-text { display: inline; font-size: 14px; }
  #viewOrders .order-table td.row-del .btn-del .ic { width: 20px; height: 20px; }
  body.no-sel, body.no-sel * { user-select: none !important; -webkit-user-select: none !important; }
  .swipe-hint { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; }
}
@media screen and (max-width: 760px) {
  #viewOrders .order-table tr.can-swipe { overflow: hidden; touch-action: pan-y; }
  #viewOrders .order-table tr.can-swipe > td.row-del .btn-del { border-radius: 0 18px 18px 0; }
}
@media screen and (min-width: 761px) {
  #ordersTableWrap.sw-fit .order-table tr.can-swipe { touch-action: pan-y; }
  #ordersTableWrap.sw-end .order-table tr.can-swipe { touch-action: pan-left pan-y; }
}

/* ---------- หน้ารายละเอียดออร์เดอร์ (แบบภาพที่ 4) ---------- */
@media screen {
  #orderDialog.od-fw { position: fixed; inset: 6px 6px 6px var(--sidebar-w, 84px); width: auto; height: auto; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 24px; background: #fff; box-shadow: none; overflow: hidden; }
  #orderDialog.od-fw::backdrop { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
  #orderDialog.od-fw .sheet-head { display: flex; align-items: center; gap: 10px; padding: 16px 28px; background: #fff; border-bottom: 1px solid #f0f3f6; }
  #orderDialog.od-fw .sheet-head > div:first-child { flex: 1; min-width: 0; }
  #orderDialog.od-fw #orderDialogTitle { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; color: var(--fw-ink); white-space: nowrap; overflow: hidden; }
  #orderDialog.od-fw #orderDialogSub { display: none; }
  .od-crumb { border: 0; padding: 4px 2px; background: none; color: var(--ink-muted); font: inherit; cursor: pointer; }
  .od-crumb:hover { color: var(--fw-ink); text-decoration: underline; }
  .od-crumb-sep { color: var(--ink-subtle); }
  .od-crumb-no { font-weight: 600; }
  .od-head-acts { position: relative; display: flex; gap: 8px; align-items: center; }
  .od-head-acts .btn { min-height: 40px; }
  .od-dots { width: 40px; padding: 0; justify-content: center; }
  .od-menu { position: absolute; top: 46px; right: 0; z-index: 10; min-width: 250px; padding: 6px; background: #fff; border: 1px solid #e3e8ee; border-radius: 14px; box-shadow: 0 12px 32px rgba(15, 30, 44, .16); display: flex; flex-direction: column; }
  .od-menu button { min-height: 42px; padding: 8px 12px; border: 0; border-radius: 10px; background: none; color: var(--fw-ink); font: inherit; font-size: 14.5px; text-align: left; cursor: pointer; }
  .od-menu button:hover { background: #f1f4f7; }
  .od-menu button.danger { color: #b42318; }
  #orderDialog.od-fw #orderDialogClose { width: 40px; height: 40px; }
  #orderDialog.od-fw #orderDialogBody { padding: 22px max(28px, calc((100% - 1140px) / 2)) 18px; overscroll-behavior: contain; }
  .od-head { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 32px; align-items: start; margin-bottom: 26px; }
  .od-head:has(.od-visual:empty) { grid-template-columns: minmax(0, 1fr); }
  .od-who { display: flex; gap: 20px; align-items: flex-start; min-width: 0; }
  .od-avatar { flex: none; width: 84px; height: 84px; border-radius: 999px; background: #e6edf4; color: #143551; display: grid; place-items: center; font-size: 28px; font-weight: 700; }
  .od-who-txt { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
  .od-name { margin: 0; font-size: 30px; line-height: 1.25; font-weight: 700; color: var(--fw-ink); overflow-wrap: anywhere; }
  .od-name .badge-dealer { font-size: 12px; vertical-align: middle; }
  .od-no { display: flex; align-items: center; gap: 8px; }
  .od-no b { font-size: 19px; color: #143551; letter-spacing: .01em; }
  .od-meta { margin: 0; font-size: 14px; color: var(--ink-muted); }
  .od-line { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; color: var(--fw-ink); }
  .od-line .ic { width: 17px; height: 17px; flex: none; color: var(--ink-muted); }
  .od-line.od-addr { align-items: flex-start; font-size: 14px; color: var(--ink-muted); }
  .od-line.od-addr .ic { margin-top: 3px; }
  .od-phone { font-weight: 600; color: #143551; text-decoration: none; }
  /* v33.116: กล่องตัวเลข 4 ช่องเท่ากัน — พอดีทุกขนาดจอ (ตัวเลขไม่ตัดบรรทัด · ชื่อตัดได้) */
  .od-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 8px 0 4px; padding: 12px 4px; border: 1px solid #e6ebf0; border-radius: 16px; width: 100%; max-width: 560px; box-sizing: border-box; }
  .od-stat { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; min-width: 0; padding: 0 6px; text-align: center; }
  .od-stat + .od-stat { border-left: 1px solid #eef1f4; }
  .od-stat b { font-size: clamp(17px, 1.6vw, 22px); line-height: 1.2; color: var(--fw-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .od-stat span { font-size: 12.5px; line-height: 1.3; color: var(--ink-subtle); }
  .od-stat.owe b { color: #b42318; }
  .od-stat.ok b { color: #2a7a43; }
  .od-stat.stage b::before { content: ''; display: inline-block; width: 7px; height: 7px; margin: 0 5px 3px 0; border-radius: 2px; background: #fe730d; vertical-align: middle; }
  .od-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
  .od-acts .btn { min-height: 44px; }
  .od-visual { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
  .od-hero { margin: 0; aspect-ratio: 16 / 9.4; border-radius: 22px; overflow: hidden; background: #e6edf4; }
  .od-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .od-visual #peopleTaxBox { margin: 0; padding: 0; border: 0; background: none; }
  .od-visual #peopleTaxBox > .section-kicker { display: block; margin: 0 0 10px; padding: 0; border: 0; font-size: 15px; font-weight: 700; color: var(--fw-ink); }
  .od-visual #peopleTaxBox { padding: 16px 18px; border: 1px solid #e6ebf0; border-radius: 18px; }
  .od-visual .tax-detail { border: 0 !important; padding: 12px 0 0 !important; border-top: 1px solid #eef1f4 !important; border-radius: 0 !important; }
  .od-visual .tag-chip { border-radius: 999px; }
  .od-visual .tax-detail { margin-top: 10px !important; padding: 12px 14px; border: 1px solid #e6ebf0; border-radius: 14px; font-size: 14px; }
  .od-tabs { display: flex; gap: 6px; margin: 0 0 20px; border-bottom: 1px solid #e6ebf0; overflow-x: auto; scrollbar-width: none; }
  .od-tabs button { flex: none; min-height: 46px; padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--ink-muted); font: inherit; font-size: 15.5px; cursor: pointer; white-space: nowrap; }
  .od-tabs button[aria-selected="true"] { color: var(--fw-ink); font-weight: 700; border-bottom-color: var(--fw-ink); }
  .od-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .od-main, .od-side, .od-docs, .od-more { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
  .od-docs, .od-more { grid-column: 1 / -1; }
  .od-grid[data-tab="items"] .od-docs, .od-grid[data-tab="items"] .od-more { display: none; }
  .od-grid[data-tab="pay"] .od-main, .od-grid[data-tab="pay"] .od-ship, .od-grid[data-tab="pay"] .od-docs, .od-grid[data-tab="pay"] .od-more { display: none; }
  .od-grid[data-tab="pay"] .od-side { grid-column: 1 / -1; max-width: 760px; }
  .od-grid[data-tab="ship"] .od-main, .od-grid[data-tab="ship"] .od-pay, .od-grid[data-tab="ship"] .od-more { display: none; }
  .od-grid[data-tab="ship"] .od-side { grid-column: 1 / -1; max-width: 760px; order: 1; }
  .od-grid[data-tab="ship"] .od-docs { order: 2; max-width: 760px; }
  .od-grid[data-tab="more"] .od-main, .od-grid[data-tab="more"] .od-side, .od-grid[data-tab="more"] .od-docs { display: none; }
  .od-grid[data-tab="more"] .od-more { max-width: 760px; }
  .od-box-title { margin: 0 0 10px; font-size: 18px; font-weight: 700; color: var(--fw-ink); }
  .od-box #orderShipBox { margin: 0; }
  .od-box > .form-section, .od-box #orderPayBox > .form-section, .od-box #orderShipBox { border: 1px solid #e6ebf0; border-radius: 18px; padding: 16px 18px; }
  .od-pay > .od-box-title { display: none; }   /* การชำระเงินมีหัวข้อ + ⓘ ของตัวเองอยู่แล้ว */
  .od-box #orderPayBox > .form-section > .section-kicker { font-size: 18px; font-weight: 700; color: var(--fw-ink); border-bottom: 0; }
  .od-box #orderShipBox > .section-kicker { display: none; }
  #orderDialog.od-fw #orderDialogBody .form-section { margin: 0; }
  /* สินค้า: การ์ดต่อรายการ (รูปหมวด · ชื่อ · ราคา · ปุ่มขั้นงาน) */
  .od-main [data-od="items"] { border: 0 !important; padding: 0 !important; counter-reset: oditem; }
  .od-main [data-od="items"] > .section-kicker { margin-bottom: 10px; font-size: 14px; font-weight: 400; color: var(--ink-muted); }
  .od-main [data-od="items"] > .section-kicker { font-size: 0; }
  .od-main [data-od="items"] > .section-kicker .readonly-tag { font-size: 13.5px; }
  .od-main [data-od="items"] > div:not(.section-kicker) { margin: 0 0 12px !important; padding: 16px 18px 14px; border: 1px solid #e6ebf0; border-radius: 18px; counter-increment: oditem; }
  .od-main [data-od="items"] .line-item { margin-bottom: 12px !important; align-items: center; padding: 0; border: 0; background: none; }
  .od-main [data-od="items"] > .section-kicker { border-bottom: 0; padding-bottom: 0; }
  .od-main [data-od="items"] .line-no { display: none; }
  .od-main [data-od="items"] .line-body > b { font-size: 17px; }
  .od-main [data-od="items"] .line-body > b::before { content: counter(oditem) '. '; }
  .od-main [data-od="items"] .line-amt { font-size: 18px; font-weight: 700; color: var(--fw-ink); }
  /* ขั้นงาน = ปุ่มแคปซูล (ครบ = กรมท่า ✓ · ขั้นถัดไป = เส้นประ · ยังไม่ถึง = ขอบเทา) — ปุ่มเดิม กดติ๊ก / ย้อนเหมือนเดิม */
  .od-main .stepper { display: flex; flex-wrap: wrap; gap: 8px; }
  .od-main .step { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 1.5px solid #dfe5eb; border-radius: 999px; background: #fff; color: var(--ink-muted); font-size: 14px; line-height: 1.3; }
  .od-main .step:not(:has(.step-btn)) { padding: 8px 14px; }
  .od-main .step::before { display: none; }
  .od-main .step i { position: static; transform: none; width: auto; height: auto; border: 0; background: none; color: inherit; font-size: 13px; font-weight: 700; display: inline-grid; }
  .od-main .step .step-btn { display: inline-flex; align-items: center; gap: 6px; width: auto; padding: 8px 14px; border-radius: 999px; color: inherit; font-size: 14px; }
  .od-main .step.done { background: #143551; border-color: #143551; color: #fff; font-weight: 600; }
  .od-main .step.done i { background: none; border: 0; color: #fff; }
  .od-main .step.done + .step:not(.done), .od-main .step:first-child:not(.done) { border-style: dashed; border-color: #143551; color: #143551; }
  .od-main .step small { margin-left: 2px; font-size: 11.5px; color: inherit; opacity: .8; }
  .od-main .step.can:not(.done):hover { background: #eef3f8; }
  .od-main [data-od="items"] .od-ithumb { flex: none; width: 88px; height: 66px; margin-right: 14px; border-radius: 12px; object-fit: cover; }
  .od-main [data-od="items"] .od-ithumb.none { box-sizing: border-box; border: 1.5px dashed #b8c8d7; background: var(--fw-field); display: grid; place-items: center; color: var(--ink-subtle); font-size: 12px; }
  .od-main [data-od="totals"] { background: #f5f7fa; border: 0 !important; border-radius: 18px; }
  .od-main [data-od="totals"] > .section-kicker { display: none; }
  /* แถบขั้นงานลอย */
  .od-float { position: sticky; bottom: 18px; z-index: 6; display: flex; align-items: center; gap: 12px; width: fit-content; max-width: calc(100% - 24px); margin: 28px auto 0; padding: 8px 8px 8px 10px; border-radius: 999px; background: var(--fw-ink); color: #fff; box-shadow: 0 12px 30px rgba(15, 30, 44, .30); }
  .od-ring { position: relative; flex: none; width: 46px; height: 46px; }
  .od-ring svg { width: 46px; height: 46px; transform: rotate(-90deg); }
  .od-ring circle { fill: none; stroke-width: 3.5; }
  .od-ring circle.bg { stroke: rgba(255, 255, 255, .22); }
  .od-ring circle.fg { stroke: #fe730d; stroke-linecap: round; }
  .od-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; }
  .od-float-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
  .od-float-txt b { font-size: 15px; white-space: nowrap; }
  .od-float-txt small { font-size: 12.5px; color: #c9d6e2; white-space: nowrap; }
  .od-float-btn { min-height: 42px; margin-left: 6px; background: #fff; color: var(--fw-ink); border: 0; border-radius: 999px; font-weight: 600; }
  .od-float-btn:hover { background: #eef2f6; }
}
@media screen and (max-width: 1024px) {
  #orderDialog.od-fw { inset: 0; border-radius: 0; }
  #orderDialog.od-fw .sheet-head { padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
  #orderDialog.od-fw #orderDialogBody { padding: 16px 16px 12px; }
  .od-head { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .od-who-txt .od-stats { max-width: none; }
  .od-avatar { width: 64px; height: 64px; font-size: 22px; }
  .od-name { font-size: 25px; }
  .od-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; padding: 10px 2px; }
  .od-stat { padding: 0 4px; }
  .od-stat b { font-size: 19px; }
  .od-grid { grid-template-columns: minmax(0, 1fr); }
  .od-grid[data-tab="items"] .od-side { order: 2; }
  .od-float { bottom: calc(12px + env(safe-area-inset-bottom)); }
}
@media screen and (max-width: 760px) {
  .od-head { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .od-hero { aspect-ratio: 16 / 6.5; border-radius: 18px; }
  .od-crumb::before { content: '‹ '; }
  .od-crumb-sep, .od-crumb-no { display: none; }
  .od-who { gap: 14px; }
  .od-avatar { width: 56px; height: 56px; font-size: 20px; }
  .od-name { font-size: 23px; }
  .od-no b { font-size: 17px; }
  .od-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; padding: 10px 2px; }
  .od-stat { padding: 0 4px; }
  .od-stat b { font-size: 18px; }
  .od-stat span { font-size: 11.5px; }
  .od-acts .btn { flex: 1 1 auto; justify-content: center; }
  .od-head-acts .od-print { padding: 0 12px; font-size: 0; gap: 0; width: 40px; justify-content: center; }
  .od-head-acts .od-print .ic { width: 18px; height: 18px; }
  .od-main [data-od="items"] > div:not(.section-kicker) { padding: 14px; }
  .od-main [data-od="items"] .od-ithumb { width: 64px; height: 48px; margin-right: 10px; }
  .od-float { gap: 8px; padding: 6px 6px 6px 8px; }
  .od-float-txt small { display: none; }
}
/* v33.113: iPad — ข้อความสำหรับโปรแกรมอ่านหน้าจอในหัวตาราง (sr-only) ทำให้หน้ากว้างเกินจอจนหน้าย่อเล็ก → ให้ตารางเป็นกรอบอ้างอิง */
@media screen { .table-wrap { position: relative; } }

/* ======================= v33.116 (18:03): ปุ่มซ่อน / แสดงเมนูด้านข้าง ======================= */
@media screen { .nav-show-btn, .nav-hide-btn, .side-head { display: none; } }
@media screen and (min-width: 1025px) {
  .side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 2px 40px 12px; }
  .side-head .brand-mark { margin: 0; }
  .nav-hide-btn { display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 10px; background: none; color: var(--ink-muted); cursor: pointer; }
  .nav-hide-btn:hover { background: #fff; color: var(--fw-ink); }
  .nav-hide-btn:focus-visible, .nav-show-btn:focus-visible { outline: 2px solid #143551; outline-offset: 2px; }
  .nav-hide-btn .ic { width: 20px; height: 20px; }
  body.nav-hidden { --sidebar-w: 0px; }
  body.nav-hidden .app-sidebar { display: none; }
  body.nav-hidden .app-main { margin-left: 6px; }
  body.nav-hidden #orderDialog.od-fw { left: 6px; }
  body.nav-hidden .nav-show-btn { display: inline-flex; align-items: center; gap: 6px; flex: none; height: 38px; padding: 0 14px 0 10px; border: 1px solid #e3e8ee; border-radius: 999px; background: #fff; color: var(--fw-ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
  body.nav-hidden .nav-show-btn:hover { background: #f3f5f7; }
  body.nav-hidden .nav-show-btn .ic { width: 18px; height: 18px; }
}

/* ======================= v33.118 (18:20): หน้าเข้าสู่ระบบแบบวิดีโอ Fastwork — การ์ดรอบหน้า = ภาพหน้าจอแต่ละโมดูล ======================= */
@media screen {
  .fw-login-stage .fw-float { width: clamp(180px, 17vw, 264px); padding: 8px 8px 10px; border-radius: 18px; box-shadow: 0 14px 36px rgba(15, 30, 44, .14); animation: fwBob 7s ease-in-out infinite; }
  .fw-login-stage .fw-float img { height: auto; aspect-ratio: 4 / 3; object-fit: cover; object-position: left top; border-radius: 12px; border: 1px solid #edf1f5; }
  .fw-login-stage .fw-float figcaption { padding: 10px 4px 0; gap: 10px; }
  .fw-login-stage .fw-float figcaption i { display: grid; place-items: center; width: 32px; height: 32px; background: #143551; color: #fff; }
  .fw-login-stage .fw-float figcaption i .ic { width: 17px; height: 17px; }
  .fw-login-stage .fw-float figcaption b { font-size: 14.5px; }
  .fw-login-stage .fw-float figcaption small { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .fw-login-stage .fw-float.f1 { left: 4vw;  top: 7vh;  right: auto; --r: -6deg; }
  .fw-login-stage .fw-float.f2 { left: 11vw; top: 37vh; right: auto; --r: 4deg; }
  .fw-login-stage .fw-float.f3 { left: 3vw;  top: 66vh; right: auto; --r: -3deg; }
  .fw-login-stage .fw-float.f4 { right: 4vw;  top: 8vh;  left: auto; --r: 6deg; }
  .fw-login-stage .fw-float.f5 { right: 11vw; top: 38vh; left: auto; --r: -4deg; }
  .fw-login-stage .fw-float.f6 { right: 3vw;  top: 67vh; left: auto; --r: 3deg; }
  .fw-login-stage .fw-float { transform: rotate(var(--r, 0deg)); }
  @keyframes fwBob { 0%, 100% { transform: rotate(var(--r, 0deg)) translateY(0); } 50% { transform: rotate(var(--r, 0deg)) translateY(-10px); } }
}
@media screen and (prefers-reduced-motion: reduce) { .fw-login-stage .fw-float { animation: none; } }
/* คอมจอเล็ก / iPad: การ์ด 4 ใบโผล่จากขอบซ้าย-ขวา (ไม่ทับหน้าต่างเข้าสู่ระบบ) */
@media screen and (min-width: 761px) and (max-width: 1100px) {
  .fw-login-stage .fw-float { display: block; width: 190px; }
  .fw-login-stage .fw-float.f2, .fw-login-stage .fw-float.f5 { display: none; }
  .fw-login-stage .fw-float.f1 { left: -46px; top: 14vh; }
  .fw-login-stage .fw-float.f3 { left: -30px; top: 58vh; }
  .fw-login-stage .fw-float.f4 { right: -46px; top: 16vh; }
  .fw-login-stage .fw-float.f6 { right: -30px; top: 60vh; }
}
/* มือถือ: การ์ด 2 ใบมุมบน (แบบเดิม) */
@media screen and (max-width: 760px) {
  .fw-login-stage .fw-float { width: 168px; padding: 6px 6px 8px; }
  .fw-login-stage .fw-float figcaption { padding-top: 7px; gap: 7px; }
  .fw-login-stage .fw-float figcaption i { display: grid; width: 24px; height: 24px; }
  .fw-login-stage .fw-float figcaption i .ic { width: 13px; height: 13px; }
  .fw-login-stage .fw-float figcaption b { font-size: 13px; }
  .fw-login-stage .fw-float figcaption small { display: none; }
  .fw-login-stage .fw-float.f2, .fw-login-stage .fw-float.f3, .fw-login-stage .fw-float.f5, .fw-login-stage .fw-float.f6 { display: none; }
  .fw-login-stage .fw-float.f1 { left: -26px; top: 62px; }
  .fw-login-stage .fw-float.f4 { right: -26px; top: 80px; display: block; }
}

/* ======================= v33.119 (18:29): หน้าเข้าสู่ระบบแบบหน้าแรก — คอม · iPad · มือถือ ======================= */
@media screen {
  body:has(#pinDialog[open]) .fw-login-stage { background: #fff; }
  .fw-login-stage .fw-login-logo, .fw-login-stage .fw-login-head { display: none !important; }
  /* หน้าต่างเข้าสู่ระบบ = ทั้งหน้าจอ โปร่งใส (การ์ดอยู่ด้านหลัง) */
  #pinDialog { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0 !important; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow-y: auto; overscroll-behavior: contain; }
  #pinDialog[open] { display: flex; flex-direction: column; align-items: center; }
  #pinDialog .lg-top { align-self: stretch; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px clamp(18px, 3.4vw, 48px); }
  #pinDialog .lg-logo { display: block; width: auto; height: 44px; max-width: 200px; margin: 0; object-fit: contain; object-position: left center; }
  #pinDialog .lg-logo.lg-h { height: 26px; } #pinDialog .lg-logo.lg-mark { height: 40px; }
  #pinDialog .lg-pill { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; border: 1.5px solid #e3e8ee; border-radius: 999px; background: #fff; color: var(--fw-ink); font-size: 15px; font-weight: 600; }
  #pinDialog .lg-pill .ic { width: 18px; height: 18px; }
  #pinDialog .lg-hero { margin-top: auto; padding: 12px 18px 0; text-align: center; }
  #pinDialog .lg-title { margin: 0; font-size: clamp(36px, 4.6vw, 64px); line-height: 1.25; font-weight: 700; color: var(--fw-ink); letter-spacing: 0; }
  #pinDialog .lg-title em { position: relative; font-style: normal; color: #143551; padding: 0 .08em; }
  #pinDialog .lg-title em::after { content: ''; position: absolute; left: 0; right: 0; bottom: -.04em; height: .1em; border-radius: 999px; background: #fe730d; opacity: .85; }
  #pinDialog .lg-sub { margin: 18px 0 0; font-size: clamp(15px, 1.35vw, 18px); line-height: 1.6; color: var(--ink-muted); }
  #pinDialog .lg-clock { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; width: min(560px, 100%); margin: 28px auto 0; }
  #pinDialog .lg-clock > span { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 14px 4px 12px; border-radius: 18px; background: #eaf0f7; }
  #pinDialog .lg-clock b { font-size: clamp(26px, 2.6vw, 38px); line-height: 1.15; font-weight: 700; color: #143551; font-variant-numeric: tabular-nums; }
  #pinDialog .lg-clock small { margin-top: 2px; font-size: 14px; color: #3d5a78; }
  /* ช่องกรอก (ป้ายช่องซ่อนจากตา — โปรแกรมอ่านหน้าจอยังอ่าน) */
  #pinDialog .sheet-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; padding: 0; border: 0; }
  #pinDialog .sheet-body { width: min(520px, calc(100% - 36px)); padding: 26px 0 0; display: grid; gap: 12px; overflow: visible; flex: none; }
  #pinDialog .sheet-body .field { margin: 0; }
  #pinDialog .sheet-body .field > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  #pinDialog .sheet-body input#userInput, #pinDialog .sheet-body input#pinInput { height: 58px; padding: 0 22px !important; border: 1.5px solid #dfe5eb; border-radius: 999px; background: #fff; text-align: center; font-size: 17px; }
  #pinDialog .sheet-body input#pinInput { padding: 0 64px !important; }
  #pinDialog .sheet-body input::placeholder { color: #67727d; }
  #pinDialog .sheet-body input:focus { border-color: #143551; box-shadow: 0 0 0 3px rgba(20, 53, 81, .14); }
  #pinDialog .pw-eye { right: 7px; width: 46px; height: 46px; background: #f1f4f7; color: var(--fw-ink); }
  #pinDialog .pw-eye[aria-pressed="true"] { background: #143551; color: #fff; }
  #pinDialog .field-error { margin: 2px 4px 0; text-align: center; font-size: 13.5px; line-height: 1.5; }
  #pinDialog .field-error:empty { display: none; }
  #pinDialog .sheet-foot { width: min(520px, calc(100% - 36px)); padding: 14px 0 0; border: 0; background: none; flex: none; }
  #pinDialog .sheet-foot .btn { width: 100%; min-height: 58px; border-radius: 999px; background: var(--fw-ink); font-size: 17px; font-weight: 700; }
  #pinDialog .sheet-foot .btn:hover:not(:disabled) { background: #143551; }
  #pinDialog .lg-foot { margin: auto 0 0; padding: 30px 18px 22px; text-align: center; font-size: 14px; color: var(--ink-subtle); }
  #pinDialog .lg-cards-m { display: none; }
  /* การ์ดรอบหน้า (คอม) — ตำแหน่งแบบภาพตัวอย่าง: บนซ้าย / บนขวา / กลางซ้าย / กลางขวา / ล่างซ้าย (เข้ม) / ล่างขวา (เข้ม) */
  .fw-login-stage .fw-float { width: clamp(170px, 15.5vw, 300px); }
  .fw-login-stage .fw-float.f1 { left: 4vw;  top: 14vh; --r: -5deg; }
  .fw-login-stage .fw-float.f4 { right: 4vw; top: 12vh; --r: 6deg; }
  .fw-login-stage .fw-float.f2 { left: 13vw; top: 50vh; --r: 4deg; }
  .fw-login-stage .fw-float.f5 { right: 13vw; top: 48vh; --r: -5deg; }
  .fw-login-stage .fw-float.f3 { left: 2vw;  top: auto; bottom: 6vh; --r: -3deg; }
  .fw-login-stage .fw-float.f6 { right: 2vw; top: auto; bottom: 5vh; --r: 4deg; }
  .fw-login-stage .fw-float.dark { background: var(--fw-ink); }
  .fw-login-stage .fw-float.dark img { border-color: #24384b; }
  .fw-login-stage .fw-float.dark figcaption b { color: #fff; }
  .fw-login-stage .fw-float.dark figcaption small { color: #b8c8d7; }
  .fw-login-stage .fw-float.dark figcaption i { background: #fff; color: var(--fw-ink); }
}
/* คอมจอเล็ก / iPad: การ์ด 4 ใบตามมุม (ไม่มีกลางซ้าย-ขวา) */
@media screen and (min-width: 761px) and (max-width: 1280px) {
  .fw-login-stage .fw-float { display: block; width: clamp(160px, 19vw, 210px); }
  .fw-login-stage .fw-float.f2, .fw-login-stage .fw-float.f5 { display: none; }
  .fw-login-stage .fw-float.f1 { left: -28px; top: 13vh; }
  .fw-login-stage .fw-float.f4 { right: -28px; top: 12vh; }
  .fw-login-stage .fw-float.f3 { left: -20px; bottom: 4vh; top: auto; }
  .fw-login-stage .fw-float.f6 { right: -20px; bottom: 3vh; top: auto; }
}
/* มือถือ: หัวข้อ + เวลา + ช่องกรอก แล้วการ์ดเรียงต่อด้านล่าง (เลื่อนดูได้) */
@media screen and (max-width: 760px) {
  .fw-login-stage .fw-float { display: none !important; }
  #pinDialog .lg-top { padding: 16px 18px; }
  #pinDialog .lg-logo { height: 38px; }
  #pinDialog .lg-pill { height: 40px; padding: 0 14px; font-size: 14px; }
  #pinDialog .lg-hero { margin-top: 18px; }
  #pinDialog .lg-title { font-size: clamp(32px, 9.4vw, 42px); }
  #pinDialog .lg-sub { font-size: 14.5px; }
  #pinDialog .lg-clock { gap: 8px; margin-top: 22px; }
  #pinDialog .lg-clock > span { padding: 12px 2px 10px; border-radius: 16px; }
  #pinDialog .lg-clock b { font-size: 26px; }
  #pinDialog .lg-clock small { font-size: 12.5px; }
  #pinDialog .sheet-body { padding-top: 22px; }
  #pinDialog .lg-cards-m { display: block; position: relative; align-self: stretch; height: 330px; margin-top: 34px; overflow: hidden; flex: none; }
  .lgm { position: absolute; width: 168px; margin: 0; padding: 6px 6px 8px; box-sizing: border-box; background: #fff; border-radius: 16px; box-shadow: 0 12px 30px rgba(15, 30, 44, .14); }
  .lgm img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: left top; border-radius: 10px; border: 1px solid #edf1f5; }
  .lgm figcaption { padding: 7px 4px 0; font-size: 13px; font-weight: 700; color: var(--fw-ink); }
  .lgm.dark { background: var(--fw-ink); } .lgm.dark figcaption { color: #fff; } .lgm.dark img { border-color: #24384b; }
  .lgm.c1 { left: -34px; top: 8px; transform: rotate(-5deg); }
  .lgm.c2 { right: -40px; top: 22px; transform: rotate(6deg); }
  .lgm.c3 { left: -18px; top: 160px; transform: rotate(-3deg); }
  .lgm.c4 { right: -24px; top: 170px; transform: rotate(4deg); }
  #pinDialog .lg-foot { margin-top: 0; padding-top: 18px; }
}
@media screen and (max-height: 760px) and (min-width: 761px) { #pinDialog .lg-hero { margin-top: 8px; } }
@media screen {
  #pinDialog .field-error.demo-hint { margin: 6px 0 0; padding: 12px 16px; border-radius: 16px; background: var(--fw-ink); color: #fff; font-size: 13px; font-weight: 500; line-height: 1.55; }
}
@media screen and (min-width: 761px) {
  #pinDialog .field-error.demo-hint { position: fixed; right: 18px; bottom: 18px; z-index: 2; width: min(400px, calc(100vw - 36px)); margin: 0; text-align: left; box-shadow: 0 10px 30px rgba(15, 30, 44, .25); }
}

/* ======================= v33.120 (18:52): แก้บั๊กจากการตรวจ v33.119 ======================= */
/* บัค 5: เบราว์เซอร์ที่ไม่รู้จัก :has (iOS < 15.4 / Chrome < 105) — หน้าต่างเข้าสู่ระบบพื้นขาวเป็นค่าตั้งต้น · โปร่งใสเฉพาะเมื่อรองรับ (เห็นการ์ดด้านหลัง) */
@media screen {
  #pinDialog { background: #fff; }
  @supports selector(:has(a)) { #pinDialog { background: transparent; } }
}
/* บัค 4: คอม 1025–1280 px — แถบเมนูแคบ 96 px (ไอคอน + ชื่อสั้น) · หัวข้อใหญ่ + Dropdown เหมือนเดิม · ตารางมีที่มากขึ้น */
@media screen and (min-width: 1025px) and (max-width: 1280px) {
  :root { --sidebar-w: 96px; }
  .app-sidebar { padding: 14px 8px 14px; }
  .side-head { flex-direction: column; gap: 10px; margin: 6px 0 22px; }
  .side-head .brand-mark { content: url("icons/manutham-mark.svg"); width: 40px; height: 40px; max-height: none; }
  .side-head .brand-mark.lg-none { display: none; }
  .nav-item { flex-direction: column; justify-content: center; gap: 2px; min-height: 50px; padding: 6px 2px; text-align: center; }
  .nav-item svg { display: block !important; width: 20px; height: 20px; }
  .nav-item .nav-label { font-size: 0; }
  .nav-item .nav-label::after { content: attr(data-short); font-size: 12px; font-weight: 600; }
  .nav-item[data-grp] { padding: 6px 2px; min-height: 48px; }
  .nav-item[data-grp]::before { left: 4px; top: 8px; bottom: 8px; }
  .nav-item[data-grp] .nav-label { font-size: 0; }
  .nav-group-label { margin: 6px 0 0; }
  .nav-grp-btn { flex-direction: column; gap: 2px; min-height: 50px; padding: 6px 2px; text-align: center; position: relative; }
  .nav-grp-name { flex: none; font-size: 0; }
  .nav-grp-name::after { content: attr(data-short); font-size: 12px; font-weight: 700; }
  .nav-grp-caret { position: absolute; right: 4px; top: 6px; }
  .nav-grp-caret .ic { width: 12px; height: 12px; }
}
/* บัค 10: เป้ากดเล็ก — จุดสถานะงาน (จอสัมผัส) ขยายพื้นที่กดเป็น 24 × 24 px · ปุ่มเลขออร์เดอร์ในการ์ดตามหนี้ / สลิป สูงอย่างน้อย 32 px */
@media screen and (pointer: coarse) {
  .stage-dots { gap: 8px; }
  .stage-dots .sdot + .sdot::before { width: 8px; margin-right: 0; }
  .stage-dots .sdot::after { content: ''; position: absolute; inset: -4px; }
}
@media screen {
  .debt-top .link-btn, .slip-top .linkish { display: inline-flex; align-items: center; min-height: 32px; }
}
@media screen {
  #orderDialog.od-fw .toast { bottom: calc(96px + env(safe-area-inset-bottom)); top: auto; }   /* ข้อความแจ้งอยู่เหนือแถบขั้นงานลอย */
}
@media screen and (min-width: 1281px) {
  .nav-grp-name { white-space: nowrap; line-height: 1.6; }   /* ไม่ตัดด้วย overflow — วรรณยุกต์ไทยบนสระถูกตัด */
  .nav-grp-btn { gap: 10px; }
}
@media screen and (min-width: 1281px) {
  :root { --sidebar-w: 248px; }
  .app-sidebar { padding-left: 10px; padding-right: 10px; }
  .nav-group-label { margin-left: 0; margin-right: 0; }
  .nav-grp-btn { padding: 8px 10px; gap: 8px; font-size: 14.5px; }
  .nav-grp-caret .ic { width: 14px; height: 14px; }
  .nav-item { margin-left: 0; margin-right: 0; }
}
@media screen and (min-width: 1025px) and (max-width: 1280px) {
  .nav-item, .nav-item[data-grp] { min-height: 44px; }
  .nav-grp-btn { min-height: 46px; }
}

/* ======================= v33.122: การ์ดภาพระบบหน้าเข้าสู่ระบบ — ขยับตามเมาส์ / เอียงเมื่อชี้ / ดุกดิกเมื่อกด ======================= */
@media screen {
  .fw-login-stage { perspective: 1400px; }
  #pinDialog .lg-cards-m { perspective: 900px; }
  .fw-login-stage .fw-float, #pinDialog .lgm { will-change: translate, rotate; transition: rotate .35s cubic-bezier(.2, .8, .2, 1), scale .3s ease, box-shadow .3s ease; }
  .fw-login-stage .fw-float { animation: fwBob 7s ease-in-out var(--bd, 0s) infinite; }
  .fw-login-stage .fw-float.f2 { --bd: -2s; } .fw-login-stage .fw-float.f3 { --bd: -4s; } .fw-login-stage .fw-float.f4 { --bd: -1s; }
  .fw-login-stage .fw-float.f5 { --bd: -3s; } .fw-login-stage .fw-float.f6 { --bd: -5s; }
  /* มือถือ: การ์ดลอยขึ้นลงเบา ๆ เหมือนคอม */
  #pinDialog .lgm { animation: fwBob 6s ease-in-out var(--bd, 0s) infinite; }
  #pinDialog .lgm.c1 { --r: -5deg; } #pinDialog .lgm.c2 { --r: 6deg; --bd: -1.5s; } #pinDialog .lgm.c3 { --r: -3deg; --bd: -3s; } #pinDialog .lgm.c4 { --r: 4deg; --bd: -4.5s; }
  #pinDialog .lgm { transform: rotate(var(--r, 0deg)); }
  /* ชี้ที่การ์ด (เมาส์) = ยกขึ้น + เอียงตามเมาส์ */
  .fw-login-stage .fw-float.lg-hot, #pinDialog .lgm.lg-hot { scale: 1.06; z-index: 3; box-shadow: 0 24px 54px rgba(15, 30, 44, .24); }
  #pinDialog.lg-over { cursor: pointer; }
  /* กด / แตะ = ดุกดิก */
  .fw-login-stage .fw-float.lg-wig, #pinDialog .lgm.lg-wig { animation: fwBob 7s ease-in-out var(--bd, 0s) infinite, lgWig .75s cubic-bezier(.36, .07, .19, .97) 0s 1; }
  @keyframes lgWig { 0% { rotate: z 0deg; scale: 1; } 15% { rotate: z -7deg; scale: 1.08; } 32% { rotate: z 6deg; } 48% { rotate: z -4deg; } 64% { rotate: z 3deg; } 80% { rotate: z -1.5deg; } 100% { rotate: z 0deg; scale: 1; } }
  #pinDialog .lgm { cursor: pointer; -webkit-tap-highlight-color: transparent; }
}
@media screen and (prefers-reduced-motion: reduce) {
  .fw-login-stage .fw-float, #pinDialog .lgm, .fw-login-stage .fw-float.lg-wig, #pinDialog .lgm.lg-wig { animation: none; transition: none; }
}
