:root {
  /* ---------- ดีไซน์ใหม่ (ต.ค. 2026) — โทนเขียว/ครีม ปรับตามไอเดียที่ เจ้าของระบบ ส่งภาพตัวอย่างมา ----------
     เขียวเข้ม = สีหลัก (header/แถบล่าง/ปุ่มหลัก), ครีม = พื้นหลังแอป, ส้ม/อำพัน = สีเตือน/accent รอง
     ชื่อตัวแปรเดิม (--green/--red/--blue ฯลฯ) คงไว้เหมือนเดิมทุกตัว เพราะทุกหน้าในแอป (34+ หน้า) อ้างอิง
     ตัวแปรชุดนี้อยู่แล้ว — แค่เปลี่ยนค่าจุดเดียวตรงนี้ ทุกหน้าก็เปลี่ยนตามทันทีโดยไม่ต้องแก้ทีละหน้า */
  --green: #1e4d36;
  --green-dark: #163b29;
  --green-light: #e4f0e6;
  --red: #c0392b;
  --red-light: #fdecea;
  --yellow: #b6692f;       /* เดิมสีเหลือง เปลี่ยนเป็นโทนอำพัน/คลาย ให้เข้ากับธีมใหม่ (ยังสื่อ "เตือน" เหมือนเดิม) */
  --yellow-light: #f6e9da;
  --blue: #2563a8;
  --blue-light: #e8f1fa;
  --purple: #7c4fa0;
  --purple-light: #f3ecf8;
  --gray: #6b7568;          /* ปรับให้เอียงไปทางเขียว-เทาเล็กน้อย ให้เข้าชุดกับธีมใหม่แทนเทาล้วน */
  --border: #ece6d6;
  --bg: #f8f4e9;            /* พื้นหลังครีมอุ่นๆ แทนเทาอ่อนเดิม */
  --text: #1c2b22;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(28,43,34,0.06);
  --zebra: #f7f4ea;
  --accent-gold: #f3b23e;   /* ใช้จุดเดียว: ตัวอักษรย่อผู้ใช้ที่ topbar */
  --font: 'Prompt', -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, sans-serif;
}
* { box-sizing: border-box; }
.neg-num { color: var(--red); font-weight: 700; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* ไม่เด้งเมื่อเลื่อนสุดขอบบน / ล่าง — การเด้งบน iPhone ทำให้แถบเมนูล่างค้างกลางจอ (เจ้าของระบบ 2026-11-29) */
html, body { overscroll-behavior-y: none; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: var(--font);
  overflow-x: clip; /* clip ไม่สร้างกล่องเลื่อนซ้อน (hidden สร้าง) → position: sticky ของหัวจอทำงานถูก */
  width: 100%; max-width: 100vw; }
#app { min-height: 100vh; display: flex; flex-direction: column; width: 100%; max-width: 100vw; overflow-x: clip; }

/* ---------- top bar ---------- */
.topbar { background: var(--green); color: #fff; padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top)); display: flex;
  align-items: center; justify-content: space-between; gap: 8px; position: sticky; top: 0; z-index: 10;
  max-width: 100%; overflow: hidden; }
.topbar .brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.topbar .brand-icon { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,0.16);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.topbar .brand-icon svg { display: block; }
.topbar .brand-text { min-width: 0; overflow: hidden; }
.topbar h1 { font-size: 15px; margin: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.topbar .brand-sub { font-size: 11px; color: rgba(255,255,255,0.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* แถบบนสุด (เจ้าของระบบ 2026-10-28): ไม่มีชื่อผู้ใช้ (มี "สวัสดี, ชื่อ" ในหน้าหลักแล้ว) · ปุ่มสูง 40px · ปุ่มออกจากระบบอยู่ห่างปุ่มอื่น + เส้นคั่น กันกดพลาด */
.topbar .right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; justify-content: flex-end; }
.topbar button.logout-btn { background: transparent; border: 1px solid rgba(255,255,255,0.35); color: #fff; padding: 0 10px; height: 34px;
  border-radius: 9px; font-size: 11.5px; flex: 0 0 auto; white-space: nowrap; display: flex; align-items: center; gap: 6px;
  margin-left: 10px; position: relative; }
.topbar button.logout-btn svg { width: 14px; height: 14px; }
.topbar button.logout-btn::before { content: ""; position: absolute; left: -11px; top: 6px; bottom: 6px; width: 1px; background: rgba(255,255,255,0.25); }
@media (max-width: 360px) {
  .topbar button.logout-btn span { display: none; }
  .topbar button.logout-btn { width: 34px; padding: 0; justify-content: center; }
}
@media (max-width: 340px) {
  .topbar h1 { font-size: 13px; }
}

/* ---------- content ---------- */
.content { flex: 1; padding: 14px; padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px)); max-width: 900px; width: 100%; margin: 0 auto; } /* iPhone มีแถบ Home (⚪8) */
.card { background: #fff; border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  box-shadow: var(--shadow); border: 1px solid var(--border); }
h2.section-title { font-size: 15px; font-weight: 600; color: var(--green); margin: 4px 0 12px; }

/* ---------- bottom nav ---------- */
.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 4px; padding: 8px 10px max(10px, env(safe-area-inset-bottom)); z-index: 10; }
/* ---------- จอมือถือ / แท็บเล็ต: โครงแบบแอป (app-shell · 2026-12-02) ----------
   iPhone (แอปจากหน้าโฮม) แถบเมนูล่างแบบ fixed ลอยค้างกลางจอหลังเลื่อนเร็ว / เด้งขอบ และหัวจอหลุด
   → ทั้งหน้าไม่เลื่อน · #app สูงเท่าจอ เรียง หัวจอ / เนื้อหา / เมนูล่าง · เลื่อนเฉพาะ .content · เมนูล่างไม่ใช้ fixed เลย */
@media (max-width: 1023px) {
  html, body { height: 100%; overflow: hidden; }
  #app { height: 100dvh; max-height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
  .topbar { flex: 0 0 auto; position: relative; }
  .content { flex: 1 1 auto; min-height: 0; max-width: none; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; padding-bottom: 16px; }
  .bottomnav { flex: 0 0 auto; position: static; transform: none; -webkit-backface-visibility: visible; backface-visibility: visible; }
  .login-wrap { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .bill-actions { bottom: 0; } /* เมนูล่างไม่ได้ทับเนื้อหาแล้ว */
}
.bottomnav a { flex: 1 1 0; text-align: center; font-size: 10.5px; font-weight: 500; color: var(--gray);
  text-decoration: none; padding: 7px 4px; border-radius: 14px; display: flex; flex-direction: column;
  align-items: center; gap: 3px; }
.bottomnav a.active { color: var(--green); font-weight: 600; background: var(--green-light); }
.bottomnav .icon { display: flex; align-items: center; justify-content: center; }
.bottomnav .icon svg { display: block; }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; color: var(--gray); margin: 10px 0 4px; font-weight: 500; }
.req { color: var(--red); font-weight: 700; margin-left: 2px; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; background: #fff; color: var(--text); font-family: var(--font); }
textarea { resize: vertical; min-height: 60px; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }
button { font-family: var(--font); }
button.primary { background: var(--green); color: #fff; border: none; padding: 13px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; width: 100%; margin-top: 14px; }
button.secondary { background: #fff; border: 1px solid var(--border); color: var(--text); padding: 10px 14px;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; }
button.danger { background: var(--red); color: #fff; border: none; padding: 9px 13px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; }
a.secondary { background: #fff; border: 1px solid var(--border); color: var(--text); padding: 10px 14px;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; text-decoration: none; display: inline-block; white-space: nowrap; }
.msg { padding: 12px 14px; border-radius: var(--radius-sm); margin-top: 10px; font-size: 14px; }
.msg.error { background: var(--red-light); color: var(--red); }
.msg.success { background: var(--green-light); color: var(--green-dark); }
.msg.warning { background: var(--yellow-light); color: #7a4510; }

/* ---------- type grid (เมนูแบบการ์ดไอคอน: เมนูบันทึกรายการ/รายงาน/ตั้งค่า/ทางลัดหน้าหลัก ใช้ร่วมกันหมด) ---------- */
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-btn { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 10px;
  text-align: center; text-decoration: none; color: var(--text); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; }
.type-btn:active { opacity: 0.85; }
.type-btn .emoji { font-size: 21px; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 13px; background: var(--green-light); line-height: 1; color: var(--green); }
.type-btn .emoji .ico { display: block; }
.type-btn { transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
@media (hover: hover) { .type-btn:hover { border-color: #d9cfb6; box-shadow: 0 4px 14px rgba(28,43,34,0.08); transform: translateY(-1px); } }
.type-btn:active { transform: scale(0.98); }
.type-btn .lbl { font-size: 12.5px; font-weight: 600; line-height: 1.3; }

/* การ์ด "งานประจำวัน" ที่มีงานค้างจริง (เช่น 📋 งานค้างที่ต้องตรวจ) — แทนที่แถบเตือนลอยด้านบนหน้าหลักเดิม
   (เจ้าของระบบ ขอตัดออกเพราะรำคาญตา) ด้วยการเน้นที่ไอคอนแทน: ขอบ/ตัวหนังสือแดง + เด้งเบาๆ ให้สะดุดตา + ตัวเลขค้าง */
.type-btn.has-pending { border-color: var(--red); animation: pending-pulse 1.8s ease-in-out infinite; }
.type-btn.has-pending .emoji { background: var(--red-light); color: var(--red); }
.type-btn.has-pending .lbl { color: var(--red); font-weight: 700; }
.type-btn .pending-badge { position: absolute; top: 8px; right: 8px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 999px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center; line-height: 1; box-shadow: 0 0 0 2px #fff; }
@keyframes pending-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(192, 57, 43, 0); }
}

/* ---------- entry menu: กลุ่มประเภทรายการ (จัดกลุ่ม ซื้อเข้า/ขายเครดิต/ฝากขาย/เบิกตัวอย่าง/อื่นๆ) ----------
   เดิมใช้เส้นสีคั่นด้านซ้าย (border-left) เปลี่ยนมาเป็นจุดสีกลมๆ หน้าหัวข้อกลุ่มแทน ดูสะอาดและทันสมัยกว่า
   สีของแต่ละกลุ่มยังคุมสีไอคอนในการ์ดลูก (.type-btn .emoji) ของกลุ่มนั้นด้วย ให้แต่ละหมวดดูแยกจากกันชัดเจน */
.entry-group { padding-left: 2px; margin-bottom: 24px; }
.entry-group:last-of-type { margin-bottom: 8px; }
.entry-group-title { font-size: 14.5px; font-weight: 700; margin: 0 0 3px; display: flex; align-items: center; gap: 8px; }
.entry-group-title::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: var(--green); flex-shrink: 0; }
.entry-group-desc { font-size: 12px; color: var(--gray); margin: 0 0 10px; padding-left: 16px; }
.entry-group.grp-blue .entry-group-title::before { background: var(--blue); }
.entry-group.grp-blue .type-btn .emoji { background: var(--blue-light); color: var(--blue); }
.entry-group.grp-green .entry-group-title::before { background: var(--green); }
.entry-group.grp-green .type-btn .emoji { background: var(--green-light); }
.entry-group.grp-yellow .entry-group-title::before { background: var(--yellow); }
.entry-group.grp-yellow .type-btn .emoji { background: var(--yellow-light); color: var(--yellow); }
.entry-group.grp-purple .entry-group-title::before { background: var(--purple); }
.entry-group.grp-purple .type-btn .emoji { background: var(--purple-light); color: var(--purple); }
.entry-group.grp-gray .entry-group-title::before { background: var(--gray); }
.entry-group.grp-gray .type-btn .emoji { background: #eee8d8; color: var(--gray); }
.entry-group.grp-red .entry-group-title::before { background: var(--red); }
.entry-group.grp-red .type-btn .emoji { background: var(--red-light); color: var(--red); }
.entry-group.grp-teal .entry-group-title::before { background: #0f7c80; }
.entry-group.grp-teal .type-btn .emoji { background: #e0f2f1; color: #0f7c80; }
.entry-group.grp-orange .entry-group-title::before { background: #c2660f; }
.entry-group.grp-orange .type-btn .emoji { background: #fdeedd; color: #c2660f; }
/* เมนูรายงาน (เจ้าของระบบ 2026-10-15): ค้นหา + คำอธิบายสั้นใต้ชื่อ + เปิดล่าสุด */
.rep-search { width: 100%; margin: 4px 0 18px; }
.type-btn .rep-hint { font-size: 11px; color: var(--gray); line-height: 1.3; margin-top: -4px; }
@media (min-width: 760px) { .rep-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .rep-grid { grid-template-columns: repeat(4, 1fr); } }

/* ---------- kpi cards ---------- */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: #fff; border-radius: var(--radius); padding: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.kpi .num { font-size: 24px; font-weight: 700; color: var(--green); }
.kpi .lbl { font-size: 12px; color: var(--gray); margin-top: 2px; font-weight: 500; }
.kpi.warn .num { color: var(--yellow); }
.kpi.danger .num { color: var(--red); }
a.kpi { display: block; text-decoration: none; color: inherit; }
a.kpi:active { opacity: 0.7; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; overscroll-behavior-x: contain; cursor: grab; }
.table-wrap.dragging { cursor: grabbing; user-select: none; }
.sticky-hscroll { position: fixed; left: 0; width: 0; height: 16px; overflow-x: auto; overflow-y: hidden;
  background: #fff; border-top: 1px solid var(--border); z-index: 15; display: none; }
.sticky-hscroll.visible { display: block; }
.sticky-hscroll > div { height: 1px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th, td { border-right: 1px solid var(--border); }
th:last-child, td:last-child { border-right: none; }
/* คอลัมน์ "รายละเอียด" ของหน้า Audit Log — ของเดิม nowrap ทุกคอลัมน์ ทำให้รายการยาวๆ (เช่น ราคาล็อกลูกค้า
   หลายสิบตัว) ดันตารางทั้งหน้ากว้างเกิน ต้องเลื่อนขวาดู (เจ้าของระบบ แจ้ง 2026-10-03) — จำกัดความกว้างไว้แล้วให้ตัดขึ้น
   บรรทัดใหม่แทน ดู auditListHtml ฝั่ง JS ที่พับรายการยาวไว้ใน <details> ด้วยอีกชั้น */
td.audit-detail { white-space: normal; text-align: left; max-width: 360px; word-break: break-word; }
tbody tr:nth-child(even) td { background: var(--zebra); }
thead th { background: #faf7ef; color: var(--gray); font-weight: 600; position: sticky; top: 0; z-index: 1; }
tr.level-danger td.stockcell { background: var(--red-light); color: var(--red); font-weight: 700; }
tr.level-warning td.stockcell { background: var(--yellow-light); color: var(--yellow); font-weight: 700; }
tr.level-ok td.stockcell { color: var(--green); font-weight: 600; }

td.freeze, th.freeze {
  position: sticky; left: 0; background: #fff; z-index: 2;
  box-shadow: 2px 0 4px -2px rgba(0,0,0,0.15);
  white-space: normal; max-width: 140px;
}
thead th.freeze { background: #faf7ef; z-index: 3; }
tbody tr:nth-child(even) td.freeze { background: var(--zebra); }

.year-table th, .year-table td { border-right: 1px solid var(--border); }
.year-table thead tr:first-child th:not(.freeze) { text-align: center; }
.year-table th.month-end, .year-table td.month-end { border-right: 2px solid var(--gray); }
.year-table th:last-child, .year-table td:last-child { border-right: none; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; max-width: 100%; }
.filters > * { flex: 1 1 120px; min-width: 0; max-width: 100%; }
/* มือถือจอแคบ (เจ้าของระบบ แจ้ง 2026-10-03 ว่าหลายหน้ารายงานล้นจอบน Safari iPhone) — select/input วันที่ของ Safari
   บางรุ่นมีความกว้างขั้นต่ำภายในที่ไม่ยอมหดตาม flex-shrink/min-width:0 เหมือน browser อื่น ถ้ามี 2 ช่องอยู่แถว
   เดียวกันบนจอแคบมากๆ อาจดันล้นออกนอกจอได้เล็กน้อย — ให้แถวตัวกรองวางแนวตั้งทีละช่องเสมอบนจอแคบ ตัดปัญหานี้ทั้ง
   หมดโดยไม่ต้องพึ่งการคำนวณความกว้างที่ไว้ใจเบราว์เซอร์แต่ละตัวไม่ได้ (ใช้ร่วมกันทุกหน้ารายงานผ่าน .filters)
   ยังคงวางแถวเดียวกันได้ตามปกติบนจอกว้างกว่านี้เหมือนเดิม (ไม่กระทบ desktop/แท็บเล็ต) */
@media (max-width: 480px) {
  .filters > * { flex-basis: 100%; }
}

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge.in { background: var(--green-light); color: var(--green); }
.badge.out { background: var(--red-light); color: var(--red); }

.center { text-align: center; }
.muted { color: var(--gray); font-size: 13px; }
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: var(--bg); }
.login-box { background: #fff; border-radius: 22px; padding: 32px 26px; width: 100%; max-width: 360px;
  box-shadow: 0 8px 28px rgba(28,43,34,0.10); }
.login-box .logo-badge { width: 52px; height: 52px; border-radius: 16px; background: var(--green);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.login-box h1 { text-align: center; color: var(--text); font-size: 18px; font-weight: 700; margin: 0 0 2px; }
.login-box .sub { text-align: center; color: var(--gray); font-size: 13px; margin-bottom: 18px; }

.checkbox-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.checkbox-list label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); margin: 0; }
.checkbox-list input { width: auto; }

.list-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); gap: 8px; }
.list-row:last-child { border-bottom: none; }
.list-row .main { font-size: 14px; }
.list-row .sub { font-size: 12px; color: var(--gray); }

/* ---------- ไอคอน "?" คำอธิบายเพิ่มเติม ---------- */
.info-tip { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px;
  border-radius: 50%; background: var(--border); color: var(--gray); font-size: 11px; font-weight: 700;
  cursor: help; margin-left: 5px; position: relative; vertical-align: middle; flex: 0 0 auto; user-select: none; }
.info-tip .tip-bubble { display: none; position: absolute; z-index: 20; left: 50%; top: calc(100% + 6px);
  transform: translateX(-50%); background: #2b2f26; color: #fff; font-size: 12px; font-weight: 400;
  line-height: 1.5; padding: 8px 10px; border-radius: 8px; width: max-content; max-width: min(78vw, 320px);
  white-space: normal; text-align: left; box-shadow: 0 4px 14px rgba(0,0,0,0.18); }
.info-tip .tip-bubble a { color: #9fd3ff; }
.info-tip .tip-bubble::before { content: ""; position: absolute; bottom: 100%; left: 50%;
  transform: translateX(-50%); border: 5px solid transparent; border-bottom-color: #2b2f26; }
@media (hover: hover) { .info-tip:hover .tip-bubble { display: block; } }
.info-tip.open .tip-bubble { display: block; }

/* ---------- ตารางรายงานบนมือถือ ----------
   ต้นเหตุจริงของอาการ "ล้นจอ/ตัวเลขโดนตัด" ในรายงาน (เจ้าของระบบ แจ้ง 2026-10-03 จากหน้าสต๊อกฝากขายรายลูกค้า): ทุกช่อง
   ในตารางตั้งไว้ไม่ให้ตัดบรรทัด (nowrap) ชื่อสินค้ายาวๆ ในคอลัมน์แรกจึงดันคอลัมน์ตัวเลขสำคัญ (เช่น "คงเหลือ") ไปอยู่
   นอกจอ ต้องปัดตารางไปทางขวาถึงจะเห็น — บนจอแคบให้คอลัมน์แรก (ชื่อสินค้า/ลูกค้า) และหัวตารางตัดขึ้นบรรทัดใหม่ได้
   ตารางเล็ก (2-4 คอลัมน์) จะพอดีจอทันทีไม่ต้องปัด ส่วนตารางกว้างมาก (เช่นรายงาน 12 เดือน) ยังปัดดูได้ตามเดิม
   ตัวเลขในคอลัมน์อื่นยังไม่ตัดบรรทัดเหมือนเดิม (อ่านง่าย ไม่แตกเป็นสองแถว) */
@media (max-width: 600px) {
  .table-wrap th, .table-wrap td:first-child { white-space: normal; }
  .table-wrap td:first-child, .table-wrap th:first-child { min-width: 7.5em; }
}

/* ---------- จอแคบ (มือถือ) ---------- */
@media (max-width: 420px) {
  .content { padding: 10px; padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
  .card { padding: 12px; }
  table { font-size: 12px; }
  th, td { padding: 7px 7px; }
  td.freeze, th.freeze { max-width: 110px; }
}

/* ================= เฟส 3 (2026-10-03): หน้าตาทันสมัยขึ้น ================= */

/* ---- โครงหน้าระหว่างโหลด (skeleton) แทนข้อความ "กำลังโหลด..." ---- */
.skeleton .sk-title, .skeleton .sk-line, .skeleton .sk-block {
  border-radius: 8px; margin-bottom: 12px;
  background: linear-gradient(90deg, #efe9da 25%, #f8f4ea 37%, #efe9da 63%);
  background-size: 400% 100%; animation: sk-shimmer 1.3s ease-in-out infinite;
}
.skeleton .sk-title { height: 22px; width: 55%; margin-bottom: 18px; }
.skeleton .sk-line { height: 12px; }
.skeleton .sk-block { height: 110px; margin: 18px 0; }
@keyframes sk-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skeleton .sk-title, .skeleton .sk-line, .skeleton .sk-block { animation: none; } }

/* ---- แผงตัวกรองพับได้ (มือถือ) — สร้างโดย enhanceFilters() ใน js/core.js ---- */
.filters-panel { margin-bottom: 10px; }
.filters-toggle { display: flex; align-items: center; gap: 8px; width: 100%; justify-content: flex-start;
  background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.filters-toggle .chev { margin-left: auto; transition: transform .15s ease; }
.filters-panel.open .filters-toggle .chev { transform: rotate(180deg); }
.filters-panel .filters-body { display: none; padding-top: 10px; }
.filters-panel.open .filters-body { display: block; }
.filters-panel .filters:last-child { margin-bottom: 0; }

/* ---- ตารางแสดงเป็นการ์ดบนมือถือ (table.cardify) — ป้ายชื่อช่องมาจาก enhanceCardTables() ---- */
@media (min-width: 601px) { table.audit-table { min-width: 760px; } }
@media (max-width: 600px) {
  .cardify-wrap { overflow-x: visible; }
  table.cardify, table.cardify tbody { display: block; width: 100%; }
  table.cardify thead { display: none; }
  table.cardify tr { display: block; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 6px 12px; margin-bottom: 10px; box-shadow: var(--shadow); }
  table.cardify td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    border: none; border-bottom: 1px dashed var(--border); padding: 7px 0; white-space: normal; text-align: right;
    background: transparent !important; min-width: 0; max-width: none; }
  table.cardify td:last-child { border-bottom: none; }
  table.cardify td:empty { display: none; }
  table.cardify td { padding: 6px 0; font-size: 13px; }
  table.cardify td::before { content: attr(data-label); color: var(--gray); font-weight: 600; font-size: 12px;
    text-align: left; flex: 0 0 auto; max-width: 40%; }
  table.cardify td:not([data-label])::before { content: none; }
  table.cardify td.card-full { display: block; text-align: center; }
  table.cardify td .toolbar { justify-content: flex-end; }
  table.cardify td.audit-detail { display: block; text-align: left; }
  table.cardify td.audit-detail::before { display: block; max-width: none; margin-bottom: 4px; }
  table.cardify .audit-full-table { display: table; }
  table.cardify .audit-full-table tbody { display: table-row-group; }
  table.cardify .audit-full-table tr { display: table-row; border: none; box-shadow: none; padding: 0; margin: 0; background: transparent; }
  table.cardify .audit-full-table th, table.cardify .audit-full-table td { display: table-cell; text-align: left;
    border: 1px solid var(--border); padding: 3px 6px; font-size: 12px; }
  table.cardify .audit-full-table td::before { content: none; }
  table.cardify .audit-full-table tr.audit-changed td { background: var(--yellow-light) !important; }
  /* การ์ดกะทัดรัดของหน้ารายงาน (เจ้าของระบบ 2026-11-07): ช่องแรก = หัวการ์ด · ช่องอื่นเรียง 2 คอลัมน์ ป้ายเล็กอยู่บนค่า
     ช่องที่เป็น "-" (ไม่มีค่า) ไม่แสดง — การ์ดสั้นลงราวครึ่งหนึ่ง */
  table.cardify-auto tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 14px; padding: 9px 12px; margin-bottom: 8px; box-shadow: none; }
  table.cardify-auto td { display: block; border: 0; padding: 3px 0; text-align: left; font-size: 13px; font-variant-numeric: tabular-nums; }
  table.cardify-auto td::before { display: block; max-width: none; font-size: 11px; font-weight: 500; line-height: 1.3; }
  table.cardify-auto td:first-child { grid-column: 1 / -1; font-weight: 600; font-size: 14px; padding-bottom: 5px; margin-bottom: 3px; border-bottom: 1px solid var(--border); }
  table.cardify-auto td:first-child::before { content: none; }
  table.cardify-auto td.card-full, table.cardify-auto td.audit-detail { grid-column: 1 / -1; }
  table.cardify-auto td.cf-empty { display: none; }
  table.cardify-auto td .toolbar { justify-content: flex-start; }
  table.cardify-auto tr.group-row, table.cardify-auto tr.total-row { display: block; }
  table.cardify-auto td.freeze { position: static; max-width: none; box-shadow: none; }
  table.cardify-auto { min-width: 0 !important; }
  /* ช่องหลักของการ์ด (ใส่ class cf-main ที่ td เช่น ยอดเงิน / คงเหลือ) = อยู่ขวาของหัวการ์ด ตัวหนา */
  table.cardify-auto tr:has(> td.cf-main) > td:first-child { grid-column: 1; }
  table.cardify-auto td.cf-main { grid-column: 2; grid-row: 1; text-align: right; font-weight: 700; font-size: 14px; padding-bottom: 5px; margin-bottom: 3px; border-bottom: 1px solid var(--border); }
  table.cardify-auto td.cf-main::before { content: none; }
  table.cardify-auto tr:has(> td.cf-title) > td:first-child { grid-column: auto; font-weight: 400; font-size: 13px; padding: 3px 0; margin: 0; border: 0; }
  table.cardify-auto tr:has(> td.cf-title) > td:first-child::before { content: attr(data-label); }
  table.cardify-auto td.cf-title { grid-column: 1 / -1; grid-row: 1; font-weight: 600; font-size: 14px; padding-bottom: 5px; margin-bottom: 3px; border-bottom: 1px solid var(--border); }
  table.cardify-auto tr:has(> td.cf-main) > td.cf-title { grid-column: 1; }
  table.cardify-auto td.cf-title::before { content: none; }
  /* ตารางรายเดือนบนมือถือ: หัวการ์ด (ชื่อ) ↔ ยอดรวมปี · เดือนที่มีค่าเรียง 4 ช่องต่อแถว · ช่องอื่น (ปีก่อน / ส่งคืน / บาท) 2 ช่องต่อแถว */
  table.cf-pivot tr { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 8px; }
  table.cf-pivot tr > td:first-child { grid-column: 1 / -1; }
  table.cf-pivot tr:has(> td.cf-main) > td:first-child { grid-column: 1 / 4; }
  table.cf-pivot td.cf-main { grid-column: 4; }
  table.cf-pivot td.cf-month { font-size: 12.5px; }
  table.cf-pivot td:not(.cf-month):not(.cf-main):not(:first-child) { grid-column: span 2; }
  table.cf-pivot tr.total-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
  table.cf-pivot tr.total-row td::before { content: none; }
  /* ประวัติรายการ: การ์ด 3 บรรทัด — สินค้า ↔ จำนวน · ประเภท ↔ วันที่ · คู่ค้า ↔ เลขที่ · แตะการ์ด = เปิดรายการ */
  table.log-table tr.log-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; padding: 9px 12px; margin-bottom: 8px; box-shadow: none; cursor: pointer; }
  table.log-table tr.log-row td { display: block; border: 0; padding: 0; text-align: left; font-size: 12px; }
  table.log-table tr.log-row td::before { content: none; }
  table.log-table tr.log-row td.lg-prod { grid-column: 1; grid-row: 1; font-weight: 600; font-size: 14px; }
  table.log-table tr.log-row td.lg-qty { grid-column: 2; grid-row: 1; text-align: right; font-weight: 700; font-size: 14px; white-space: nowrap; }
  table.log-table tr.log-row td.lg-type { grid-column: 1; grid-row: 2; }
  table.log-table tr.log-row td.lg-date { grid-column: 2; grid-row: 2; text-align: right; color: var(--gray); white-space: nowrap; }
  table.log-table tr.log-row td.lg-party { grid-column: 1; grid-row: 3; color: var(--gray); }
  table.log-table tr.log-row td.lg-id { grid-column: 2; grid-row: 3; text-align: right; }
  table.log-table tr.log-row td.lg-bill, table.log-table tr.log-row td.lg-note, table.log-table tr.log-row td.lg-by { grid-column: 1 / -1; color: var(--gray); }
  table.log-table tr.log-row td.lg-bill::before, table.log-table tr.log-row td.lg-note::before, table.log-table tr.log-row td.lg-by::before { content: attr(data-label) " "; font-weight: 500; }
  table.log-table tr.log-row td.lg-u, table.log-table tr.log-row td:empty { display: none; }
  table.log-table tr.log-row td.log-act { grid-column: 1 / -1; text-align: right; padding-top: 4px; margin-top: 2px; border-top: 1px dashed var(--border); }
}
table.log-table .lg-unit { display: none; }
@media (max-width: 600px) { table.log-table .lg-unit { display: inline; font-weight: 500; color: var(--gray); font-size: 12px; } }
table.log-table tr.log-row { cursor: pointer; }
a.log-open { font-size: 12.5px; text-decoration: none; white-space: nowrap; }
/* ปุ่ม Export เล็ก ชิดขวา (เจ้าของระบบ 2026-11-07 — เป็นคำสั่งของตาราง ไม่ควรกินแถวเต็ม) */
button[id$="ExportBtn"], button[id$="Export"] { padding: 6px 12px; font-size: 13px; }
.toolbar:has(> button[id$="ExportBtn"]:only-child), .toolbar:has(> button[id$="Export"]:only-child) { justify-content: flex-end; margin-bottom: 6px; }

/* ---- แถบปุ่มบันทึกบิลติดขอบล่างจอ (เหนือแถบเมนูล่าง) — กดบันทึกได้ทันทีไม่ต้องเลื่อนลงไปหา ---- */
.bill-actions { position: sticky; bottom: calc(62px + max(10px, env(safe-area-inset-bottom))); z-index: 5;
  display: flex; align-items: center; gap: 12px; margin: 16px -16px 0; padding: 12px 16px;
  background: rgba(255,255,255,0.96); border-top: 1px solid var(--border);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.bill-actions .bill-count { font-size: 13px; color: var(--gray); white-space: nowrap; }
.bill-actions button { flex: 1 1 auto; margin: 0; }
@media (max-width: 420px) { .bill-actions { margin: 14px -12px 0; padding: 10px 12px; } }

/* ---- ปุ่ม/การ์ด: ตอบสนองตอนแตะ + เส้นโฟกัสชัดเจนเวลาใช้คีย์บอร์ด ---- */
button, a.secondary, .type-btn { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---- บรรทัดสินค้าในฟอร์มคีย์บิลบนมือถือ: เรียงเป็นการ์ด (สินค้าเต็มแถว / จำนวน + ราคา / หมายเหตุ) ไม่ต้องปัดขวา ---- */
@media (max-width: 600px) {
  table.bill-lines, table.bill-lines tbody { display: block; width: 100%; }
  table.bill-lines thead { display: none; }
  table.bill-lines tr { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: start;
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 10px; background: #fff; }
  table.bill-lines td { display: block; border: none; padding: 0; min-width: 0 !important; width: auto !important;
    white-space: normal; background: transparent !important; text-align: left; }
  table.bill-lines td.lc-product { grid-column: 1 / 3; grid-row: 1; }
  table.bill-lines td.lc-remove { grid-column: 3; grid-row: 1; }
  table.bill-lines td.lc-qty { grid-column: 1; grid-row: 2; }
  table.bill-lines td.lc-note { grid-column: 2 / 4; grid-row: 2; }
  table.bill-lines.has-price td.lc-price { grid-column: 2 / 4; grid-row: 2; }
  table.bill-lines.has-price td.lc-note { grid-column: 1 / 4; grid-row: 3; }
  table.bill-lines .ln_remove { height: 44px; }
}

/* #app เดิมใช้ overflow-x: hidden ซึ่งทำให้ position: sticky ข้างในไม่ทำงาน (แถบบันทึกบิล/หัวตาราง) —
   overflow-x: clip ตัดส่วนเกินเหมือนเดิมแต่ไม่สร้างกล่องเลื่อนใหม่ (เบราว์เซอร์เก่าที่ไม่รองรับใช้ค่าเดิมต่อไป) */
@supports (overflow-x: clip) {
  html, body, #app { overflow-x: clip; }
}

/* ไอคอนเส้นในหัวข้อหน้า (แทนอีโมจิ) */
.section-title .ico { vertical-align: -3px; margin-right: 4px; flex-shrink: 0; }
.group-head { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--green); }

/* audit log: รายละเอียดเต็มของแต่ละแถว (v3.0 รอบ 3) */
.audit-sub { margin-top: 2px; }
.audit-full { margin-top: 6px; }
.audit-full > summary { cursor: pointer; color: var(--blue); font-size: 13px; }
.audit-full-table { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 12px; }
.audit-full-table th, .audit-full-table td { border: 1px solid var(--border, #e5e7eb); padding: 3px 6px; text-align: left; vertical-align: top; word-break: break-word; }
.audit-full-table tr.audit-changed td { background: var(--yellow-light); }
.log-search { display: flex; gap: 8px; margin: 10px 0; }
.log-search input { flex: 1; min-width: 0; }
.msg.info { background: var(--blue-light); color: var(--blue); }
.m-0 { margin: 0; }
.mt-8 { margin-top: 8px; }
.bill-lock-note { margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.bill-header-link { padding: 6px 12px; border-radius: 8px; white-space: nowrap; }
.bh-lines { margin-top: 10px; }
.bh-lines summary { cursor: pointer; color: var(--blue); }
.btn-pad { padding: 8px 14px; border-radius: 8px; }
td.num { text-align: right; white-space: nowrap; }
tr.total-row td { background: var(--green-light); }
.warn-chip { font-size: 11px; color: var(--yellow); white-space: nowrap; }
.scan-row { display: flex; gap: 8px; margin: 0 0 6px; }
.scan-row input { flex: 1; min-width: 0; }
.scan-msg { font-size: 13px; min-height: 18px; margin-bottom: 6px; color: var(--green-dark); }
.mb-8 { margin-bottom: 8px; }

/* ===== ย้ายจาก inline style= (v3.0 รอบ 3) เพื่อปิด 'unsafe-inline' ใน CSP — สร้างอัตโนมัติด้วย tools/convert_styles.py =====
   ใส่ !important เพื่อให้ทับกฎอื่นได้เหมือน inline style เดิม (ยกเว้น property ที่ JS ปรับทีหลัง เช่น display) */
.su-002535 { margin-top: 12px !important; }
.su-02365d { padding-bottom: 4px !important; }
.su-034d12 { opacity: 0.55 !important; padding: 12px 16px !important; }
.su-0fa155 { border: none !important; padding: 0 !important; background: transparent; font-size: 14px !important; }
.su-1386d5 { margin: 0 !important; }
.su-152fc2 { margin-top: 14px !important; background: var(--bg2, #f7f5ef); padding: 12px !important; border-radius: 8px !important; }
.su-18d1b7 { flex-direction: column !important; align-items: stretch !important; border: 1px dashed var(--border) !important; border-radius: 8px !important; padding: 10px !important; }
.su-1a3055 { width: 110px; }
.su-1ab60b { padding: 6px 12px !important; border-radius: 8px !important; font-size: 13px !important; }
.su-26f988 { gap: 8px !important; flex-wrap: wrap !important; align-items: center !important; margin-top: 10px !important; }
.su-2937bf { margin-bottom: 6px !important; }
.su-2cbdcc { margin: 4px 0 4px !important; }
.su-2de001 { color: var(--yellow) !important; font-weight: 700 !important; }
.su-2f01ef { width: 140px; }
.su-3044b6 { font-size: 13px !important; }
.su-304cd5 { gap: 8px !important; }
.su-359f30 { margin-bottom: 12px !important; font-size: 13px !important; }
.su-3645bc { border-top: 1px solid var(--border) !important; margin-top: 10px !important; padding-top: 10px !important; }
.su-36d0ca { margin-top: 8px !important; width: 100%; }
.su-3aa131 { color: var(--red) !important; font-weight: 600 !important; }
.su-3f9f96 { min-width: 0 !important; }
.su-416c26 { padding: 10px 0 !important; }
.su-440e7c { max-height: 220px !important; overflow: auto !important; border: 1px solid var(--border) !important; border-radius: 8px !important; padding: 8px !important; }
.su-483843 { margin-top: 8px !important; font-weight: 700 !important; font-size: 16px !important; }
.su-4a9302 { min-width: 140px !important; }
.su-4b376a { margin-top: 10px !important; font-size: 12px !important; }
.su-4c7048 { margin-top: 4px !important; font-size: 12px !important; }
.su-4c7b29 { margin: 0 0 8px !important; }
.su-4ddbe9 { white-space: nowrap !important; }
.su-4f1589 { width: auto; }
.su-536f83 { color: var(--yellow) !important; }
.su-5371db { margin-top: 10px !important; }
.su-58f8fc { margin-bottom: 16px !important; padding-bottom: 14px !important; border-bottom: 1px solid var(--border) !important; }
.su-5cd105 { flex-shrink: 0 !important; }
.su-633669 { padding: 12px 0 4px !important; }
.su-6360c1 { grid-column: 1/-1 !important; padding: 10px 0 !important; }
.su-684f3e { border: 1px dashed var(--border) !important; border-radius: 8px !important; padding: 10px !important; margin-bottom: 12px !important; }
.su-69e683 { width: 220px; }
.su-6b283c { padding: 10px !important; }
.su-6b9c17 { font-size: 12px !important; }
.su-702a72 { color: var(--red) !important; font-size: 11px !important; margin-top: 2px !important; }
.su-716b3d { padding: 6px 0 !important; }
.su-729192 { width: 130px; }
.su-7a417f { margin: 18px 0 8px !important; }
.su-7e3f61 { padding: 40px !important; color: #6b7280 !important; }
.su-800eb2 { margin: 4px 0 8px !important; color: var(--red) !important; }
.su-81603d { color: var(--red) !important; margin-top: 2px !important; }
.su-8b6852 { font-size: 11px !important; }
.su-8e8697 { margin-bottom: 16px !important; }
.su-923e95 { min-width: 180px !important; }
.su-93de2d { width: 40px; }
.su-941456 { margin-bottom: 14px !important; padding-bottom: 12px !important; border-bottom: 1px solid var(--border) !important; }
.su-959bb5 { gap: 6px !important; }
.su-95be1a { margin: 10px 0 12px !important; }
.su-9a0569 { width: auto; flex: 0 0 auto !important; }
.su-9e3c4c { margin-top: 6px !important; }
.su-a18ac8 { margin-top: 4px !important; }
.su-a7333a { gap: 8px !important; flex-wrap: wrap !important; align-items: center !important; }
.su-a7409f { margin-bottom: 10px !important; }
.su-aca490 { padding: 8px 14px !important; border-radius: 8px !important; }
.su-af1410 { color: var(--yellow) !important; font-size: 12px !important; }
.su-b202c6 { cursor: pointer !important; }
.su-b2c4dc { color: #ffd9a0 !important; font-weight: 700 !important; }
.su-b7d39c { justify-content: flex-end !important; margin-top: 10px !important; }
.su-c7bbb8 { max-height: 260px !important; overflow: auto !important; border: 1px solid var(--border) !important; border-radius: 8px !important; padding: 8px !important; }
.su-c90c50 { gap: 6px !important; margin-top: 8px !important; }
.su-d43169 { margin-top: 8px !important; }
.su-d51702 { margin-bottom: 8px !important; }
.su-d6d39a { min-width: 1080px !important; }
.su-d892c0 { margin-top: 8px !important; font-size: 13px !important; }
.su-e09362 { color: var(--red) !important; }
.su-e10f65 { padding: 6px 12px !important; border-radius: 8px !important; }
.su-e27a38 { margin-top: 4px !important; font-size: 13px !important; }
.su-e396da { font-size: 12px !important; margin-top: 6px !important; }
.su-e9e69a { padding: 4px 8px !important; border-radius: 6px !important; font-size: 12px !important; }
.su-ec0d7a { gap: 6px !important; flex-wrap: nowrap !important; }
.su-eda06f { padding: 6px 10px !important; }
.su-ee0c30 { margin: 16px 0 8px !important; }
.su-f005b8 { margin-top: 2px !important; }
.su-f41bf6 { flex-wrap: wrap !important; gap: 8px !important; }
.su-f49ccb { margin: 4px 0 8px !important; }
.su-f65bbf { color: var(--yellow) !important; margin-top: 2px !important; }
.su-f6e3d7 { text-align: right !important; }
.su-fa3e1c { margin-bottom: 12px !important; }
.su-ff9224 { flex: 1 1 160px !important; }
.switch-row { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 14px; cursor: pointer; }
.switch-row input { width: auto; }
.badge-discontinued { font-size: 11px; background: var(--yellow-light); color: #7a4510; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.list-row.is-discontinued .main { color: var(--gray); }

/* ---- ล็อต / วันหมดอายุ (v3.0 รอบ 4) ---- */
.lc-lot input { margin-bottom: 4px; }
.ln_exp_lbl { display: block; font-size: 11px; }
@media (max-width: 600px) {
  table.bill-lines.has-lot td.lc-lot { grid-column: 2 / 4; grid-row: 2; }
  table.bill-lines.has-lot td.lc-note { grid-column: 1 / 4; grid-row: 3; }
}
.lot-confirm { margin-top: 14px; padding: 12px; border: 2px solid var(--blue); border-radius: var(--radius-sm); background: var(--blue-light); }
.lot-confirm[hidden] { display: none; }
.lot-editor { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 10px; }
.lot-editor.lot-changed { border-color: var(--yellow); box-shadow: 0 0 0 2px var(--yellow-light); }
.lot-head { margin-bottom: 6px; }
.lot-row { display: grid; grid-template-columns: 1fr 96px auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.lot-row select, .lot-row input { margin: 0; min-width: 0; }
.lot-del { padding: 6px 10px; }
.lot-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; font-size: 13px; }
.lot-note-wrap { margin-top: 6px; }
.lot-note-wrap.lot-note-required label::after { content: " *"; color: var(--red); }
.lot-current { font-size: 14px; }
.lot-task-card { border-left: 4px solid var(--blue); }
tr.lot-level-expired td { background: var(--red-light); }
tr.lot-level-soon td { background: var(--yellow-light); }
.lot-level-tag { font-size: 12px; font-weight: 600; }
.lot-consign-list { font-size: 11px; }
@media (max-width: 600px) {
  .lot-row { grid-template-columns: 1fr auto; }
  .lot-row .lot-sel { grid-column: 1 / -1; }
}

/* ---- ช่องล็อตในบรรทัดบิล (v3.0 รอบ 4b) ---- */
[hidden] { display: none !important; }
table.bill-lines td.lc-lot { min-width: 300px; }
.lot-cell { display: flex; flex-direction: column; gap: 4px; }
.lot-sub { display: grid; grid-template-columns: 1fr 84px auto; gap: 6px; align-items: center; }
.lot-sub select, .lot-sub input { margin: 0; min-width: 0; }
.lot-sub .lot-new { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 150px; gap: 6px; }
.lot-sub .lot-del { padding: 6px 10px; }
.lot-cell-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.lot-cell-foot button { padding: 4px 10px; font-size: 12px; }
.lot-line-status { font-size: 12px; }
.lot-line-status.lot-warn { color: #7a4510; font-weight: 600; }
.lot-line-status.lot-err { color: var(--red); font-weight: 700; }
.lot-hint { font-size: 12px; padding: 6px 0; }
@media (max-width: 600px) {
  table.bill-lines.has-lot td.lc-lot { grid-column: 1 / 4; grid-row: 3; min-width: 0; }
  table.bill-lines.has-lot.has-price td.lc-lot { grid-row: 3; }
  table.bill-lines.has-lot td.lc-qty { grid-column: 1 / 4; }
  table.bill-lines.has-lot.has-price td.lc-qty { grid-column: 1; }
  .lot-sub .lot-new { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) { table.bill-lines:not(.has-price) td.lc-qty { grid-column: 1 / 4; } }
table.bill-lines td.lc-lot { min-width: 380px; width: 46%; }
table.bill-lines td.lc-product { min-width: 160px; }
.lot-subs .lot-sub:only-child .lot-del { visibility: hidden; }
@media (max-width: 600px) {
  table.bill-lines td.lc-lot { width: auto; }
  .lot-sub { grid-template-columns: 1fr auto; }
  .lot-sub .lot-sel { grid-column: 1 / -1; }
}

/* ---- ช่องล็อต รอบ 4c: ปุ่มลบเล็ก/ต่างจากปุ่มลบรายการ, ฟอร์มรับเข้าแบบ 3 ช่องเรียงกัน ---- */
button.line-del { background: #fff; color: var(--red); border: 1px solid var(--red-light); border-radius: var(--radius-sm);
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
button.line-del:hover { background: var(--red-light); }
table.bill-lines .ln_remove.line-del { height: 40px; }
button.lot-del { background: transparent; border: none; color: var(--gray); font-size: 20px; line-height: 1;
  width: 28px; height: 28px; padding: 0; border-radius: 50%; cursor: pointer; }
button.lot-del:hover { background: var(--border); color: var(--red); }
.lot-subs .lot-sub:only-child .lot-del { visibility: hidden; }
button.link-btn { background: none; border: none; color: var(--blue); padding: 2px 4px; font-size: 13px; font-weight: 600; cursor: pointer; }
button.link-btn:hover { text-decoration: underline; }
.lot-sub { grid-template-columns: 1fr 84px 28px; }
.lot-cap { display: grid; grid-template-columns: 1fr 120px 76px 28px; gap: 6px; font-size: 11px; color: var(--gray); font-weight: 600; }
.lot-sub.lot-sub-entry { grid-template-columns: 1fr 120px 76px 28px; }
.lot-sub-entry .lot-tag { grid-column: 1 / -1; font-size: 11px; margin-top: -2px; }
.lot-tag.is-old { color: var(--blue); }
.lot-tag.is-new { color: var(--green); }
.lot-sub-entry .lot-exp[readonly] { background: var(--bg); color: var(--gray); }
input.is-invalid { border-color: var(--red) !important; background: var(--red-light); }
/* ช่องวันที่ วว/ดด/ปปปป (core.js enhanceDateInput) — ช่องเดิมของเบราว์เซอร์โปร่งใส ทับไอคอนปฏิทินด้านขวา */
.date-field { position: relative; display: block; width: 100%; }
.toolbar .date-field, .mc-setmonth .date-field { display: inline-block; width: auto; min-width: 150px; }
.date-field .date-text { width: 100%; padding-right: 40px; }
.date-field::after { content: "📅"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; font-size: 16px; opacity: .75; }
.date-field .date-native { position: absolute; right: 0; top: 0; width: 40px; height: 100%; opacity: 0; padding: 0; margin: 0; border: 0; cursor: pointer; }
.date-field .date-native::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
@media (max-width: 600px) {
  .lot-sub { grid-template-columns: 1fr 84px 28px; }
  .lot-sub .lot-sel { grid-column: 1 / -1; }
  .lot-cap, .lot-sub.lot-sub-entry { grid-template-columns: 1fr 1fr 64px 28px; }
  .lot-sub.lot-sub-entry .lot-no { grid-column: auto; }
}
.lot-cell, .lot-cap, .lot-line-status, .lot-tag { text-align: left; }
.lot-cell-foot { justify-content: flex-start; }
/* เหลือบรรทัดเดียวไม่มีปุ่มลบ (ต้องมีอย่างน้อย 1 บรรทัด) */
#billLinesBody tr:only-child .ln_remove { visibility: hidden; pointer-events: none; }
.lot-appr { font-size: 12px; margin-left: 8px; }
.lot-appr-flag { font-size: 12px; color: #7a4510; background: var(--yellow-light); border-radius: 8px; padding: 4px 8px; margin: 2px 0 4px 8px; }

/* ---- รอบ 5: ล็อกสินค้ากับคู่ค้า + ส่วนลดท้ายบิล ---- */
.pp-hint { font-size: 12px; margin: 2px 0 6px; }
.pp-hint:empty { display: none; }
.discount-row { display: grid; grid-template-columns: 160px 1fr; gap: 10px; }
@media (max-width: 600px) { .discount-row { grid-template-columns: 1fr; } }
/* หน้าแก้ไข Supplier/ลูกค้า: แบ่งเป็นการ์ด ไม่พับเก็บ */
.pe-h { margin: 0 0 10px; font-size: 16px; }
.pe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.pe-grid .pe-wide { grid-column: 1 / -1; }
.pe-check { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; font-weight: normal; cursor: pointer; }
.pe-check input { margin-top: 3px; }
.pe-actions { padding-top: 14px; padding-bottom: 14px; }
.pe-actions .toolbar { margin: 0; }
.ppm-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.ppm-tools .ppm-search { flex: 1 1 220px; margin: 0; }
.ppm-tools select { width: auto; margin: 0; }
.ppm-summary { margin: 4px 0 8px; }
.ppm-wrap { max-height: 60vh; overflow: auto; }
.ppm-table { width: 100%; }
.ppm-table thead th { position: sticky; top: 0; background: var(--card, #fff); z-index: 1; }
.ppm-table .ppm-chk { width: 78px; text-align: center; }
.ppm-table .ppm-chk input { width: 20px; height: 20px; margin: 0; }
.ppm-table .ppm-price { width: 130px; }
.ppm-table .ppm-price input { margin: 0; }
.ppm-sub { font-size: 11px; }
.ppm-table .ppm-shelf { width: 140px; }
.ppm-table .ppm-shelf input { margin: 0; }
.ppm-shelf-sub { font-size: 11px; white-space: normal; line-height: 1.3; }
.ppm-shelf-sub .link-btn { font-size: 12px; padding: 0 2px; }
.ppm-table tr.ppm-shelf-changed .ppm-shelf input { border-color: var(--blue); }
.promo-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.promo-filters select, .promo-filters input { width: auto; flex: 1 1 180px; margin: 0; }
.promo-tab-off { opacity: .55; cursor: default; }
.promo-row .sub { white-space: normal; }
.promo-hint { font-size: 12px; margin-top: 2px; }
.promo-err { white-space: pre-line; }
.promo-prod-list { max-height: 50vh; overflow: auto; border: 1px solid var(--line, #e5e1d8); border-radius: 8px; padding: 4px 8px; margin-top: 6px; }
.promo-prod { margin: 4px 0; }
.mc-setmonth { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.mc-setmonth input { width: auto; margin: 0; }
.ci-chk-bad td { background: #fff4f2; }
.ci-chk-sub { font-size: 11px; }
.shelf-eff { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.shelf-eff input { width: auto; margin: 0; }
.no-consign .ppm-consign-col, .no-sell .ppm-off { display: none; }
@media (max-width: 600px) {
  .pe-grid { grid-template-columns: 1fr; }
  .ppm-table .ppm-chk { width: 56px; }
  .ppm-table .ppm-price { width: 96px; }
  .ppm-table .ppm-shelf { width: 110px; }
}
/* สินค้า: ติ๊ก "ขายอยู่" แทนปุ่มยกเลิกขาย */
.active-toggle { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-weight: normal; cursor: pointer; white-space: nowrap; }
.active-toggle input { width: 20px; height: 20px; margin: 0; }
/* หน้าแก้ไขรายการของฉัน: กล่องรายการเดิม */
.my-edit-orig { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin: 4px 0 12px; }
.my-edit-orig .main { font-weight: 600; margin-top: 2px; }
.my-edit-orig .sub { font-size: 13px; color: var(--gray); margin-top: 2px; }
/* รายงานชุดที่ 2 */
.pos-num { color: var(--green); }
.w-80 { width: 80px !important; display: inline-block; margin: 0 4px; }
.inline-label { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-weight: normal; }
tr.group-row td { background: var(--green-light); }
/* สิทธิ์ผู้ใช้แบ่งหมวด */
.perm-groups { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 12px; }
.perm-group { border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.perm-group > summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; font-weight: 600; list-style: none; }
.perm-group > summary::-webkit-details-marker { display: none; }
.perm-group > summary::after { content: "▸"; margin-left: 4px; color: var(--gray); }
.perm-group[open] > summary::after { content: "▾"; }
.perm-group > summary .perm-group-name { flex: 1; }
.perm-group > summary input { width: 20px; height: 20px; margin: 0; }
.perm-group .checkbox-list { padding: 0 12px 10px 42px; }
.rep-vis-group { margin-bottom: 12px; }
.rep-vis-title { font-weight: 600; margin: 6px 0 2px; }
.mt-12 { margin-top: 12px; }
/* 1 บัญชี = 1 เครื่อง */
.session-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin: 10px 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.login-note { font-size: 12px; margin-top: 10px; text-align: center; }

/* Face ID / passkey (v26) */
a.user-chip { color: inherit; text-decoration: none; cursor: pointer; }
.pk-login-btn { width: 100%; margin: 8px 0 4px; }
.pk-login-btn:disabled { opacity: 0.6; cursor: progress; } /* กำลังยืนยันตัวตน — กดซ้ำไม่ได้ (ผลตรวจรอบ 9 B5) */
.pk-or { text-align: center; font-size: 12px; margin: 6px 0 2px; }
.pk-offer { border: 1px solid var(--accent-gold); }
.pk-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.pk-hint { font-size: 12px; margin: 8px 0 4px; text-align: center; }
/* checkbox/radio ไม่ยืดเต็มความกว้าง (กฎ input { width:100% } ทำให้ข้อความถูกดันตกขอบบน iPhone — เจ้าของระบบ 2026-10-06) */
input:where([type="checkbox"], [type="radio"]) { width: auto; flex: 0 0 auto; padding: 0; }
.pe-check > span { min-width: 0; flex: 1 1 auto; }
.pk-diag { font-size: 11px; margin-top: 6px; }

/* คู่มือการใช้งาน (#/help) */
.topbar .help-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 999px;
  background: rgba(255,255,255,0.14); text-decoration: none; font-size: 17px; flex: 0 0 auto; }
.manual .man-body { line-height: 1.75; }
.manual .man-body p { margin: 8px 0; }
.manual .man-h { margin: 18px 0 6px; color: var(--green-dark); }
.manual h2.man-h { font-size: 19px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.manual h3.man-h { font-size: 16px; }
.manual h4.man-h { font-size: 15px; }
.manual .man-list { margin: 6px 0 10px; padding-left: 22px; }
.manual .man-list li { margin: 4px 0; }
.manual .man-sub { margin: 2px 0 0 4px; font-size: 14px; }
.manual .man-note { margin: 10px 0; }
.manual code { background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.manual .man-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0; }
.manual .man-table th, .manual .man-table td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
.manual .man-table th { background: rgba(0,0,0,0.04); }
.manual .man-live { margin: 8px 0; }
.manual .man-live ul { margin: 4px 0; padding-left: 22px; }
.manual .man-live-title { font-weight: 600; margin-top: 8px; }
.manual .man-updated { font-size: 12px; margin-bottom: 6px; }
.manual .man-nav { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.manual .man-search input { width: 100%; }
.manual .man-group { margin-top: 14px; }
.manual .man-group-title { font-weight: 700; margin-bottom: 4px; }
.manual .man-toc-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 8px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.manual .man-toc-item > span:first-child { font-size: 18px; }
.manual .man-snippet { font-size: 12px; margin-top: 2px; }

/* ป้าย รวม/ไม่รวมฝากขาย ข้างชื่อรายงาน */
.scope-chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; margin-left: 8px; vertical-align: middle; white-space: nowrap; }
.scope-incl { background: #e3f2e7; color: #1d6b3a; }
.scope-excl { background: #eceae4; color: #5b5648; }
.scope-only { background: #fff1d6; color: #8a5a00; }
.scope-na { background: #eef2f7; color: #4a5a70; }
/* สถานะเชิงลบ (ยกเลิก / ถูกปฏิเสธ / ยอดไม่ตรง / เกินกำหนด) — แดงชัดเจน */
.scope-bad { background: #fde2e1; color: #b42318; }

/* นำเข้าไฟล์ตัดขายฝากขาย + รายงานตัดขาย */
td.num, th.num { text-align: right; white-space: nowrap; }
.ci-row { display: block; text-decoration: none; color: inherit; }
.ci-price { width: 120px; text-align: right; }
.cs-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.cs-tabs button { padding: 6px 12px; font-size: 13px; width: auto; flex: 0 0 auto; }
.ci-format summary { cursor: pointer; }

/* งานค้างที่ต้องตรวจ: ปุ่มหัวการ์ดเรียงแนวนอน */
.hdr-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hdr-actions > *, .hdr-actions > button.primary, .hdr-actions > a.secondary { width: auto; flex: 0 0 auto; margin: 0; }

/* เช็คยอดบิล: หมายเหตุสินค้าที่ยังไม่มีราคา — ตัวเล็ก จาง ตัดบรรทัดได้ */
td.pc-note { font-size: 12px; color: var(--muted, #888); min-width: 220px; white-space: normal; }

/* งานค้าง: แถวบิลกดเข้าไปดูรายละเอียดได้ */
a.pc-link { display: block; flex: 1; color: inherit; text-decoration: none; }
a.pc-link:hover .main { text-decoration: underline; }
.text-warn { color: var(--yellow, #b7791f); }
.text-ok { color: var(--green, #2f855a); }
/* ฟอร์มโปร: ช่องตัวเลขในประโยค */
.promo-sentence { font-size: 17px; line-height: 2.4; }
.promo-sentence .promo-num { display: inline-block; width: 90px; margin: 0 6px; text-align: center; }

/* ยอดขายรายบิล: หัวคอลัมน์กดเรียง / แถวกดดูบิล */
th.sb-sort { cursor: pointer; user-select: none; white-space: nowrap; }
tr.sb-row { cursor: pointer; }
tr.sb-row:hover td { background: var(--hover, rgba(0,0,0,0.03)); }
.hidden { display: none !important; }
/* ลิงก์ที่ทำหน้าที่เป็นปุ่มหลัก (เช่น แถบที่เลือกอยู่) */
a.primary { background: var(--green); color: #fff; border: 1px solid var(--green); padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; text-decoration: none; display: inline-block; white-space: nowrap; }
.cs-tabs a { width: auto; flex: 0 0 auto; }

/* แถวคั่นวัสดุ + ยอดรวมย่อย (เจ้าของระบบ 2026-10-15) */
tr.mat-sep td { background: #f3ede0; border-top: 2px solid var(--border); }
tr.subtotal-row td { background: #faf6ec; font-size: 13px; }

/* สรุปยอดบิลขายคีย์ราคา: รวม / ส่วนลดท้ายบิล / ก่อน VAT / VAT / ยอดรวม (decisions.md 2026-11-16) */
.bill-sum { margin: 12px 0 4px; max-width: 460px; margin-left: auto; padding: 10px 14px; }
.bill-sum-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; }
.bill-sum-row label { margin: 0; font-weight: normal; }
.bill-sum-row input { width: 140px; text-align: right; margin: 0; }
.bill-sum-total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; font-size: 16px; }
.ed-row { margin-bottom: 6px; }
.ed-pct-wrap { display: flex; gap: 6px; align-items: center; }
.ed-pct-wrap input { flex: 1 1 auto; }
.ed-pct-wrap button { flex: 0 0 auto; width: auto; padding: 8px 12px; }

/* ที่มาของตัวเลขในหน้าเช็คยอดบิล: ✍️ ผู้คีย์กรอก / 🧮 ระบบคำนวณ / 🔒 ตั้งไว้ในระบบ (เจ้าของระบบ 2026-10-16) */
.src-legend { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.src-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.src-user { background: #e3eefb; color: #1f5fa8; }
.src-sys { background: #eee8d8; color: #5a5446; }
.src-set { background: #efe6f6; color: #6b3f93; }
.src-user-txt { color: #1f5fa8; font-weight: 600; }
table.pc-sum tr.row-user td { color: #1f5fa8; }
table.pc-sum tr.row-key td { background: #f6f1e4; }
.pc-how { font-size: 11.5px; color: var(--gray); margin-top: 2px; font-weight: normal; }

/* ---- ใบสั่งซื้อ (PO) — migrate_v37 ---- */
.po-lines select { min-width: 220px; }
.po-row { align-items: flex-start; }
.po-row-main { flex: 1 1 auto; min-width: 0; }
.po-row-acts { flex-wrap: wrap; justify-content: flex-end; }
.po-lines input { margin: 0; max-width: 130px; }
.po-totals { font-size: 14px; }
.po-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.po-pick select { flex: 1 1 260px; margin: 0; }
.po-doc { background: #fff; color: #111; padding: 24px; font-size: 13px; line-height: 1.45; }
.po-doc-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #222; padding-bottom: 10px; }
.po-doc-coname { font-size: 18px; font-weight: 700; }
.po-doc-title { text-align: right; font-size: 22px; font-weight: 700; }
.po-doc-small { font-size: 12px; font-weight: 400; }
.po-doc-sku { color: #555; font-size: 11px; }
.po-pre { white-space: pre-line; }
.po-doc-meta { display: flex; justify-content: space-between; gap: 16px; margin: 12px 0; }
.po-doc-right { text-align: right; }
.po-doc-table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.po-doc-table th, .po-doc-table td { border: 1px solid #999; padding: 4px 6px; }
.po-doc-table th { background: #f0f0f0; }
.po-doc-table th:nth-child(2), .po-doc-table td:nth-child(2) { text-align: left; }
.po-doc-sum { margin-left: auto; width: 320px; max-width: 100%; }
.po-doc-sum > div { display: flex; justify-content: space-between; padding: 2px 0; }
.po-doc-grand { font-weight: 700; border-top: 1px solid #222; border-bottom: 3px double #222; }
.po-doc-sign { display: flex; justify-content: space-around; text-align: center; margin-top: 48px; }
@media print {
  .topbar, .bottomnav, .no-print, .help-btn { display: none !important; }
  html, body, #app, .content { height: auto !important; max-height: none !important; overflow: visible !important; } /* โครงจอมือถือ (app-shell) ไม่ตัดหน้าพิมพ์ */
  body, .content { background: #fff !important; padding: 0 !important; margin: 0 !important; }
  .po-doc-card { box-shadow: none !important; border: none !important; padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .po-doc { padding: 0; }
}

/* รายงานกำไรขั้นต้น: ขั้นการคำนวณ (migrate_v40) */
.gp-steps { display: grid; gap: 4px; max-width: 640px; margin: 8px 0; }
.gp-steps > div { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.gp-steps > div b { text-align: right; white-space: nowrap; }
.gp-steps .gp-sub, .gp-steps .gp-total { border-top: 1px solid var(--border, #ddd); padding-top: 4px; }
.gp-steps .gp-total { font-size: 1.05em; }
.mct-box summary { cursor: pointer; }

/* ตัวเลขที่ดูวิธีคำนวณได้ (calcTip) — เส้นประใต้ตัวเลข · บับเบิลลอยตามจอ (position: fixed — ไม่ถูกตัดในตาราง) */
.calc-tip { border-bottom: 1px dotted currentColor; cursor: help; position: relative; }
.calc-tip .calc-bubble { display: none; position: fixed; left: 0; top: 0; z-index: 60; width: max-content; max-width: min(90vw, 380px);
  background: #2b2f26; color: #fff; font-size: 12px; font-weight: 400; line-height: 1.55; padding: 8px 10px; border-radius: 8px;
  text-align: left; white-space: normal; box-shadow: 0 4px 14px rgba(0,0,0,0.18); }
.calc-tip .calc-bubble b { font-weight: 700; color: #fff; }
.calc-tip .calc-bubble::before { display: none; }
.calc-tip .calc-bubble div { margin-top: 2px; }
.calc-tip.open .calc-bubble { display: block; }
/* แถบปุ่มเรียงรายการในหน้าตั้งค่า (สินค้า/Supplier/ลูกค้า) */
.ml-sort { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; }
.ml-sort button { width: auto; flex: 0 0 auto; padding: 4px 12px; font-size: 13px; }
/* ตารางที่คอลัมน์ส่วนใหญ่เป็นข้อความ (ชื่อ / เลขที่ / เหตุผล) — ชิดซ้าย ยกเว้นช่องตัวเลข .num */
.tbl-left th, .tbl-left td { text-align: left; }
.tbl-left th.num, .tbl-left td.num { text-align: right; }
/* inbox (inbox.js) — ปุ่มกล่องงานมุมบน + รายการแบบกล่องจดหมาย */
.topbar .inbox-btn { position: relative; }
.topbar .inbox-btn .pending-badge { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 999px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center; line-height: 1; }
.ib-row { display: flex; gap: 10px; align-items: flex-start; text-decoration: none; color: inherit; }
.ib-row .ib-ico { flex: 0 0 auto; font-size: 18px; line-height: 1.4; }
.ib-row .ib-body { flex: 1 1 auto; min-width: 0; }
.ib-row .ib-when { flex: 0 0 auto; font-size: 12px; color: var(--muted, #888); white-space: nowrap; }
.ib-row.ib-unread .main { font-weight: 700; }
.ib-row.ib-unread .ib-ico::after { content: "•"; color: var(--red); margin-left: 2px; }
.ib-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.ib-tools select, .ib-tools input { width: auto; flex: 1 1 160px; min-width: 0; max-width: 100%; }
.ib-done { border-left: 4px solid var(--green); padding-left: 10px; margin: 8px 0; }
.ib-reply { border-left: 4px solid var(--border); padding-left: 10px; }
.ib-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.ib-chip { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border); text-decoration: none; color: inherit; font-size: .9em; white-space: nowrap; }
.ib-chip.on { background: var(--green); border-color: var(--green); color: #fff; }
.ib-next { font-weight: 600; }
/* หน้าเรื่องในกล่องงานแบบหน้าเอกสาร (inbox_item.js · decisions.md 2026-11-15): หัว → ข้อมูลเป็นช่อง → ตาราง → แถบปุ่ม */
.op-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.op-title { min-width: 0; }
.op-kicker { font-size: .85em; color: var(--muted, #888); margin-bottom: 2px; }
.op-chips { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin: 8px 0 4px; font-size: .9em; }
.op-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 20px; margin: 12px 0 4px; padding: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.op-fact { min-width: 0; }
.op-fact dt { font-size: .8em; color: var(--muted, #888); margin: 0 0 2px; }
.op-fact dd { margin: 0; overflow-wrap: anywhere; }
.op-sec { margin-top: 12px; }
.op-h { margin: 0 0 4px; font-size: 1em; }
.op-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.op-actions > button, .op-actions > a { flex: 0 1 auto; width: auto; min-width: 140px; margin: 0; padding: 12px 18px; font-size: 1rem; min-height: 46px; justify-content: center; text-align: center; }
.op-note { color: var(--muted, #888); }
.op-more { margin-left: auto; position: relative; }
.op-more > summary { list-style: none; cursor: pointer; padding: 8px 14px; border: 1px solid var(--border); border-radius: 10px; font-weight: 700; line-height: 1; }
.op-more > summary::-webkit-details-marker { display: none; }
.op-more-body { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 5; display: flex; flex-direction: column; gap: 6px; padding: 8px; min-width: 200px; background: var(--card, #fff); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.op-more-body > * { width: 100%; text-align: center; justify-content: center; }
.op-more-body { max-width: calc(100vw - 32px); max-height: 70vh; overflow-y: auto; } /* ไม่ล้นจอมือถือ (decisions.md 2026-11-22 ข้อ 7) */
@media (max-width: 640px) { .op-head { flex-direction: column-reverse; gap: 8px; } .op-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; } .op-actions > button, .op-actions > a { flex: 1 1 140px; } }
/* กล่องงานแบบการ์ด + การ์ดกลุ่ม + กระดิ่ง (decisions.md 2026-11-13) */
.topbar .inbox-btn { position: relative; }
.ib-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.ib-group { display: block; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; text-decoration: none; color: inherit; background: var(--card, #fff); }
.ib-group .lbl { font-weight: 600; }
.ib-group .num { font-size: 1.6em; font-weight: 700; line-height: 1.2; }
.ib-group .sub { font-size: .85em; color: var(--muted, #888); }
.ib-group.late { border-color: var(--red); }
.ib-group.on { outline: 2px solid var(--green); }
.ib-sec { margin: 14px 0 6px; font-size: 1em; }
.ib-cards { display: flex; flex-direction: column; gap: 8px; }
.ib-card { border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: 10px; padding: 9px 11px; background: var(--card, #fff); }
.ib-card.ib-late { border-left-color: var(--red); }
.ib-card.ib-unread .ib-card-title { font-weight: 700; }
.ib-card.ib-unread .ib-ico::after { content: "•"; color: var(--red); margin-left: 2px; }
.ib-card > a, a.ib-card { display: block; text-decoration: none; color: inherit; }
.ib-card-top { display: flex; gap: 8px; align-items: flex-start; }
.ib-card-top .ib-ico { flex: 0 0 auto; font-size: 18px; line-height: 1.4; }
.ib-card-title { flex: 1 1 auto; min-width: 0; }
.ib-card-top .ib-when, .ib-card-top .scope-chip { flex: 0 0 auto; white-space: nowrap; }
.ib-card-top .ib-when { font-size: 12px; color: var(--muted, #888); }
.ib-card .sub { margin-top: 2px; }
.ib-card-acts { margin-top: 6px; }
.ib-card-src:not(:empty) { margin-top: 6px; border-top: 1px dashed var(--border); padding-top: 6px; }
.ib-group .late-n { display: none; color: var(--red); font-weight: 600; font-size: .85em; }
@media (max-width: 640px) { .ib-groups { gap: 6px; } .ib-group { padding: 8px; } .ib-group .lbl { font-size: .85em; } .ib-group .sub { display: none; } .ib-group .late-n { display: block; } }
.ib-members { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0; }
.ib-members label { display: inline-flex; align-items: center; gap: 6px; font-weight: normal; margin: 0; }
.ib-members input { width: auto; }

/* ============ หน้าหลักแบบแดชบอร์ด + เมนูแบบรายการ (เจ้าของระบบเลือกโครงหน้าแบบ 1 + 2 — 2026-10-27) ============ */
.text-bad { color: var(--red); font-weight: 600; }
/* ไอคอนสีในการ์ด / แถว — สีตามความหมาย (เขียว = ขาย · ฟ้า = ซื้อ/สต๊อก · เหลือง = รับเงิน · แดง = ต้องจ่าย/หมด) */
.dash-ico { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; }
.dash-ico .ico { display: block; }
.tone-green { background: linear-gradient(135deg, #4ade80, #16a34a); }
.tone-blue { background: linear-gradient(135deg, #7dd3fc, #2563eb); }
.tone-amber { background: linear-gradient(135deg, #fcd34d, #f59e0b); }
.tone-purple { background: linear-gradient(135deg, #c4b5fd, #7c3aed); }
.tone-red { background: linear-gradient(135deg, #fda4af, #e11d48); }
.tone-teal { background: linear-gradient(135deg, #5eead4, #0d9488); }

.dash-hello { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 2px 12px; }
.dash-hello h2 { margin: 0; font-size: 19px; line-height: 1.3; }
.dash-hello .muted { margin-top: 2px; }
.dash-hello .dash-add { white-space: nowrap; flex-shrink: 0; text-decoration: none; }
.dash-kpis { margin-bottom: 12px; }
.dash-kpis .kpi { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash-kpis .kpi .dash-ico { margin-bottom: 8px; }
.dash-kpis .kpi .num { font-size: 21px; color: var(--text); overflow-wrap: anywhere; }
.dash-kpis .kpi.warn .num { color: var(--yellow); }
.dash-kpis .kpi .sub { font-size: 11.5px; }
.skeleton-kpi { min-height: 122px; background: linear-gradient(90deg, #f4f1e8, #fbf9f3, #f4f1e8); background-size: 200% 100%; animation: sk-shine 1.2s infinite linear; }
@keyframes sk-shine { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.card .sub.muted { font-size: 12px; margin: 2px 0 6px; }

/* แถวรายการในการ์ด (ต้องจัดการ / สินค้าขายดี / ลูกค้า / รายการล่าสุด) */
.dash-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; min-width: 0; }
.dash-row:last-child { border-bottom: none; }
.dash-row-text { flex: 1; min-width: 0; }
.dash-row-text .main { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-row-text .sub { font-size: 11.5px; color: var(--gray); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-row-val { font-size: 13.5px; font-weight: 700; text-align: right; white-space: nowrap; flex-shrink: 0; }
/* ตัวเลขทุกหลักกว้างเท่ากัน — ฟอนต์ Prompt ไม่มีตัวเลขแบบกว้างเท่ากัน ("1" แคบกว่า "8" → ยอดแต่ละบรรทัดดูเล็กใหญ่ไม่เท่ากัน)
   จึงใช้ Inter (มีตัวเลขกว้างเท่ากัน) กับตัวเลข · ตัวอักษรไทยที่ Inter ไม่มี ใช้ Prompt ต่อเอง (เจ้าของระบบ 2026-10-28) */
.dash-row-val, .dash-kpis .num, .dash-kpis .sub, .dash-legend .calc-tip, .dash-chart .sub { font-family: 'Inter', var(--font); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
@media (hover: hover) { a.dash-row:hover .main { color: var(--green); } }

/* ---------- หน้าสต๊อกคงเหลือแบบแดชบอร์ด (reports.js pageReportStock — 2026-10-28) ----------
   การ์ดสรุป (กดแล้วกรอง) · ค้นหา + ปุ่มกรองสถานะ · แถบสีซ้ายของแถว + ป้ายสถานะ · แถบ "พอขายอีก" · ตัวเลขฟอนต์ Inter กว้างเท่ากัน */
/* ---- หน้าสต๊อกคงเหลือ แบบ list report (เจ้าของระบบ 2026-11-06 · decisions.md): หัวกระทัดรัด → แถบกรอง → ปุ่มสถานะ+จำนวน → รายการ
   จอกว้าง = ตาราง · จอแคบ (< 760px) = แถวเป็นการ์ด ไม่มีการเลื่อนซ้าย-ขวา ---- */
/* ---- ส่วนกลางหน้ารายงาน (เจ้าของระบบ 2026-11-07 · decisions.md): ลิงก์กลับเล็กๆ เหนือชื่อรายงาน แทนปุ่มใหญ่ "← กลับเมนูรายงาน" ---- */
a.rp-back { display: block; font-size: 12.5px; color: var(--gray); text-decoration: none; margin-bottom: 2px; }
.toolbar > a.rp-back { order: -1; flex-basis: 100%; margin-bottom: -6px; }
a.rp-back:hover { color: var(--green); }
.tip-bubble .tip-scope { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.filters-toggle .ft-label { flex: 0 0 auto; }
.filters-toggle .ft-sum { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--green); background: var(--green-light); padding: 2px 9px; border-radius: 999px; }
.sr-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.sr-head .sr-h { margin: 0; }
.sr-asof { margin: 2px 0 12px; font-size: 12.5px; }
.sr-filterbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; }
.sr-filterbar input, .sr-filterbar select, .sr-filterbar button { width: auto; margin: 0; padding-top: 7px; padding-bottom: 7px; }
.sr-filterbar .sr-search { flex: 1 1 200px; min-width: 0; }
.sr-date { display: flex; align-items: center; gap: 6px; font-size: 13px; margin: 0; white-space: nowrap; flex: 0 0 auto; }
.sr-date .date-field { width: 160px; }
.sr-date .date-field .date-text { padding-top: 7px; padding-bottom: 7px; }
.sr-sort { display: flex; gap: 6px; align-items: center; }
.sr-sort button { white-space: nowrap; }
.sr-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
button.sr-chip { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--border); color: var(--text); border-radius: 999px; padding: 5px 6px 5px 12px; font-size: 13px; cursor: pointer; }
button.sr-chip .sr-cnt { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--border); color: var(--text); font-size: 12px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
button.sr-chip.sr-alert.st-out .sr-cnt, button.sr-chip.sr-alert.st-danger .sr-cnt { background: var(--red); color: #fff; }
button.sr-chip.sr-alert.st-warning .sr-cnt { background: #f59e0b; color: #fff; }
button.sr-chip.active { background: var(--green); border-color: var(--green); color: #fff; }
button.sr-chip.active .sr-cnt { background: rgba(255,255,255,0.25); color: #fff; }
.sr-tablebar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 6px; }
.sr-countline { font-size: 12.5px; }
.sr-tablebar button { padding: 5px 12px; font-size: 12.5px; margin: 0; }
.sr-wrap { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.sr-table { width: 100%; border-collapse: collapse; }
.sr-table th, .sr-table td { white-space: normal; vertical-align: top; }
.sr-table th { white-space: nowrap; }
.sr-table td.sr-num, .sr-table td.sr-st { white-space: nowrap; }
.sr-table th.sr-num, .sr-table td.sr-num { text-align: right; }
.sr-table tbody tr.sr-row td { border-top: 1px solid var(--border); }
.sr-table tbody tr.sr-row:hover td { background: var(--bg); }
.sr-table td.sr-name { box-shadow: inset 4px 0 0 transparent; padding-left: 12px; }
.sr-table tr.st-out td.sr-name, .sr-table tr.st-danger td.sr-name { box-shadow: inset 4px 0 0 var(--red); }
.sr-table tr.st-warning td.sr-name { box-shadow: inset 4px 0 0 #f59e0b; }
.sr-title { font-weight: 600; line-height: 1.35; }
.sr-meta { font-size: 11.5px; margin-top: 1px; }
.sr-qty b { font-size: 15px; }
.sr-order { font-size: 11.5px; margin-top: 2px; }
.sr-table tr.mat-sep td { background: var(--bg); }
@media (max-width: 759px) {
  .sr-filterbar { padding: 8px; }
  .sr-filterbar .sr-search { flex-basis: 100%; }
  .sr-date .sr-date-lbl { display: none; }
  .sr-date .date-field { width: 128px; }
  .sr-date .date-field .date-text { padding-left: 9px; padding-right: 28px; font-size: 14px; }
  .sr-date .date-field::after { right: 7px; font-size: 14px; }
  .sr-sort select { padding-left: 9px; padding-right: 4px; font-size: 14px; }
  .sr-sort { flex: 1 1 0; min-width: 0; }
  .sr-sort select { flex: 1; min-width: 0; }
  .sr-sort button { padding-left: 12px; padding-right: 12px; }
  .sr-sort .sort-dir-txt { display: none; }
  .sr-wrap { border: 0; border-radius: 0; overflow: visible; }
  .sr-table, .sr-table tbody { display: block; }
  .sr-table thead { display: none; }
  .sr-table tbody tr.sr-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: start;
    background: var(--card, #fff); border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: 10px; padding: 9px 11px; margin-bottom: 8px; }
  .sr-table tbody tr.sr-row.st-out, .sr-table tbody tr.sr-row.st-danger { border-left-color: var(--red); }
  .sr-table tbody tr.sr-row.st-warning { border-left-color: #f59e0b; }
  .sr-table tbody tr.sr-row td { display: block; border: 0; padding: 0; background: none !important; box-shadow: none !important; }
  .sr-table td.sr-name { grid-column: 1; grid-row: 1 / span 2; }
  .sr-table td.sr-qty { grid-column: 2; grid-row: 1; text-align: right; }
  .sr-table td.sr-st { grid-column: 2; grid-row: 2; text-align: right; }
  .sr-table td.sr-st .sr-pill { margin-top: 2px; }
  .sr-table td.sr-qty b { font-size: 17px; }
  .sr-table tbody tr.sr-row td.sr-d { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 8px;
    text-align: left; font-size: 12.5px; padding-top: 5px; margin-top: 5px; border-top: 1px dashed var(--border); }
  .sr-table td.sr-d::before { content: attr(data-lbl); color: var(--gray); }
  .sr-table td.sr-d + td.sr-d { border-top: 0; margin-top: 0; padding-top: 2px; }
  .sr-table tbody tr.sr-row td.sr-d.sr-plain, .sr-table tbody tr.sr-row td.sr-d.sr-zero { display: none; }
  .sr-table td.sr-d .sr-meta { flex-basis: 100%; text-align: right; margin-top: 0; }
  .sr-table td.sr-d .sr-order { flex-basis: 100%; text-align: right; }
  .sr-table td.sr-cover .sr-bar { flex-basis: 100%; }
  .sr-table tr.mat-sep, .sr-table tr.sr-empty { display: block; }
  .sr-table tr.mat-sep td, .sr-table tr.sr-empty td { display: block; border-radius: 10px; padding: 8px 10px; margin: 6px 0 8px; }
}
.sr-table .sr-num { font-family: 'Inter', var(--font); font-variant-numeric: tabular-nums; }
.sr-pill { display: inline-block; font-family: var(--font); font-size: 10.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; margin-top: 3px; white-space: nowrap; }
.sr-pill.st-out { background: var(--red); color: #fff; }
.sr-pill.st-danger { background: var(--red-light); color: var(--red); }
.sr-pill.st-warning { background: var(--yellow-light); color: var(--yellow); }
.sr-pill.st-ok { background: var(--green-light); color: var(--green); }
.sr-pill.st-none { background: var(--border); color: var(--gray); }
.sr-cover { min-width: 76px; }
.sr-bar { height: 5px; background: var(--border); border-radius: 99px; margin-top: 4px; overflow: hidden; }
.sr-bar i { display: block; height: 100%; border-radius: 99px; background: #16a34a; }
.sr-bar i.st-out, .sr-bar i.st-danger { background: var(--red); }
.sr-bar i.st-warning { background: #f59e0b; }

/* กราฟแท่งคู่ ยอดขาย-ยอดซื้อ */
.dash-svg { width: 100%; height: auto; display: block; margin-top: 6px; }
.dash-svg .ch-grid { stroke: var(--border); stroke-width: 1; }
.dash-svg .ch-bar-sales { fill: #16a34a; }
.dash-svg .ch-bar-purchases { fill: #f59e0b; }
.dash-svg .ch-label { fill: var(--gray); font-size: 10.5px; font-family: var(--font); }
.dash-legend { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; font-size: 12px; color: var(--gray); margin-top: 6px; }
.dash-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 99px; margin-right: 6px; vertical-align: middle; }
.dash-legend .lg-sales { background: #16a34a; } .dash-legend .lg-purchases { background: #f59e0b; }

/* คอม / แท็บเล็ตแนวนอน: การ์ดแดชบอร์ด 2 คอลัมน์ (การ์ดตัวเลข 2 ใบ ตามค่าเดิมของ .kpi-grid) */
@media (min-width: 760px) {
  .dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: stretch; grid-auto-flow: row dense; margin-bottom: 12px; }
  .dash-cell { min-width: 0; display: flex; flex-direction: column; }
  .dash-cell > .card, .dash-cell > div > .card, .dash-cell > div:only-child { flex: 1; margin-bottom: 0; }
  .dash-cell > .card, .dash-cell > div > .card { height: 100%; box-sizing: border-box; }
  .dash-span-2, .dash-span-3 { grid-column: span 2; }
}
/* จอคอม: grid 3 ช่อง — กว้าง 2 + แคบ 1 ต่อแถว · การ์ดในแถวสูงเท่ากัน (เจ้าของระบบ 2026-11-20) */
@media (min-width: 1000px) {
  .dash-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-span-3 { grid-column: span 3; }
}

/* ---------- เมนูแบบรายการ (แบบ 2): ทุกหน้าเมนูแบบกลุ่ม — บันทึกรายการ / การเงิน / รายงาน / ตั้งค่า ----------
   ไอคอนซ้าย · ชื่อ + คำอธิบาย · ลูกศรขวา · กลุ่มละการ์ด (ใช้ markup เดิม .entry-group / .type-grid / .type-btn — ไม่ต้องแก้ทุกหน้า) */
.entry-group .type-grid { display: block; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 2px 14px; box-shadow: var(--shadow); }
.entry-group .type-btn { display: grid; grid-template-columns: 40px 1fr 14px; grid-template-areas: "ico lbl arr" "ico hint arr"; column-gap: 12px; align-items: center;
  text-align: left; border: none; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; padding: 11px 0; background: transparent; min-height: 58px; }
.entry-group .type-btn:last-child { border-bottom: none; }
.entry-group .type-btn::after { content: "›"; grid-area: arr; color: #b8b3a3; font-size: 20px; line-height: 1; }
.entry-group .type-btn .emoji { grid-area: ico; width: 40px; height: 40px; border-radius: 12px; font-size: 19px; }
.entry-group .type-btn .lbl { grid-area: lbl; font-size: 14px; align-self: end; }
.entry-group .type-btn .rep-hint, .entry-group .type-btn .type-hint { grid-area: hint; align-self: start; margin-top: 1px; font-size: 11.5px; color: var(--gray); line-height: 1.35; }
.entry-group .type-btn:not(:has(.rep-hint, .type-hint)) .lbl { grid-row: 1 / span 2; align-self: center; }
@media (hover: hover) { .entry-group .type-btn:hover { transform: none; box-shadow: none; border-color: var(--border); } .entry-group .type-btn:hover .lbl { color: var(--green); } }
.entry-group .type-btn.has-pending { animation: none; border-color: var(--border); }
.entry-group .type-btn .pending-badge { position: static; grid-area: arr; justify-self: end; box-shadow: none; }
.entry-group .type-btn.has-pending::after { content: ""; }
.entry-group-title { margin: 0 2px 3px; }
/* จอกว้าง 2 คอลัมน์ เรียงซ้าย → ขวา ทีละแถว (เดิม columns = เรียงลงก่อน ทำให้ลำดับดูสลับ / ตัวเดี่ยวไปอยู่ขวา · เจ้าของระบบ 2026-11-23) */
@media (min-width: 900px) { .entry-group .rep-grid, .entry-group .type-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; align-items: stretch; }
  .entry-group .rep-grid > :nth-last-child(2):nth-child(odd) { border-bottom: none; } .entry-group .type-grid > :nth-last-child(2):nth-child(odd) { border-bottom: none; } }
/* กรอบนอกของหน้าเมนูแบบกลุ่มโปร่ง — การ์ดของแต่ละกลุ่มวางบนพื้นหลังหน้า (ไม่ซ้อนการ์ดในการ์ด) */
.content > .card:has(> .entry-group) { background: transparent; border: none; box-shadow: none; padding: 4px 0 0; }
.content > .card:has(> .entry-group) > .toolbar, .content > .card:has(> .entry-group) > h2.section-title { margin-left: 2px; margin-right: 2px; }

/* หน้าต่างยืนยัน (confirmBox ใน core.js) — ใช้แทน confirm() ของเบราว์เซอร์ ปุ่มใหญ่กดง่ายบนมือถือ */
.cf-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.cf-box { background: #fff; border-radius: 16px; padding: 22px 20px 16px; width: 100%; max-width: 340px; box-shadow: 0 12px 40px rgba(0,0,0,0.25); text-align: center; max-height: calc(100dvh - 32px); overflow-y: auto; }
.cf-box .cf-ico { font-size: 30px; line-height: 1; margin-bottom: 8px; }
.cf-box .cf-msg { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.cf-box .cf-sub { font-size: 13px; color: var(--gray); margin-bottom: 16px; white-space: pre-line; }
.cf-box.cf-form { text-align: left; }
.cf-box.cf-form .cf-msg { text-align: center; }
.cf-box .cf-field { display: block; font-size: 13px; color: var(--gray); margin: 10px 0 4px; }
.cf-box.cf-form select, .cf-box.cf-form input { width: 100%; min-height: 44px; }
.cf-box.cf-form .cf-btns { margin-top: 16px; }
.cf-box .cf-btns { display: flex; gap: 10px; }
.cf-box .cf-btns button { flex: 1; height: 44px; font-size: 14.5px; }
.cf-box .cf-ok { background: var(--red); border-color: var(--red); color: #fff; }
/* นับสต๊อก (stock_count.js) */
.sc-pick { max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 8px; }
.sc-table .sc-prod td { background: var(--bg-soft, #f6f3ea); }
.sc-table .sc-qty { width: 110px; text-align: right; }
.sc-table .sc-note { min-width: 120px; }
.sc-table .sc-del { width: auto; padding: 2px 8px; font-size: 12px; margin-left: 6px; }
/* หน้า PO แบบอ่านง่าย (purchase_orders.js · decisions.md 2026-10-28) — ตัวใบพิมพ์ซ่อนจากหน้าจอ ออกตอนพิมพ์ / ดูตัวอย่าง */
.po-print-only { display: none; }
.po-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.po-kpi { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--card, #fff); }
a.po-kpi { display: block; color: inherit; text-decoration: none; }
.rp-kpis { margin-bottom: 10px; }
.rp-kpis .po-kpi b { font-size: 17px; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .rp-kpis { grid-template-columns: 1fr 1fr; gap: 8px; } .rp-kpis .po-kpi b { font-size: 15px; } }
.po-kpi-on { border-color: var(--primary, #3b82f6); box-shadow: inset 0 0 0 1px var(--primary, #3b82f6); }
.pw-pay-body { flex: 1; min-width: 0; }
.po-kpi .lbl { font-size: 12px; color: var(--muted, #888); }
.po-kpi .num { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.po-more > summary { cursor: pointer; color: var(--muted, #888); }
.po-check-ok, .po-history { margin: 4px 4px 12px; font-size: 13px; }
@media (max-width: 560px) { .po-kpis { grid-template-columns: 1fr; } }
@media print { .po-print-only { display: block !important; } }
/* ใบสั่งขาย (sales_orders.js · entry.js) — 2 ทางในฟอร์มขายออก / ส่งฝากขาย */
.so-mode { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 8px; }
.so-mode .pe-check { margin: 0; }

/* ช่องหักมัดจำรายใบ (ฟอร์มรับของ / แก้บิล) */
.dep-cut { width: 130px; flex: none; }
.hidden-awaiting { display: none !important; }

/* รับของ 2 ขั้น — หน้ารอใบกำกับ (receiving.js) */
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.card-inner { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.aw-late .main { color: var(--yellow); }
.aw-close-form { border-left: 3px solid var(--border); padding: 8px 0 8px 12px; margin: 4px 0 8px; }
a.block-link { display: block; text-decoration: none; }
.aw-row { flex-wrap: wrap; gap: 8px; }
.aw-row > label { flex: 1 1 220px; min-width: 0; }

/* หน้ามัดจำ Supplier (payables.js pageSupplierDeposits) — แถวตัดบรรทัดบนจอแคบ · ฟอร์มบันทึกมัดจำใต้แถว */
.dep-row { flex-wrap: wrap; }
.dep-row > div { flex: 1 1 220px; min-width: 0; }
.dep-form { border-left: 3px solid var(--border); padding: 8px 0 8px 12px; margin: 4px 0 8px; }

/* ใบสั่งขายส่งไม่ครบ (entry.js renderSoShortBox) */
.so-short-box { border-color: var(--yellow); }
.so-short-row { padding: 8px 0; border-bottom: 1px solid var(--border); }
.so-short-row:last-child { border-bottom: none; }

/* ปรับหน้าหลัก (เลือกธีม + การ์ด) · หน้าหลักเริ่มต้นตามตำแหน่ง (decisions.md 2026-11-03) */
.de-themes { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.de-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.de-row:last-child { border-bottom: none; }
.de-row .pe-check { margin: 0; flex: 1; min-width: 0; }
.de-move { display: flex; gap: 4px; flex: 0 0 auto; }
.de-move button { width: 34px; height: 30px; padding: 0; margin: 0; }
.dash-kpis .kpi .kpi-txt { min-width: 0; }
/* การ์ดตัวเลขเรียง 4 ใบต่อแถวบนจอกว้าง (หน้าหลักเลือกการ์ดเองได้ — มีได้มากกว่า 2 ใบ) */
@media (min-width: 760px) { .dash-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* iPhone ซูมเข้าเองเมื่อแตะช่องกรอกที่ตัวอักษรเล็กกว่า 16px แล้วค้างซูมไว้ (หน้าดูล้นจอ / หัวหน้าโดนบัง เริ่มจากช่องรหัสผ่านตอนล็อกอิน)
   → จอแคบ / จอสัมผัส ใช้ 16px ทุกช่องกรอก (!important ชนะขนาดที่ตั้งเฉพาะช่อง) · ไม่ปิดการซูมของผู้ใช้ (ผู้ใช้ยังซูมเองได้) */
@media (max-width: 1023px), (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea { font-size: 16px !important; }
}
/* การ์ดตัวเลขหน้าหลักบนมือถือ: ตัวเลขย่อตามความกว้างจอ ไม่ตัดขึ้นบรรทัดกลางยอดเงิน (ยอดหลักสิบล้านยังพอดีการ์ดที่จอ 320px) */
@media (max-width: 759px) {
  .dash-kpis .kpi .num { font-size: clamp(13px, 4.4vw, 21px); }
}

/* กล่องงาน: แถวที่มีตารางรายสินค้า (decisions.md 2026-11-05) */
.w-100 { width: 100%; min-width: 0; }
.list-row.ib-lines { flex-wrap: wrap; align-items: flex-start; }

/* ================= หน้ารายงานแบบ GPT ที่เจ้าของระบบเลือก (2026-11-07 · decisions.md · ต้นแบบ repo ตรวจ design/reports.html) =================
   ใช้เฉพาะหน้ารายงาน (.content.rp-page — markReportPage ใน core.js) · คงสีแบรนด์ --green เดิม · พื้นขาวขึ้นเล็กน้อย เส้นแบ่งเขียวเทา
   ส่วนประกอบเป็นกล่องขาวแยกกัน (หัวข้อ → ขอบเขต → ตัวกรอง → ตัวเลขหลัก → กล่องรายการ) · ความหนาแน่น: html[data-density="compact"] */
:root { --rp-canvas: #f8f6ef; --rp-line: #dce3dc; --rp-line-soft: #edf0eb; --rp-muted: #617167; --rp-ink: #1c2b22; --rp-blue: #245f94;
  --rp-green-soft: #e4f0e6; --rp-warn: #8a5410; --rp-warn-soft: #fff3df; --rp-bad: #ad302c; --rp-bad-soft: #fcecea; --rp-radius: 12px;
  --rp-pad-row: 14px; --rp-pad-cell: 14px; }
html[data-density="compact"] { --rp-pad-row: 9px; --rp-pad-cell: 8px; }
body:has(.content.rp-page) { background: var(--rp-canvas); }
@media (min-width: 900px) { .content.rp-page { max-width: 1240px; } }
/* หน้าไม่มีกรอบใหญ่ — แต่ละส่วนเป็นกล่องของตัวเอง */
.rp-page > .card { background: transparent; border: 0; box-shadow: none; padding: 4px 0 0; }
.rp-page > .card > .table-wrap, .rp-page > .card > .sr-wrap { background: #fff; border: 1px solid var(--rp-line); border-radius: var(--rp-radius); }
/* หัวข้อ */
.rp-page .toolbar.rp-head, .rp-page .sr-head { align-items: center; flex-wrap: wrap; justify-content: flex-start; margin-bottom: 2px; }
.rp-page a.rp-back { color: var(--rp-muted); font-size: 12px; }
.rp-page .toolbar.rp-head > a.rp-back { margin-bottom: 0; }
.rp-page h2.section-title { font-size: 23px; font-weight: 600; letter-spacing: -.3px; color: var(--rp-ink); line-height: 1.3; margin: 0; min-width: 0; flex: 1 1 auto; }
.rp-page h2.section-title > svg.ico { display: none; }
@media (min-width: 760px) { .rp-page h2.section-title { font-size: 27px; } }
.rp-page .info-tip.rp-help { flex: none; width: 32px; height: 32px; font-size: 14px; border: 1px solid var(--rp-line); background: #fff; color: var(--rp-ink); margin-left: auto; }
.rp-page .rp-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 14px; }
.rp-page .rp-meta .scope-chip, .rp-page .sr-head .scope-chip { border-radius: 5px; font-size: 11px; padding: 3px 9px; }
.rp-page .sr-asof { color: var(--rp-muted); }
/* ตัวกรอง (มือถือพับได้ — ป้ายเล็ก + ค่าที่เลือกตัวหนา) */
.rp-page .filters-toggle { text-align: left; border-color: var(--rp-line); border-radius: var(--rp-radius); min-height: 56px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 10px; align-items: center; }
.rp-page .filters-toggle .ft-label { grid-column: 2; font-size: 11px; font-weight: 400; color: var(--rp-muted); line-height: 1.2; }
.rp-page .filters-toggle .ft-sum { grid-column: 2; background: none; color: var(--rp-ink); padding: 0; font-size: 13.5px; font-weight: 600; border-radius: 0; }
.rp-page .filters-toggle .chev { grid-column: 3; grid-row: 1 / span 2; }
.rp-page .filters-toggle > svg:first-child { grid-row: 1 / span 2; }
/* ตัวเลขหลัก — กล่องเดียว แบ่งด้วยเส้น */
/* กล่องตัวเลขหลัก = สีเขียวแบรนด์ (จุดเด่นของหน้า แบบกล่องกำไรขั้นต้น) — สรุปที่เดียวของหน้า */
.rp-page .rp-kpis { gap: 0; border: 0; border-radius: var(--rp-radius); background: var(--green); color: #fff; overflow: hidden; }
.rp-page .rp-kpis .po-kpi { background: transparent; color: #fff; }
.rp-page .rp-kpis .po-kpi .muted { color: #dbe9df; }
.rp-page .rp-kpis .calc-tip { color: inherit; border-bottom-color: rgba(255,255,255,.6); }
.rp-page .rp-kpis .po-kpi { border: 0; border-radius: 0; padding: 14px 16px; }
.rp-page .rp-kpis .po-kpi + .po-kpi { border-left: 1px solid rgba(255,255,255,.22); }
.rp-page .rp-kpis .po-kpi .muted { font-size: 11.5px; }
.rp-page .rp-kpis .po-kpi b { display: block; font-size: 23px; font-weight: 600; letter-spacing: -.4px; margin-top: 2px; }
@media (min-width: 760px) { .rp-page .rp-kpis .po-kpi b { font-size: 28px; } .rp-page .rp-kpis .po-kpi { padding: 16px 20px; } }
@media (max-width: 600px) { .rp-page .rp-kpis:not(.rp-kpis-2) { grid-template-columns: 1fr 1fr; } .rp-page .rp-kpis:not(.rp-kpis-2) .po-kpi:nth-child(odd) { border-left: 0; } .rp-page .rp-kpis:not(.rp-kpis-2) .po-kpi:nth-child(n+3) { border-top: 1px solid rgba(255,255,255,.22); } }
.rp-kpis-2 { grid-template-columns: 1fr 1fr; }
/* คำเตือนพับได้ */
.rp-page .msg.warning, details.rp-warn { border: 1px solid #ead7b4; background: var(--rp-warn-soft); color: var(--rp-warn); border-radius: 8px; }
.rp-page details.rp-warn { margin-bottom: 10px; }
details.rp-warn > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; gap: 8px; align-items: center; min-height: 28px; }
details.rp-warn > summary::-webkit-details-marker { display: none; }
details.rp-warn > summary::after { content: "⌄"; margin-left: auto; font-size: 16px; }
details.rp-warn[open] > summary::after { content: "⌃"; }
details.rp-warn .rp-warn-body { margin-top: 6px; font-size: 13px; }
/* กล่องรายการ: หัวกล่อง (ชื่อรายการ · จำนวน · CSV) ติดกับตาราง */
.rp-tablebar { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; flex-wrap: wrap; }
.rp-tablebar .rp-list-h { font-weight: 600; font-size: 15px; }
.rp-tablebar .muted { font-size: 12.5px; }
.rp-tablebar button { margin: 0 0 0 auto; }
.rp-page .rp-tablebar { background: #fff; border: 1px solid var(--rp-line); border-bottom: 0; border-radius: var(--rp-radius) var(--rp-radius) 0 0; padding: 12px 14px; }
.rp-page .rp-tablebar + .table-wrap { border-radius: 0 0 var(--rp-radius) var(--rp-radius) !important; margin-top: 0; }
.rp-wait { display: inline-block; font-size: 12px; font-weight: 600; color: var(--rp-warn); margin-right: 6px; }
.rp-wait-amt { display: none; } /* บิลที่ทุกบรรทัดยังไม่มีราคา: แสดง "รอราคา" แทน 0.00 */
/* ตารางจอกว้าง: พื้นขาว หัวตารางเทาเขียวอ่อน เส้นคั่นบาง ไม่มีสลับสีแถว */
@media (min-width: 601px) {
  .rp-page > .card > .table-wrap > table { border-collapse: collapse; }
  .rp-page > .card > .table-wrap > table > thead th { background: #f6f8f5; color: var(--rp-muted); font-weight: 400; font-size: 12.5px; border-bottom: 1px solid var(--rp-line); padding: 11px var(--rp-pad-cell); }
  .rp-page > .card > .table-wrap > table > tbody > tr > td { background: #fff; border-bottom: 1px solid var(--rp-line-soft); padding: var(--rp-pad-cell); }
  .rp-page > .card > .table-wrap > table > tbody > tr:last-child > td { border-bottom: 0; }
  .rp-page > .card > .table-wrap > table > tbody > tr:hover > td { background: #f8faf7; }
  .rp-page > .card > .table-wrap > table > tbody > tr.total-row > td, .rp-page > .card > .table-wrap > table > tbody > tr.subtotal-row > td { background: var(--rp-green-soft); }
  .rp-page > .card > .table-wrap > table > tbody > tr.group-row > td, .rp-page > .card > .table-wrap > table > tbody > tr.mat-sep > td { background: #f4f7f2; }
  .rp-page > .card > .table-wrap > table td.freeze, .rp-page > .card > .table-wrap > table th.freeze { box-shadow: none; }
  .rp-page tr.rp-doc-row { cursor: pointer; }
}
/* กำไรขั้นต้น: กล่องเขียวยอดหลัก + ขั้นคำนวณ */
.rp-fin { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 12px 0; }
@media (min-width: 760px) { .rp-fin { grid-template-columns: 1fr 1.6fr; } }
.rp-fin-total { background: var(--green); color: #fff; border-radius: var(--rp-radius); padding: 20px 22px; }
.rp-fin-lbl, .rp-fin-sub { color: #dbe9df; font-size: 12px; }
.rp-fin-val { font-size: 32px; font-weight: 600; letter-spacing: -.6px; line-height: 1.3; margin: 4px 0; font-variant-numeric: tabular-nums; }
@media (min-width: 760px) { .rp-fin-val { font-size: 38px; } }
.rp-fin-total .calc-tip { color: inherit; border-bottom-color: rgba(255,255,255,.6); }
.rp-fin-total .neg-num, .rp-fin-total .text-bad, .rp-page .rp-kpis .neg-num { color: #ffd9d3; }
.rp-waterfall.gp-steps { background: #fff; border: 1px solid var(--rp-line); border-radius: var(--rp-radius); padding: 8px 18px; margin: 0; max-width: none; gap: 0; }
.rp-waterfall.gp-steps > div { padding: 9px 0; font-size: 13.5px; }
.rp-waterfall.gp-steps > div + div { border-top: 1px solid var(--rp-line-soft); }
.rp-waterfall.gp-steps .gp-sub, .rp-waterfall.gp-steps .gp-total { color: var(--green); font-weight: 600; }
/* ป้ายประเภทสีอ่อนสีเดียว (สีแดงใช้กับปัญหาเท่านั้น) */
.rp-page .badge, .rp-m-badge { background: #edf2f7; color: #47607a; border: 0; font-weight: 500; border-radius: 4px; font-size: 11px; padding: 2px 7px; }
.rp-page td.rp-c-type .rp-m-badge { background: none; color: inherit; padding: 0; font-size: inherit; }
@media (max-width: 600px) {
  .rp-page td.rp-c-type .rp-m-badge { background: #edf2f7; color: #47607a; padding: 1px 7px; font-size: 11px; }
  /* กล่องรายการเดียว มีเส้นคั่น */
  table.cardify-auto > tbody, table.log-table > tbody { background: #fff; border: 1px solid var(--rp-line); border-radius: var(--rp-radius); overflow: hidden; }
  .rp-page .rp-tablebar + .table-wrap table.cardify-auto > tbody { border-radius: 0 0 var(--rp-radius) var(--rp-radius); }
  .rp-page > .card > .table-wrap { background: transparent; border: 0; }
  table.cardify-auto > tbody > tr, table.log-table > tbody > tr.log-row { border: 0; border-radius: 0; margin: 0; box-shadow: none; background: transparent; padding: var(--rp-pad-row) 14px; }
  table.cardify-auto > tbody > tr + tr, table.log-table > tbody > tr + tr { border-top: 1px solid var(--rp-line-soft); }
  table.cardify-auto td:first-child, table.cardify-auto td.cf-title, table.cardify-auto td.cf-main { border-bottom: 0; margin-bottom: 0; padding-bottom: 2px; }
  table.cardify-auto td.cf-title, table.cardify-auto tr:not(:has(> td.cf-title)) > td:first-child { font-size: 14px; color: var(--rp-ink); }
  table.cardify-auto td::before { color: var(--rp-muted); }
  table.cardify-auto tr.group-row td, table.cardify-auto tr.mat-sep td { background: #f4f7f2 !important; font-size: 13px; }
  table.cardify-auto tr.total-row { background: var(--rp-green-soft); }
  /* หน้าที่มีกล่องตัวเลขหลักด้านบนแล้ว (ขาย / ซื้อรายบิล · กำไรขั้นต้น · มูลค่าสต๊อก): ไม่ซ้ำแถวรวมท้ายรายการบนมือถือ (เจ้าของระบบ 2026-11-07) */
  .content.rp-page:has(.rp-kpis, .rp-fin) table.cardify-auto > tbody > tr.total-row { display: none !important; }
  /* แถวที่แตะเปิดได้: › ขวาสุด */
  table.cardify-auto > tbody > tr[data-href], table.log-table > tbody > tr.log-row { position: relative; padding-right: 30px; cursor: pointer; }
  table.cardify-auto > tbody > tr[data-href]::after, table.log-table > tbody > tr.log-row::after { content: "›"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 20px; line-height: 1; color: var(--rp-muted); }
  table.log-table tr.log-row td.log-act { display: none; }
  table.log-table tr.log-row td.log-act:has(.su-702a72, .su-af1410) { display: block; border-top: 0; text-align: left; }
  table.log-table .badge, table.cardify-auto .badge { background: #edf2f7; color: #47607a; }
  /* บิล (ขาย / ซื้อรายบิล): 2 บรรทัด — คู่ค้า ↔ ยอดสุทธิ · วันที่ · เลขบิล · ประเภท (รายละเอียดอื่นดูในบิล) */
  table.cardify-auto > tbody > tr.rp-doc-row { grid-template-columns: auto auto auto minmax(0, 1fr) auto; column-gap: 0; row-gap: 3px; }
  table.cardify-auto tr.rp-doc-row > td { display: none; }
  table.cardify-auto tr.rp-doc-row > td.cf-title { display: block; grid-column: 1 / 5; grid-row: 1; }
  table.cardify-auto tr.rp-doc-row > td.cf-main { display: block; grid-column: 5; grid-row: 1; padding-left: 10px; }
  table.cardify-auto tr.rp-doc-row > td.rp-c-date, table.cardify-auto tr.rp-doc-row > td.rp-c-ref, table.cardify-auto tr.rp-doc-row > td.rp-c-type { display: block; grid-row: 2; font-size: 12px; color: var(--rp-muted); padding: 0; white-space: nowrap; }
  table.cardify-auto > tbody > tr.rp-doc-row:has(> td.cf-title) > td.rp-c-date::before, table.cardify-auto > tbody > tr.rp-doc-row:has(> td.cf-title) > td.rp-c-ref::before, table.cardify-auto > tbody > tr.rp-doc-row:has(> td.cf-title) > td.rp-c-type::before { content: none; display: none; }
  table.cardify-auto > tbody > tr.rp-doc-row:has(> td.cf-title) > td.rp-c-date { font-size: 12px; padding: 0; min-width: 0; }
  table.cardify-auto tr.rp-doc-row > td.rp-c-date { grid-column: 1; }
  table.cardify-auto tr.rp-doc-row > td.rp-c-ref { grid-column: 2; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
  table.cardify-auto tr.rp-doc-row > td.rp-c-ref a { color: var(--rp-muted); text-decoration: none; }
  table.cardify-auto tr.rp-doc-row > td.rp-c-type { grid-column: 3; }
  table.cardify-auto tr.rp-doc-row > td.rp-c-date::after, table.cardify-auto tr.rp-doc-row > td.rp-c-ref::after { content: "·"; margin: 0 6px; }
  table.cardify-auto tr.rp-doc-row:not(:has(> td.rp-c-type)) > td.rp-c-ref::after { content: none; }
  /* สถานะ / นัดส่ง / ค้างส่ง / ปุ่มส่งของ ต้องเห็นบนมือถือ (ผลตรวจ ฉ1): สถานะใต้ยอด · บรรทัด 3 นัดส่ง + ค้าง · บรรทัด 4 ปุ่ม */
  table.cardify-auto tr.rp-doc-row > td.rp-c-status { display: block; grid-row: 2; grid-column: 5; text-align: right; padding: 0 0 0 10px; white-space: nowrap; }
  table.cardify-auto > tbody > tr.rp-doc-row > td.rp-c-status::before { content: none; display: none; }
  table.cardify-auto tr.rp-doc-row > td.rp-c-due, table.cardify-auto tr.rp-doc-row > td.rp-c-rem { display: block; grid-row: 3; font-size: 12px; color: var(--rp-muted); padding: 0; white-space: nowrap; text-align: left; }
  table.cardify-auto tr.rp-doc-row > td.rp-c-due { grid-column: 1 / 3; }
  table.cardify-auto tr.rp-doc-row > td.rp-c-rem { grid-column: 3 / 6; }
  table.cardify-auto > tbody > tr.rp-doc-row > td.rp-c-due::before, table.cardify-auto > tbody > tr.rp-doc-row > td.rp-c-rem::before { content: attr(data-label) " "; display: inline; font-size: 12px; }
  table.cardify-auto tr.rp-doc-row > td.rp-c-due:has(> .muted:only-child), table.cardify-auto tr.rp-doc-row > td.rp-c-rem:has(> .muted:only-child) { display: none; }
  table.cardify-auto tr.rp-doc-row > td.rp-c-act:not(:empty) { display: block; grid-row: 4; grid-column: 1 / -1; padding: 6px 0 0; text-align: left; }
  table.cardify-auto > tbody > tr.rp-doc-row > td.rp-c-act::before { content: none; display: none; }
  table.cardify-auto .rp-wait { margin: 0; }
  /* ตาราง 12 เดือน: ยอดรวมปีก่อน · แตะเปิดครบ 12 เดือน (2 คอลัมน์ ป้ายซ้าย ค่าขวา) */
  table.cf-pivot td.cf-month { display: none !important; }
  table.cf-pivot tr.cf-open td.cf-month { display: flex !important; justify-content: space-between; gap: 8px; grid-column: span 2; font-size: 12.5px; border-bottom: 1px solid var(--rp-line-soft); padding: 6px 0; }
  table.cf-pivot tr.cf-open td.cf-month::before { display: inline; font-size: 12px; }
  table.cf-pivot > tbody > tr > td.cf-more { grid-column: 1 / -1 !important; padding: 4px 0 0; }
  table.cf-pivot td.cf-more::before { content: none; }
  .cf-more-btn { background: none; border: 0; padding: 4px 0; color: var(--green); font-size: 12.5px; font-weight: 500; cursor: pointer; }
  .cf-more-btn::before { content: "▸ "; }
  tr.cf-open .cf-more-btn::before { content: "▾ "; }
  /* ไม่มีข้อมูล */
  table.cardify-auto td.cf-emptystate { padding: 34px 12px !important; font-size: 15px; color: var(--rp-ink); font-weight: 600; }
  table.cardify-auto td.cf-emptystate .cf-hint { display: block; margin-top: 6px; font-size: 12.5px; font-weight: 400; color: var(--rp-muted); }
}
@media (min-width: 601px) { .cf-hint, td.cf-more { display: none; } }
/* หน้าสต๊อกคงเหลือ: กล่องรายการเดียวมีเส้นคั่น · ปุ่มสถานะแบบเหลี่ยมมน · แถบสีซ้ายเฉพาะแถวที่ต้องดูแล */
.rp-page button.sr-chip { border-radius: 6px; border-color: var(--rp-line); min-height: 38px; color: var(--rp-muted); }
.rp-page button.sr-chip .sr-cnt { border-radius: 4px; background: #eff3ed; color: var(--rp-ink); }
.rp-page button.sr-chip.sr-alert.st-out, .rp-page button.sr-chip.sr-alert.st-danger { color: var(--rp-bad); }
.rp-page button.sr-chip.sr-alert.st-warning { color: var(--rp-warn); }
.rp-page button.sr-chip.sr-alert .sr-cnt { background: #eff3ed !important; color: var(--rp-ink) !important; }
.rp-page button.sr-chip.active { background: var(--green); border-color: var(--green); color: #fff; }
.rp-page button.sr-chip.active .sr-cnt { background: rgba(255,255,255,.22) !important; color: #fff !important; }
.rp-page .sr-filterbar { background: transparent; border: 0; padding: 0; }
.rp-page .sr-table tbody tr.sr-row td { padding-top: var(--rp-pad-cell); padding-bottom: var(--rp-pad-cell); }
@media (max-width: 759px) {
  /* การ์ดแยกทีละสินค้า (เจ้าของระบบ 2026-11-07 — ให้เหมือนหน้าสต๊อกตามล็อต ดูง่ายกว่ากล่องรวม) */
  .sr-table tbody { display: block; background: transparent; border: 0; }
  .sr-table tbody tr.sr-row { background: #fff; border: 1px solid var(--rp-line); border-left: 3px solid var(--rp-line); border-radius: var(--rp-radius); margin: 0 0 8px; padding: var(--rp-pad-row) 14px var(--rp-pad-row) 12px; }
  .sr-table tbody tr.sr-row.st-out, .sr-table tbody tr.sr-row.st-danger { border-left-color: var(--rp-bad); }
  .sr-table tbody tr.sr-row.st-warning { border-left-color: #d29c35; }
  .sr-table tr.mat-sep td { margin: 4px 0 8px; border-radius: 8px; }
  .rp-page > .card > .sr-wrap { background: transparent; border: 0; }
  /* การ์ดเตี้ยลง: ป้ายสถานะชิดใต้จำนวน · รายละเอียดชิดขึ้น */
  .rp-page .sr-table tbody tr.sr-row { row-gap: 2px; }
  .rp-page .sr-table td.sr-st .sr-pill { margin-top: 0; }
  .rp-page .sr-table tbody tr.sr-row > td { padding-top: 0; padding-bottom: 0; }
  .rp-page .sr-table tbody tr.sr-row > td.sr-d { margin-top: 8px; }
  /* รายละเอียดใต้การ์ด 2 ช่องต่อแถว (เหลือขายได้ | PO ค้างรับ · ขายเฉลี่ย | พอขายอีก) — การ์ดเตี้ยลง */
  .rp-page .sr-table tbody tr.sr-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .rp-page .sr-table tbody tr.sr-row > td.sr-name { grid-column: 1; }
  .rp-page .sr-table tbody tr.sr-row > td.sr-qty, .rp-page .sr-table tbody tr.sr-row > td.sr-st { grid-column: 2; }
  .rp-page .sr-table tbody tr.sr-row > td.sr-d { grid-column: span 1; flex-wrap: wrap; border-top: 0; margin-top: 4px; padding-top: 0; font-size: 12px; }
  .rp-page .sr-table tbody tr.sr-row > td.sr-d + td.sr-d { padding-left: 12px; border-left: 1px solid var(--rp-line-soft); }
  .rp-page .sr-table tbody tr.sr-row > td.sr-d::before { flex-basis: 100%; font-size: 11px; }
  .rp-page .sr-table tbody tr.sr-row > td.sr-d { justify-content: flex-start; }
}
.rp-page a.list-row, .rp-page a.list-row .main, .rp-page a.list-row .sub { text-decoration: none; color: inherit; }
.cp-docs { list-style: none; margin: 4px 0 0; padding: 0; }

/* กล่องงานแบบผสม (decisions.md 2026-11-14) */
.ib-chip { padding: 8px 14px; flex: 0 0 auto; }
.ib-hdr { display: inline-flex; gap: 6px; align-items: center; }
.ib-hdr button { width: auto; }
.ib-sortline { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin: 6px 0; font-size: .9em; }
.ib-sortline select { width: auto; max-width: 100%; }
.ib-late-txt { color: var(--red); font-weight: 600; }
.ib-1l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-gbox { border: 1px solid var(--border); border-radius: 10px; background: var(--card, #fff); overflow: hidden; }
.ib-ghead { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 52px; padding: 9px 11px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ib-ghead .ib-ico { flex: 0 0 auto; font-size: 18px; }
.ib-ghead.ib-unread .ib-ico::after { content: "•"; color: var(--red); margin-left: 2px; }
.ib-ghead.ib-unread .ib-card-title { font-weight: 700; }
.ib-gtitle { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.ib-gtitle .ib-card-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-gcount { flex: 0 0 auto; padding: 2px 10px; border-radius: 999px; background: var(--green); color: #fff; font-size: .85em; font-weight: 600; white-space: nowrap; }
.ib-chev { flex: 0 0 auto; transition: transform .15s; }
.ib-ghead[aria-expanded="true"] .ib-chev { transform: rotate(180deg); }
.ib-ghead[aria-expanded="true"] { border-bottom: 1px solid var(--border); }
.ib-gbody { display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.ib-gbody.hidden, .ib-rest.hidden { display: none; }
.ib-rest { display: flex; flex-direction: column; gap: 6px; }
.ib-sub .ib-gcount { background: var(--border); color: inherit; }
.ib-more { width: 100%; min-height: 40px; border: 1px dashed var(--border); border-radius: 8px; background: transparent; color: var(--green); font: inherit; font-weight: 600; cursor: pointer; }
.ib-cards .ib-card-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ib-gtitle .ib-card-title { display: block; }
.ib-sub .ib-gbody { padding: 6px; }

/* กล่องงานรอบ 2 (2026-11-14): เรียบแบบภาพตัวอย่าง — หัวหน้าแถวเดียว · แท็บขีดเส้นใต้ · ไม่ใช้ไอคอนสี · ไม่มีอะไรกว้างเกินจอ (v87) */
.ib-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.ib-top h2.section-title { font-size: 18px; margin: 0; }
.ib-hdr { display: inline-flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.ib-ibtn, .ib-hdr button.ib-ibtn { width: 40px; height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 10px; background: transparent; color: var(--green); cursor: pointer; text-decoration: none; }
.cs-tabs.ib-tabs { display: flex; flex-wrap: nowrap; gap: 0; margin: 4px 0 10px; border-bottom: 1px solid var(--border); }
.cs-tabs.ib-tabs a.ib-tab { flex: 1 1 0; min-width: 0; width: auto; text-align: center; padding: 10px 2px; margin-bottom: -1px; font-size: 14px; color: inherit; opacity: .75; text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-tabs.ib-tabs a.ib-tab.on { opacity: 1; color: var(--green); font-weight: 600; border-bottom-color: var(--green); }
@media (min-width: 700px) { .cs-tabs.ib-tabs a.ib-tab { flex: 0 0 auto; padding: 10px 18px; } }
.ib-chips { margin: 6px 0; }
.ib-chip { padding: 6px 12px; font-size: 13px; }
.ib-chip b { font-weight: 600; }
.ib-sortline { margin: 6px 0 2px; flex-wrap: nowrap; }
.ib-sortline select { width: auto; padding: 6px 8px; font-size: 13px; border-radius: 999px; }
.ib-sec { margin: 14px 0 6px; font-size: 13px; font-weight: 600; opacity: .8; }
.ib-dot { flex: 0 0 auto; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--red); }
.ib-ghead .ib-dot { margin-top: 0; }
.ib-card, .ib-card.ib-late { border-left: 1px solid var(--border); }
.ib-gtitle .ib-card-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ib-gtitle .sub { font-size: 12px; font-weight: 400; }
.ib-gcount, .ib-sub .ib-gcount { background: transparent; border: 1px solid var(--border); color: inherit; font-size: 13px; min-width: 30px; text-align: center; padding: 1px 8px; }
.ib-ghead { min-height: 48px; }

/* กล่องงานรอบ 3 (2026-11-14): ชั้นในต่างจากหัวข้อ — หัวที่กางพื้นเขียวอ่อน · ด้านในพื้นเข้มขึ้น · แถวคู่ค้า / เอกสารไม่มีกรอบ ตัวเล็กลง */
.ib-gbox:not(.ib-sub) > .ib-ghead[aria-expanded="true"] { background: var(--green-light); }
.ib-gbox:not(.ib-sub) > .ib-gbody { background: rgba(0, 0, 0, .035); padding: 4px 10px 8px 16px; gap: 0; }
.ib-gbody .ib-rest { gap: 0; }
.ib-gbody .ib-sub { border: 0; border-radius: 0; background: transparent; border-bottom: 1px solid var(--border); }
.ib-gbody .ib-sub > .ib-ghead { min-height: 44px; padding: 8px 2px; border-bottom: 0; }
.ib-gbody .ib-sub .ib-gtitle .ib-card-title { font-size: 14px; font-weight: 500; }
.ib-gbody .ib-sub > .ib-ghead.ib-unread .ib-card-title { font-weight: 700; }
.ib-pico { flex: 0 0 auto; display: inline-flex; opacity: .6; }
.ib-gbody .ib-sub > .ib-gbody { padding: 0 0 6px 24px; gap: 0; background: transparent; }
.ib-gbody .ib-card { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; padding: 8px 2px; }
.ib-gbody .ib-card:last-child, .ib-gbody .ib-sub:last-child { border-bottom: 0; }
.ib-gbody .ib-card .ib-card-title { font-size: 14px; font-weight: 500; }
.ib-gbody .ib-card.ib-unread .ib-card-title { font-weight: 700; }
.ib-gbody .ib-card .sub { font-size: 13px; }
.ib-gbody .ib-more { margin-top: 6px; min-height: 36px; font-size: 13px; }
.ib-unread-opt { margin: 0; flex: 1 1 100%; }
.ib-gbody .ib-card .ib-dot { display: none; } /* ชั้นใน: ยังไม่อ่าน = ตัวหนา ไม่ใช้จุดแดง */
/* บิลซื้อ: ยังไม่มีใบกำกับ (ใบส่งของ) = ไม่ต้องกรอกราคา */
.bill-lines.no-price .lc-price, .bill-lines.no-price .th-price { display: none; }
/* แถบแจ้งโปรแกรมรุ่นใหม่ (core.js checkNewVersion) */
.new-ver-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px; z-index: 60; display: flex; align-items: center; gap: 12px;
  background: var(--card, #fff); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.new-ver-bar button { padding: 6px 14px; }


/* คำเตือนของระบบในกระดิ่ง (2026-11-19) — อ่านแล้ววันนี้ = จางลง */
.sysn-list { display: flex; flex-direction: column; gap: 8px; }
.sysn-list .msg { margin: 0; }
.sysn-read { opacity: .7; }


/* รายงานยอดขายฝากขายรายสัปดาห์ (v85) — แถวกลุ่ม / รวมกลุ่ม · ป้ายที่มาราคา · พิมพ์เป็น PDF */
.cw-table td, .cw-table th { white-space: nowrap; }
.cw-table td:first-child { white-space: normal; min-width: 160px; }
.cw-table .cw-grp td { background: var(--green-50, #eef5ee); font-weight: 600; }
.cw-table .cw-sub td { font-weight: 600; border-bottom: 2px solid var(--border, #ccc); }
.cw-src { font-size: 11px; color: var(--muted, #777); border: 1px solid var(--border, #ddd); border-radius: 6px; padding: 0 4px; }
.cw-nocov { font-size: 11px; font-weight: 400; }
.cw-kpis { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.cw-tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--border, #ddd); margin: 4px 0 10px; }
.cw-tabs a { padding: 6px 2px; color: var(--muted, #777); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.cw-tabs a.on { color: inherit; font-weight: 600; border-bottom-color: currentColor; }
.cw-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.cw-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border, #ddd); border-radius: 999px; padding: 2px 4px 2px 12px; font-size: 13px; background: #fff; color: inherit; text-decoration: none; margin: 0; }
.cw-chip select, .cw-chip input { border: none !important; background: transparent !important; box-shadow: none !important; padding: 4px 6px !important; min-height: 0 !important; height: auto !important; width: auto !important; font-weight: 600; }
.cw-chip-on { padding: 6px 12px; }
.cw-chip-sel select { max-width: 150px; text-overflow: ellipsis; }
.cw-chip-on b { display: inline-block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.cw-ghost { list-style: none; cursor: pointer; padding: 4px 8px; border-radius: 8px; color: var(--muted, #666); font-size: 13px; white-space: nowrap; }
.cw-ghost::-webkit-details-marker { display: none; }
.cw-ghost:hover { background: rgba(0, 0, 0, .05); }
.cw-menu { position: relative; display: inline-block; }
.cw-pop { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 200px; background: #fff; border: 1px solid var(--border, #ddd); border-radius: 10px; padding: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); display: flex; flex-direction: column; gap: 4px; }
.cw-pop-r { left: auto; right: 0; }
.cw-pop { max-width: calc(100vw - 16px); box-sizing: border-box; }
.cw-pop select { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
.cw-pop a, .cw-pop button { display: block; text-align: left; padding: 6px 10px; border-radius: 6px; color: inherit; text-decoration: none; background: none; border: none; font: inherit; cursor: pointer; }
.cw-pop a:hover, .cw-pop button:hover { background: rgba(0, 0, 0, .05); }
.cw-pop label { font-size: 12px; margin: 4px 4px 0; }
.cw-tbox { border: 1px solid var(--border, #ddd); border-radius: 12px; margin-top: 10px; }
.cw-tbox .table-wrap { margin: 0; border: none; }
.cw-tbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border, #ddd); flex-wrap: wrap; }
.cw-tbar-r { display: inline-flex; align-items: center; gap: 6px; }
.cw-seg { display: inline-flex; border: 1px solid var(--border, #ccc); border-radius: 8px; overflow: hidden; }
.cw-seg a { padding: 3px 10px; font-size: 13px; color: inherit; text-decoration: none; white-space: nowrap; }
.cw-seg a.on { background: var(--green-50, #eef5ee); font-weight: 600; }
/* หน้าวิเคราะห์ขายรายสัปดาห์ (decisions.md 2026-11-29) · คอม = ช่องสัปดาห์ซ้าย + เนื้อหาขวา · มือถือ = แถบปัด + การ์ด 2 คอลัมน์ */
.cwa { display: flex; gap: 14px; align-items: flex-start; }
.cwa-weeks { flex: 0 0 230px; border: 1px solid var(--border, #ddd); border-radius: 12px; padding: 8px; position: sticky; top: 8px; max-height: calc(100vh - 16px); overflow-y: auto; box-sizing: border-box; }
.cwa-wt { font-weight: 600; padding: 4px 6px 8px; }
.cwa-wl { display: flex; flex-direction: column; gap: 2px; }
.cwa-w { display: flex; justify-content: space-between; gap: 8px; padding: 8px; border-radius: 8px; color: inherit; text-decoration: none; font-size: 13px; }
.cwa-w b { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cwa-w:hover { background: rgba(0, 0, 0, .04); }
.cwa-w.on { background: var(--green-50, #eef5ee); font-weight: 600; outline: 1px solid var(--primary, #1e4d36); }
.cwa-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.cwa-sum, .cwa-alerts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.cwa-card { border: 1px solid var(--border, #ddd); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.cwa-card .lbl, .cwa-alert .lbl { font-size: 12px; color: var(--muted, #666); }
.cwa-card .v { font-size: 22px; font-weight: 600; overflow-wrap: anywhere; }
.cwa-card .s { font-size: 12px; }
.cwa-hero { background: var(--primary, #1e4d36); color: #fff; border-color: transparent; }
.cwa-hero .lbl, .cwa-hero .s { color: rgba(255, 255, 255, .88); }
.cwa-alert { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; border: 1px solid var(--border, #ddd); border-top-width: 4px; border-radius: 12px; padding: 8px 12px; background: #fff; font: inherit; color: inherit; cursor: pointer; min-height: 44px; min-width: 0; }
.cwa-alert .v { font-size: 20px; font-weight: 600; }
.cwa-alert .s { font-size: 12px; }
.cwa-t-dead { border-top-color: #a3361f; } .cwa-t-risk { border-top-color: #b6692f; } .cwa-t-low { border-top-color: #2d5f8a; } .cwa-t-chk { border-top-color: #6b6f6a; }
.cwa-sec { border: 1px solid var(--border, #ddd); border-radius: 12px; min-width: 0; }
details.cwa-sec { border-top-width: 1px; }
details.cwa-sec.cwa-t-dead, details.cwa-sec.cwa-t-risk, details.cwa-sec.cwa-t-low, details.cwa-sec.cwa-t-chk { border-top-width: 4px; }
.cwa-sec > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; min-height: 44px; box-sizing: border-box; font-weight: 600; }
.cwa-sec > summary::-webkit-details-marker { display: none; }
.cwa-sec > summary::after { content: "▾"; color: var(--muted, #777); font-weight: 400; }
details.cwa-sec:not([open]) > summary::after { content: "▸"; }
.cwa-cnt { font-weight: 400; font-size: 13px; margin-left: auto; }
.cwa-body { padding: 0 12px 12px; }
.cwa-body > .cw-tbox { margin-top: 0; }
.cwa-trend { padding: 10px 12px; }
.cwa-th { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.cwa-tseg button { border: none; background: none; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; min-height: 32px; }
.cwa-tseg button.on { background: var(--green-50, #eef5ee); font-weight: 600; }
.cwa-svg { width: 100%; height: 130px; display: block; }
.cwa-trend[data-m="value"] .cwa-svg-qty, .cwa-trend[data-m="qty"] .cwa-svg-value { display: none; }
.cwa-bar { fill: #8fb59c; } .cwa-bar-on { fill: var(--primary, #1e4d36); }
.cwa-axis { display: flex; justify-content: space-between; font-size: 11px; }
.cwa-list { display: flex; flex-direction: column; gap: 6px; }
.cwa-item { border: 1px solid var(--border, #e5e5e5); border-radius: 10px; padding: 8px 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; font-size: 13px; }
.cwa-n { font-weight: 500; overflow-wrap: anywhere; }
.cwa-r { text-align: right; white-space: nowrap; }
.cwa-empty { padding: 8px 0; }
.cwa-note { font-size: 12px; margin: 6px 0; }
.cwa-morebtn { margin-top: 6px; width: 100%; min-height: 40px; border: 1px dashed var(--border, #ccc); border-radius: 10px; background: none; font: inherit; cursor: pointer; }
.cwa-pick { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 6px; align-items: center; margin: 0; font-weight: 400; min-width: 0; }
.cwa-pick input { width: 20px; height: 20px; }
.cwa-q { width: 72px !important; min-height: 36px; text-align: right; display: inline-block; }
.cwa-draft { width: 100%; min-height: 48px; margin-top: 10px; }
.cwa-tag { display: inline-block; min-width: 20px; text-align: center; border-radius: 6px; padding: 0 5px; font-size: 12px; }
.cwa-abcbar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin: 4px 0 8px; background: #eee; }
.cwa-abc-A { background: #1e4d36; color: #fff; } .cwa-abc-B { background: #8fb59c; } .cwa-abc-C { background: #e3ddcc; }
.cwa-abcg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; font-size: 13px; margin-bottom: 8px; }
.cwa-heat { display: flex; flex-direction: column; gap: 3px; }
.cwa-hr { display: grid; grid-template-columns: minmax(0, 1fr) repeat(8, 22px); gap: 3px; align-items: center; font-size: 12px; }
.cwa-hn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cwa-h { height: 20px; border-radius: 4px; }
.cwa-h0 { background: #f1ede4; } .cwa-h1 { background: #cfe0d4; } .cwa-h2 { background: #8fb59c; } .cwa-h3 { background: #4f8a66; } .cwa-h4 { background: #1e4d36; }
.cwa-ck-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; min-height: 44px; border-bottom: 1px solid var(--border, #eee); color: inherit; text-decoration: none; }
.cwa-ck-row b { white-space: nowrap; }
@media (max-width: 1100px) { .cwa-sum, .cwa-alerts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .cwa { display: block; }
  .cwa-weeks { position: static; max-height: none; border: none; padding: 0; margin-bottom: 10px; }
  .cwa-wt { padding: 0 0 4px; font-size: 12px; color: var(--muted, #666); font-weight: 400; }
  .cwa-wl { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .cwa-w { flex: 0 0 auto; flex-direction: column; gap: 0; border: 1px solid var(--border, #ddd); min-height: 44px; box-sizing: border-box; padding: 4px 12px; }
  .cwa-w.on { background: var(--primary, #1e4d36); color: #fff; outline: none; }
  .cwa-main { gap: 10px; }
  .cwa-sum, .cwa-alerts { gap: 8px; }
  .cwa-card { padding: 8px 10px; }
  .cwa-card .v { font-size: 18px; }
  .cwa-alert .v { font-size: 17px; }
  .cwa-hr { grid-template-columns: minmax(0, 1fr) repeat(8, 16px); }
  .cwa-h { height: 16px; }
}
@media print { .cwa-weeks, .cwa-alerts, .cwa-morebtn, .cwa-draft, .cwa-q, .cwa-ck { display: none !important; } .cwa { display: block; } .cwa-more.hidden { display: grid !important; } }
.cw-alert { margin: 0 0 8px; }
.cw-alert summary { cursor: pointer; }
.cw-table .muted { font-size: inherit; }
.print-only { display: none; }
@media print {
  .print-only { display: block !important; }
  .cw-page { box-shadow: none !important; border: none !important; padding: 0 !important; max-width: none !important; }
  .cw-page .info-tip, .cw-page .rp-back, .cw-page .filters, .rp-page .page-tabs, .rp-page .rp-help, .rp-page .rp-crumb { display: none !important; }
  .cw-print-head { margin: 4px 0 8px; font-size: 12px; }
  .cw-table { font-size: 10px; }
  .cw-table th, .cw-table td { padding: 3px 4px !important; }
  .cw-table tr { break-inside: avoid; }
  .cw-table .cw-grp td { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .calc-tip { border-bottom: none !important; }
  @page { size: A4 landscape; margin: 10mm; }
}


/* ของแถมในบิลซื้อ (v87) */
.ln-free-lbl { display: flex; align-items: center; gap: 4px; font-size: 12px; margin-top: 4px; white-space: nowrap; }
.ln_free_from { font-size: 12px; margin-top: 4px; display: flex; flex-direction: column; gap: 2px; }
.ln-ff-lbl { display: flex; align-items: center; gap: 4px; }
#freeAllocBox .free-alloc { font-size: 13px; }
/* หน้าอนุมัติรอบบิลตัดขาย (decisions.md 2026-11-22): ผลเมื่ออนุมัติ + แถบปุ่มท้ายเอกสาร (อนุมัติขวาสุด) */
.ci-decide .ci-effect { margin: 0; }
.ci-actions { justify-content: flex-end; }
.cf-box textarea { width: 100%; margin-top: 8px; }
/* อนุมัติ / ปฏิเสธ ทุกหน้า (decisions.md 2026-11-22): ปฏิเสธ = ขอบแดง อยู่ซ้าย · อนุมัติ = ปุ่มหลัก อยู่ขวา · กล่องถามเหตุผลของแอป */
button.btn-reject { color: var(--red); border-color: var(--red); }
.cf-ask { text-align: left; max-width: 420px; }
.cf-ask textarea { width: 100%; margin-top: 4px; }
/* แถบแท็บ / ชิปหลายปุ่ม → ช่องเลือกบนจอแคบ (core.js mobileTabSelects · decisions.md 2026-11-22) */
select.tab-select { display: none; }
@media (max-width: 640px) {
  .has-tab-select { display: none !important; }
  select.tab-select { display: block; width: 100%; margin: 0 0 10px; font-weight: 600; }
}
/* รายงานรายบิล: บิลที่กลับรายการแล้ว + ใบ RV (v92) — จางลง แต่ยังอ่านได้ */
tr.rv-row td { color: var(--gray); }
/* แถวอันดับหน้าหลัก (สินค้าขายดี / ลูกค้ายอดสูงสุด): ชื่อเต็ม 2 บรรทัด · ยอด / % คนละบรรทัด · แถบสัดส่วน */
.dash-rank { align-items: flex-start; }
.dash-rank .dash-row-text .main { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.dash-rank .dash-row-val { padding-top: 1px; }
.dash-share { font-size: 11.5px; font-weight: 600; color: var(--gray); margin-top: 3px; }
.dash-bar { height: 4px; background: var(--border); border-radius: 999px; margin-top: 6px; overflow: hidden; }
.dash-bar > i { display: block; height: 100%; background: var(--green); border-radius: 999px; }
/* จำนวนแปลงเป็นหน่วยใหญ่ (ตั้งในหน้าสินค้า) — ตัวเล็กใต้ตัวเลข */
.qty-case { font-size: 11px; font-weight: 400; color: var(--gray); white-space: nowrap; line-height: 1.3; }
.sr-qu { display: none; }
@media (max-width: 759px) {
  .sr-table tbody tr.sr-row td.sr-unit { display: none; }
  /* การ์ดสต๊อกบนมือถือ: ย่อ = ชื่อ + คงเหลือ + หน่วย (+ หน่วยใหญ่ตัวเล็ก) · แตะ = ขยาย (เจ้าของระบบ 2026-11-23) */
  .sr-table tbody tr.sr-row { cursor: pointer; }
  .sr-table .sr-qu { display: inline; font-size: 13px; font-weight: 500; color: var(--gray); }
  .sr-table td.sr-name { grid-row: 1; }
  .sr-table .sr-title::after { content: " ▾"; color: #b8b3a3; font-size: 12px; }
  .sr-table tr.sr-row.open .sr-title::after { content: " ▴"; }
  .sr-table tbody tr.sr-row:not(.open) td.sr-st, .sr-table tbody tr.sr-row:not(.open) td.sr-d, .sr-table tr.sr-row:not(.open) .sr-fac { display: none; }
  .sr-table tbody tr.sr-row.open td.sr-name { grid-row: 1 / span 2; }
}

/* หน้าบิลแบบเอกสาร (บิลขาย / ซื้อ · 2026-11-23): จอกว้าง = ตาราง · มือถือ = การ์ด · ของแถมอยู่ท้ายกลุ่มโปร */
.bd-cards { display: none; }
.bd-table td.bd-acts, .bd-card .bd-acts { white-space: nowrap; font-size: 12px; }
.bd-table tr.bd-sec td { background: transparent; color: var(--gray); font-size: 12px; padding-top: 10px; border-bottom: 0; }
.bd-table tr.bd-sec.bd-promo td, .bd-ghead { color: var(--green); font-weight: 600; }
.bd-table tr.bd-free-row td { background: var(--green-light); }
.bd-free { display: inline-block; background: var(--green-light); color: var(--green); border: 1px solid var(--green); font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 999px; }
.bd-free-txt { color: var(--green); font-weight: 600; }
.bd-kpis { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.bd-kpis > div { background: var(--bg, #f5f3ee); border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; display: flex; flex-direction: column; min-width: 110px; }
.bd-kpis span { font-size: 11.5px; color: var(--gray); }
.bd-sum { margin: 10px 0 0 auto; max-width: 360px; font-size: 14px; }
.bd-sum > div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.bd-sum > div.bd-tot { font-weight: 700; border-top: 1px solid var(--border); padding-top: 6px; }
@media (max-width: 759px) {
  .bd-table { display: none; }
  .bd-cards { display: block; }
  .bd-group { margin-bottom: 10px; }
  .bd-group.bd-promo { border: 1px solid var(--green); border-radius: 10px; padding: 6px 10px; }
  .bd-ghead { font-size: 12px; margin-bottom: 4px; }
  .bd-group:not(.bd-promo) .bd-ghead { color: var(--gray); font-weight: 400; }
  .bd-card { padding: 7px 0; border-bottom: 1px solid var(--border); }
  .bd-card:last-child { border-bottom: 0; }
  .bd-card.bd-free-row { border-top: 1px dashed var(--border); }
  .bd-l1 { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
  .bd-l1 b { white-space: nowrap; }
  .bd-l2 { font-size: 12.5px; margin-top: 1px; }
  .bd-sum { max-width: none; }
}

/* หัวตารางตรึงด้านบนตอนเลื่อนลง (initStickyTHead · 2026-11-23) */
.sticky-thead { position: fixed; z-index: 9; overflow: hidden; display: none; pointer-events: none; box-shadow: 0 2px 4px -2px rgba(0,0,0,0.2); }
.sticky-thead.visible { display: block; }
.sticky-thead table { margin: 0; border-collapse: collapse; }
.sticky-thead thead th { position: static; }
.sticky-thead thead th.freeze { position: relative; z-index: 2; }
@media print { .sticky-thead { display: none !important; } }
.bd-table th:nth-child(2), .bd-table td:nth-child(2), .bd-table td.pc-note { text-align: left; }
.bd-table tr.bd-sec td { text-align: left; }
/* ช่วงวันที่รายงานสต๊อกรายสัปดาห์ (v95 · 2026-11-24) */
.cs-range { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cs-range input { flex: 1 1 140px; min-width: 0; margin: 0; }
/* เครื่องหมาย "ของออก" ในไฟล์รายงานสต๊อกลูกค้า (2026-11-24) */
.cs-sign { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; }
.cs-sign-opt { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.cs-sign-opt input { width: auto; margin: 0; }

/* ---------- ตั้งค่า → รายการสินค้า (แบบ ค · 2026-11-25) — แถว 2 บรรทัด แตะทั้งแถว · ไม่มีปุ่มในรายการ ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pl-page { max-width: 900px; }
.pl-back { display: inline-flex; align-items: center; min-height: 40px; font-size: 14px; color: var(--green); text-decoration: none; }
.pl-head { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.pl-head .section-title { flex: 1 1 auto; min-width: 0; margin: 0; }
.pl-head button.pl-icon { width: 44px; height: 44px; min-width: 44px; padding: 0; margin: 0; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; }
.pl-add { margin: 0 0 10px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pl-check { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.pl-search { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--gray); }
.pl-search input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; padding: 0; margin: 0; height: 40px; box-shadow: none; }
/* แท็บขีดเส้นใต้แบบกล่องงาน — ไม่ใช้ .cs-tabs เพราะจอแคบจะถูกแปลงเป็นช่องเลือกที่เห็นแค่ "ทั้งหมด" (ปัญหาที่เจ้าของระบบแจ้ง) */
.pl-tabs { display: flex; margin: 8px 0 10px; border-bottom: 1px solid var(--border); }
.pl-tabs a { flex: 1 1 0; min-width: 0; text-align: center; padding: 10px 2px; margin-bottom: -1px; font-size: 14px; color: inherit; opacity: .75; text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-tabs a.on { opacity: 1; color: var(--green); font-weight: 600; border-bottom-color: var(--green); }
@media (min-width: 700px) { .pl-tabs a { flex: 0 0 auto; padding: 10px 18px; } }
.pl-count { font-size: 13px; margin: 0 0 6px; }
.pl-list { display: flex; flex-direction: column; gap: 8px; }
.pl-row { display: block; padding: 10px 12px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); color: inherit; text-decoration: none; min-width: 0; }
.pl-row:active, .pl-row:hover { border-color: var(--green); }
.pl-l1 { display: flex; align-items: baseline; gap: 8px; }
.pl-name { flex: 1 1 auto; min-width: 0; font-size: 15px; font-weight: 500; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.pl-price { flex: 0 0 auto; font-size: 14px; font-weight: 600; white-space: nowrap; }
.pl-l2 { font-size: 13px; color: var(--gray); margin-top: 2px; overflow-wrap: anywhere; }
.pl-row.is-off .pl-name { color: var(--gray); }
.pl-foot { margin-top: 14px; display: flex; justify-content: flex-end; }
.pv-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.pv-title { flex: 1 1 auto; min-width: 0; }
.pv-title .section-title { margin: 0 0 4px; overflow-wrap: anywhere; }
.pv-head > a { flex: 0 0 auto; }
.pv-live { font-size: 11px; background: var(--green-light); color: var(--green); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.pv-fields { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 12px; }
.pv-fields > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.pv-fields > div:last-child { border-bottom: 0; }
.pv-fields dt { color: var(--gray); }
.pv-fields dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.pv-link { display: flex; justify-content: space-between; align-items: center; min-height: 44px; margin-top: 10px; color: inherit; text-decoration: none; font-size: 14px; }
.pv-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.pv-actions button { min-height: 44px; }
.pv-del { background: transparent; border: 0; color: var(--red); text-decoration: underline; font-size: 14px; box-shadow: none; }
@media (min-width: 700px) { .pv-actions { flex-direction: row; justify-content: flex-end; } .pv-actions button { width: auto; } }

/* ---------- ของแถม: PO ติ๊กต่อบรรทัด · บิลซื้อดึงจาก PO ล็อก (v96 · 2026-11-25) ---------- */
.pl-free-txt, .ln-free-txt { display: none; color: var(--green); font-weight: 600; }
tr.pl-is-free .pl-price, tr.ln-is-free .ln_price { display: none; }
tr.pl-is-free .pl-free-txt, tr.ln-is-free .ln-free-txt { display: block; padding: 6px 0; }
.pl-free-lbl { display: flex; align-items: center; gap: 6px; justify-content: flex-end; font-size: 13px; margin-top: 4px; white-space: nowrap; }
.pl-free-lbl input { width: auto; margin: 0; }
.pl-from { margin-top: 4px; font-size: 14px; }
tr.pl-is-free { background: var(--green-light); }
.ln-po-free { display: none; }
tr.ln-po-free-row .ln-po-free { display: inline; }
tr.ln-po-free-row .ln-free-lbl { opacity: .85; }

/* รายงานภาษีขาย / ภาษีซื้อแบบมาตรฐาน (decisions.md 2026-11-26) */
.vat-head { line-height: 1.6; }
table.vat-sum { width: 100%; max-width: 720px; }
table.vat-sum td { padding: 6px 8px; white-space: normal; }
table.vat-sum td.num { white-space: nowrap; }
table.vat-sum td.vat-no { width: 2em; color: var(--gray); text-align: center; }
table.vat-sum tr.total-row td { font-weight: 700; }
.vat-bd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
table.vat-table tr.total-row td, table.vat-bd tr.total-row td { font-weight: 700; }
@media (max-width: 600px) {
  .vat-bd-grid { grid-template-columns: 1fr; }
  table.vat-table td.num:not(.cf-main), table.vat-bd td.num:not(.cf-main) { text-align: left; }
  table.vat-sum td { font-size: 13px; padding: 6px 4px; }
}
@media print {
  .vat-page, .vat-card { box-shadow: none !important; border: none !important; padding: 0 !important; margin: 0 0 8px !important; max-width: none !important; }
  .vat-page .info-tip { display: none !important; }
  table.vat-table, table.vat-bd, table.vat-sum { font-size: 10px; }
  table.vat-table th, table.vat-table td { padding: 3px 4px !important; }
  table.vat-table tr { break-inside: avoid; }
  .vat-card { break-before: page; }
  @page { size: A4 landscape; margin: 10mm; }
}

/* ยอดวางบิลฝากขาย (แท็บในรายงานรอบบิลตัดขาย · decisions.md 2026-11-26) */
.cb-head { margin-top: 12px; line-height: 1.6; }
.cb-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.cb-kpi { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; min-width: 0; }
.cb-kpi.cb-main { background: var(--green-light); border-color: transparent; }
.cb-kpi .cb-v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ci-kpis { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.ci-kpis .cb-kpi .muted .scope-chip { margin-left: 2px; }
.ci-sum-line { margin-top: 4px; }
.ci-audit > summary { cursor: pointer; color: var(--gray); }
.cb-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
table.cb-tbl td { white-space: normal; }
table.cb-tbl td.num { white-space: nowrap; }
tr.cb-pend td { color: var(--gray); }
@media (max-width: 600px) {
  .cb-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cb-split { grid-template-columns: 1fr; }
  table.cb-rounds td.num:not(.cf-main) { text-align: left; }
}

/* ---------- เมนูรายงาน: 1 รายงาน = 1 ปุ่ม · ปักหมุด / ใช้ล่าสุด · กลุ่มยุบ / กางได้ (2026-11-27) ---------- */
.rep-menu .rep-search { margin: 4px 0 12px; }
.rep-quick-wrap { margin: 0 0 16px; }
.rep-quick-title { font-size: 13px; font-weight: 600; color: var(--gray); margin: 0 0 6px; }
.rep-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 760px) { .rep-quick { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.rep-quick-btn { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 10px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); color: inherit; text-decoration: none; font-size: 14px; font-weight: 500; line-height: 1.3; min-width: 0; }
.rep-quick-btn > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.rep-q-ico { display: inline-flex; flex: 0 0 auto; color: var(--gray); }
.rep-q-ico.on, .rep-star.on { color: var(--yellow); }
.rep-menu .rep-group { margin-bottom: 10px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; padding: 0; }
.rep-menu button.rep-group-head { width: 100%; margin: 0; padding: 12px 14px; background: transparent; border: 0; box-shadow: none; color: inherit; font: inherit; font-size: 15px; font-weight: 700; text-align: left; display: flex; align-items: center; gap: 8px; min-height: 48px; }
.rep-gname { flex: 1 1 auto; min-width: 0; }
.rep-gcount { flex: 0 0 auto; font-size: 12px; font-weight: 400; color: var(--gray); }
.rep-chev { display: inline-flex; color: var(--gray); transform: rotate(90deg); transition: transform .15s; }
.rep-group.rep-closed .rep-chev { transform: rotate(0deg); }
.rep-group.rep-closed:not(.rep-searching) .rep-list { display: none; }
.rep-row { display: flex; align-items: center; border-top: 1px solid var(--border); }
.rep-row a.rep-btn { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; padding: 9px 4px 9px 14px; color: inherit; text-decoration: none; min-height: 48px; justify-content: center; }
.rep-row a.rep-btn .lbl { font-size: 15px; font-weight: 500; }
.rep-row a.rep-btn .rep-hint { font-size: 12px; color: var(--gray); line-height: 1.35; margin: 0; }
.rep-menu button.rep-star, button.rep-star { flex: 0 0 auto; width: 44px; height: 44px; min-width: 44px; padding: 0; margin: 0; border: 0; background: transparent; box-shadow: none; color: #a39d8f; display: inline-flex; align-items: center; justify-content: center; }
button.rep-star.on { color: var(--yellow); }
h2 button.rep-star-h { width: 36px; height: 36px; min-width: 36px; vertical-align: middle; margin-left: 2px; }
.rep-sibs { display: flex; gap: 6px; overflow-x: auto; white-space: nowrap; margin: 4px 0 10px; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.rep-sib { flex: 0 0 auto; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: inherit; text-decoration: none; font-size: 13px; }
.rep-sib.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }

/* ===== มุมมองรายเดือน / รายปี ของรายงานสรุป (decisions.md 2026-11-27) ===== */
.rp-period { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; margin: 6px 0 10px; background: #fff; border: 1px solid var(--border); border-radius: 12px; max-width: 360px; }
.rp-seg { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 9px; color: var(--text); text-decoration: none; font-weight: 500; }
.rp-seg.on { background: var(--green); color: #fff; font-weight: 600; }
.rp-mnav { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; max-width: 480px; }
.rp-mbtn { flex: 0 0 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 12px; background: #fff; color: var(--text); text-decoration: none; font-size: 22px; }
.rp-mbtn.off { color: var(--border); }
.rp-mpick { position: relative; flex: 1 1 auto; min-width: 0; height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); border-radius: 12px; background: #fff; cursor: pointer; }
.rp-mname { font-weight: 600; font-size: 16px; }
.rp-mrange { font-size: 12px; white-space: nowrap; }
.rp-mpick input[type="month"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; margin: 0; }
.rp-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.rp-chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--border); background: #fff; color: var(--text); text-decoration: none; font-size: 14px; }
.rp-chip.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.rp-hero { border-radius: 16px; padding: 14px 16px; margin: 0 0 12px; color: #fff; background: var(--green); display: flex; flex-direction: column; gap: 4px; max-width: 640px; }
.rp-hero.tone-blue { background: #2d5f8a; }
.rp-hero-lbl { font-size: 13px; opacity: .92; }
.rp-hero-num { font-size: 28px; font-weight: 600; line-height: 1.2; }
.rp-hero-num .calc-tip, .rp-hero-num .calc-tip * { color: #fff; }
.rp-hero-sub { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; align-items: baseline; }
.rp-hero-sub2 { font-size: 12px; opacity: .88; }
.rp-hero .pos-num, .rp-hero .neg-num, .rp-hero .muted { color: #fff; font-weight: 600; }
.rp-mlist { background: #fff; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; max-width: 760px; }
.rp-mrow { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.rp-mlist > .rp-mrow:first-child, .rp-mgroup:first-child { border-top: 0; }
.rp-mrow-top { display: flex; align-items: baseline; gap: 8px; }
.rp-mrow-name { flex: 1 1 auto; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.rp-mrow-val { white-space: nowrap; }
.rp-mrow-sub { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; }
.rp-mrow-chg { margin-left: auto; }
.rp-mbar { height: 6px; background: var(--green-light); border-radius: 3px; overflow: hidden; }
.rp-mbar i { display: block; height: 6px; background: #2f7a55; }
.rp-mtotal { flex-direction: row; justify-content: space-between; border-top: 2px solid var(--green); font-weight: 600; }
.rp-mgroup { border-top: 1px solid var(--border); }
.rp-mgroup-head { display: flex; justify-content: space-between; gap: 8px; padding: 10px 14px 2px; }
.rp-mgroup-sub { padding: 0 14px 4px; }
.rp-mgroup .rp-mrow { border-top: 0; padding: 6px 14px 6px 26px; }
.rp-mgroup .rp-mrow-name { font-weight: 400; }
a.rp-mhead { color: inherit; text-decoration: underline dotted; }
.free-chip { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 9px; background: #f6e9da; color: #6b3a10; font-size: 11px; font-weight: 500; white-space: nowrap; vertical-align: middle; }
/* ยอดขายเดือนนี้ (ประมาณการ) — ยอดจริง = สีทึบ · ประมาณการ = ลายเส้น (decisions.md 2026-11-27) */
.est-tag { display: inline-block; padding: 0 8px; border-radius: 9px; background: #fbefdc; color: #8a5a12; font-size: 11px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.est-ok { display: inline-block; padding: 0 8px; border-radius: 9px; background: var(--green-light); color: var(--green); font-size: 11px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.est-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: #e3e0d6; margin: 6px 0 4px; }
.est-bar i { display: block; height: 100%; }
.est-bar .est-credit { background: #2f6b4c; }
.est-bar .est-consign { background: #6fa283; }
.est-bar .est-est, .est-days .e, .est-key i.e { background: repeating-linear-gradient(135deg, #d49a3a 0 5px, #f3dfb8 5px 9px); }
.est-days { display: grid; gap: 2px; margin: 4px 0; }
.est-days span { height: 14px; border-radius: 2px; background: #e3e0d6; }
.est-days .r, .est-key i.r { background: #2f6b4c; }
.est-days .t { outline: 2px solid var(--text); outline-offset: -1px; }
.est-key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; margin: 4px 0 8px; }
.est-key i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: #e3e0d6; }
/* ปุ่มส่งออกมาตรฐาน Excel + PDF (exportBtnsHtml · ใช้ทุกหน้ารายงาน · 2026-11-24) */
.xbtns { display: inline-flex; gap: 6px; align-items: center; }
.xbtn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 7px; margin: 0; width: auto; min-width: 0;
  font-size: 13px; font-weight: 500; line-height: 1; color: var(--text, #222); background: #fff; border: 1px solid var(--border, #d6d6d6);
  border-radius: 8px; cursor: pointer; white-space: nowrap; box-shadow: none; transition: background .12s, border-color .12s; }
.xbtn:hover { background: #f6f7f6; border-color: #bdbdbd; }
.xbtn:focus-visible { outline: 2px solid var(--green-600, #2e7d32); outline-offset: 1px; }
.xbtn-ico { flex: 0 0 auto; display: block; }
.xbtn-doc { fill: #fff; stroke: #9aa0a6; stroke-width: 1.5; stroke-linejoin: round; }
.xbtn-fold { fill: none; stroke: #9aa0a6; stroke-width: 1.5; stroke-linejoin: round; }
.xbtn-txt { fill: #fff; font: 700 6.5px/1 Arial, sans-serif; letter-spacing: .2px; }
.xbtn-xls .xbtn-tag { fill: #1d7044; }
.xbtn-pdf .xbtn-tag { fill: #d23a2e; }
@media (max-width: 600px) { .xbtn span { display: none; } .xbtn { padding: 0 6px; } }
/* พิมพ์ / PDF ทุกหน้ารายงาน (printReport · 2026-11-24): หัวกระดาษอัตโนมัติ · ไม่พิมพ์ปุ่ม */
.print-auto-head { margin: 0 0 8px; font-size: 12px; line-height: 1.5; }
@media print {
  #content button, #content .xbtns, #content .info-tip, .sticky-thead { display: none !important; }
  #content .card { box-shadow: none !important; }
  #content table { font-size: 11px; }
  #content tr { break-inside: avoid; }
}
/* ปุ่มเลือกไฟล์นำเข้าทะเบียนสาขา (label หุ้ม input file — หน้าตาแบบปุ่ม secondary) */
label.br-file-btn { display: inline-flex; align-items: center; gap: 6px; margin: 0; background: #fff; border: 1px solid var(--border); color: var(--text);
  padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; cursor: pointer; width: auto; }
/* สรุปรายสาขา (รายงานขายรายสัปดาห์ · 2026-12-01) — หน้าตาแบบตาราง cw-table แต่แยกชื่อ (ไม่ปนกับตารางหลักของรายงาน) */
.cw-sumtbl td, .cw-sumtbl th { white-space: nowrap; }
.cw-sumtbl td:first-child { white-space: normal; min-width: 160px; }
.cw-sumtbl .cw-sub td { font-weight: 600; border-top: 2px solid var(--border, #ccc); }

/* ================= หน้าหลักมาตรฐาน ERP (SAP Fiori / Salesforce · branch design/dashboard-erp) =================
   ใช้ตัวแปรธีมที่มีอยู่แล้ว (--green / --bg / --border / --text / --gray / --radius) รองรับทั้งแบบเดิม ทางการ และสดใส
   ความหนาแน่น: html[data-density="compact"] · มือถือ (≤ 999px) วางงานประจำวันและการ์ดงานค้างไว้ด้านบนสุดเพื่อกดง่าย */
@media (min-width: 1024px) {
  .content:has(> .de-wrap) { max-width: 1240px; }
}
.de-wrap { display: flex; flex-direction: column; gap: 14px; }

/* 1. Global Context Bar (Filter Strip) */
.de-ctx-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.de-ctx-left, .de-ctx-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.de-seg { display: inline-flex; align-items: center; padding: 3px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.de-seg-btn { border: 0; background: transparent; color: var(--gray); font-size: 12.5px; font-weight: 500; padding: 5px 11px; margin: 0; width: auto; border-radius: calc(var(--radius-sm) - 2px); cursor: pointer; white-space: nowrap; box-shadow: none; line-height: 1.2; }
.de-seg-btn.on { background: var(--green); color: #fff; font-weight: 600; }
.de-ctx-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12.5px; color: var(--gray); text-decoration: none; white-space: nowrap; box-shadow: var(--shadow); }
.de-ctx-chip b { color: var(--text); font-weight: 600; }
.de-ctx-chip:hover { border-color: var(--green); color: var(--text); }
.de-ctx-time { font-size: 12px; color: var(--gray); font-family: 'Inter', var(--font); font-variant-numeric: tabular-nums; white-space: nowrap; }
.de-ctx-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; margin: 0; width: auto; background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 500; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow); line-height: 1.2; }
.de-ctx-btn:hover { border-color: var(--green); color: var(--green); }
.de-ctx-btn.is-spin svg { animation: de-spin .7s linear infinite; }
@keyframes de-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.de-kbd { display: inline-block; padding: 1px 5px; font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); color: var(--gray); border: 1px solid var(--border); border-radius: 4px; line-height: 1.3; }

/* 2. KPI Row (4 equal-height cards on desktop, 2x2 on mobile) */
html .de-wrap .de-kpis,
html[data-theme] .de-wrap .de-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; align-items: stretch; }
@media (min-width: 760px) {
  html .de-wrap .de-kpis,
  html[data-theme] .de-wrap .de-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
}
html .de-wrap .de-kpis .kpi.de-kpi,
html[data-theme] .de-wrap .de-kpis .kpi.de-kpi {
  display: flex; flex-direction: column; justify-content: space-between; align-items: stretch; gap: 6px;
  padding: 14px 15px; background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--kpi-tone, var(--green));
  border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: inherit; min-width: 0;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
html .de-wrap .de-kpis .kpi.de-kpi.tone-k-green,
html[data-theme] .de-wrap .de-kpis .kpi.de-kpi.tone-k-green { --kpi-tone: #2e8540; }
html .de-wrap .de-kpis .kpi.de-kpi.tone-k-blue,
html[data-theme] .de-wrap .de-kpis .kpi.de-kpi.tone-k-blue { --kpi-tone: #0a6ed1; }
html .de-wrap .de-kpis .kpi.de-kpi.tone-k-amber,
html[data-theme] .de-wrap .de-kpis .kpi.de-kpi.tone-k-amber { --kpi-tone: #d97706; }
html .de-wrap .de-kpis .kpi.de-kpi.tone-k-purple,
html[data-theme] .de-wrap .de-kpis .kpi.de-kpi.tone-k-purple { --kpi-tone: #6d28d9; }
html .de-wrap .de-kpis .kpi.de-kpi.tone-k-red,
html[data-theme] .de-wrap .de-kpis .kpi.de-kpi.tone-k-red { --kpi-tone: #c0392b; }
html .de-wrap .de-kpis .kpi.de-kpi.tone-k-teal,
html[data-theme] .de-wrap .de-kpis .kpi.de-kpi.tone-k-teal { --kpi-tone: #0f766e; }
@media (hover: hover) {
  html .de-wrap .de-kpis a.kpi.de-kpi:hover,
  html[data-theme] .de-wrap .de-kpis a.kpi.de-kpi:hover { transform: translateY(-1px); border-color: var(--green); border-left-color: var(--kpi-tone, var(--green)); box-shadow: 0 4px 12px rgba(20, 45, 70, 0.08); }
}
.de-kpi-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.de-kpi-head .lbl { font-size: 12.5px; font-weight: 500; color: var(--gray); line-height: 1.35; }
.de-kpi-chev { color: var(--gray); font-size: 16px; line-height: 1; opacity: .65; flex-shrink: 0; }
html .de-wrap .de-kpis .kpi.de-kpi .num,
html[data-theme] .de-wrap .de-kpis .kpi.de-kpi .num { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.2; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.de-kpi-foot { display: flex; flex-direction: column; gap: 4px; }
.de-kpi-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.de-delta { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600; line-height: 1.3; white-space: nowrap; font-family: 'Inter', var(--font); font-variant-numeric: tabular-nums; }
.de-delta-up, .de-delta-ok { background: #dcfce7; color: #166534; }
.de-delta-bad { background: #fee2e2; color: #991b1b; }
.de-delta-neutral { background: var(--zebra, #f3f5f8); color: var(--gray); border: 1px solid var(--border); }
.de-kpi-foot .sub { font-size: 12px; color: var(--gray); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 3. Asymmetric 12-Col Grid (8 left : 4 right on Desktop · Ordered Stack on Mobile) */
html .de-wrap .de-grid,
html[data-theme] .de-wrap .de-grid { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.de-col-main, .de-col-side { display: contents; }
.de-slot { min-width: 0; display: flex; flex-direction: column; }
.de-slot > .card, .de-slot > div > .card { margin-bottom: 0; height: auto; }
.de-slot-shortcuts { order: 1; }
.de-slot-todo { order: 2; }
.de-slot-chart { order: 3; }
.de-slot-top_customers { order: 4; }
.de-slot-top_products { order: 5; }
.de-slot-menu_search { order: 6; }

@media (min-width: 1000px) {
  html .de-wrap .de-grid,
  html[data-theme] .de-wrap .de-grid { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: 14px; align-items: start; }
  html .de-wrap .de-grid.de-grid-single,
  html[data-theme] .de-wrap .de-grid.de-grid-single { grid-template-columns: minmax(0, 1fr); }
  .de-col-main, .de-col-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
  .de-slot { order: 0; }
}

/* 4. Unified Card Chrome */
.de-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 0; }
.de-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.de-card-title-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.de-card-title { margin: 0; font-size: 14.5px; font-weight: 700; color: var(--text); line-height: 1.3; }
html[data-theme="formal"] .de-card-title { color: #1d3557; }
.de-card-sub { font-size: 12px; color: var(--gray); margin-top: 2px; line-height: 1.35; }
.de-card-link { font-size: 12.5px; font-weight: 600; color: var(--green); text-decoration: none; white-space: nowrap; flex-shrink: 0; }
.de-card-link:hover { text-decoration: underline; }
.de-empty-txt { font-size: 13px; padding: 12px 0 4px; }

/* 5. Interactive Chart + Touch Readout Bar */
.de-ch-readout { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 8px 12px; margin-bottom: 8px; background: var(--zebra, #f6f8fa); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12.5px; }
.de-ch-nums { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-family: 'Inter', var(--font); font-variant-numeric: tabular-nums; }
.de-ch-month { color: var(--text); font-family: var(--font); }
.de-ch-item { display: inline-flex; align-items: center; gap: 5px; color: var(--gray); }
.de-ch-item b { color: var(--text); font-weight: 700; }
.de-ch-item i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.de-ch-item .lg-sales { background: #2e8540; }
.de-ch-item .lg-purchases { background: #f59e0b; }
html[data-theme] .de-ch-item .lg-purchases { background: var(--green); }
.de-ch-diff { font-weight: 600; font-size: 12px; }
.de-diff-pos { color: #15803d; }
.de-diff-neg { color: var(--red, #c0392b); }
.de-svg-wrap { width: 100%; overflow-x: auto; }
.de-dash-svg { width: 100%; min-width: 300px; height: auto; display: block; margin-top: 2px; }
.de-dash-svg .ch-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 3; }
.de-dash-svg .ch-grid.ch-axis { stroke-dasharray: none; }
.de-dash-svg .ch-y-lbl { fill: var(--gray); font-size: 11px; font-family: 'Inter', var(--font); }
.de-bar-hit { cursor: pointer; outline: none; }
.de-bar-band { fill: transparent; transition: fill .14s ease, opacity .14s ease; }
.de-bar-hit:hover .de-bar-band, .de-bar-hit:focus-visible .de-bar-band { fill: var(--green-light); opacity: .65; }
.de-bar-hit.is-sel .de-bar-band { fill: var(--green-light); opacity: .95; }
.de-bar-hit:not(.is-sel) .ch-bar-sales, .de-bar-hit:not(.is-sel) .ch-bar-purchases { opacity: .76; }
.de-bar-hit.is-sel .ch-label { fill: var(--text); font-weight: 700; }

/* 6. Work / Mini-Inbox Card */
.de-count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--red, #dc2626); color: #fff; font-size: 11.5px; font-weight: 700; font-family: 'Inter', var(--font); }
.de-grp-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.de-grp-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.de-grp-pill b { font-family: 'Inter', var(--font); font-variant-numeric: tabular-nums; }
.de-pill-bad { background: #fee2e2; color: #991b1b; }
.de-pill-warn { background: #fef3c7; color: #92400e; }
.de-pill-info { background: #e0f2fe; color: #075985; }
.de-inbox-list { display: flex; flex-direction: column; }
.de-inbox-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 9px 4px; border-top: 1px solid var(--border); text-decoration: none; color: inherit; transition: background .12s ease; border-radius: 4px; }
.de-inbox-row:first-child { border-top: 0; padding-top: 4px; }
@media (hover: hover) { .de-inbox-row:hover { background: var(--zebra, #f7f8fa); } }
.de-inbox-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.de-inbox-top { display: flex; align-items: flex-start; gap: 6px; flex-wrap: nowrap; }
.de-unread-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--green); flex-shrink: 0; margin-top: 6px; }
.de-tag { display: inline-flex; align-items: center; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; white-space: nowrap; flex-shrink: 0; margin-top: 1px; }
.de-inbox-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.35; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.de-inbox-sub { font-size: 11.5px; color: var(--gray); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.de-row-chev { color: var(--gray); font-size: 16px; line-height: 1.2; opacity: .6; flex-shrink: 0; }
.de-inbox-empty { text-align: center; padding: 16px 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.de-empty-ok { font-size: 13.5px; font-weight: 600; color: #166534; }
.de-inbox-more { display: block; text-align: center; padding: 9px 8px 2px; margin-top: 4px; border-top: 1px solid var(--border); font-size: 12.5px; font-weight: 600; color: var(--green); text-decoration: none; }
.de-inbox-more:hover { text-decoration: underline; }

/* 7. Quick Actions & Pinned Shortcuts */
.de-qa-row { display: flex; flex-wrap: wrap; gap: 8px; }
.de-qa-btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 13px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; transition: background .12s ease, border-color .12s ease; }
.de-qa-primary { background: var(--green); color: #fff; border: 1px solid var(--green); }
.de-qa-primary:hover { background: var(--green-dark, var(--green)); border-color: var(--green-dark, var(--green)); }
.de-qa-soft { background: var(--green-light); color: var(--green-dark, var(--green)); border: 1px solid transparent; }
.de-qa-soft:hover { border-color: var(--green); }
.de-pin-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.de-pin-wrap.de-pin-sep { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.de-pin-head { font-size: 12px; color: var(--gray); white-space: nowrap; }
.de-pin-list { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.de-pin-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 500; text-decoration: none; white-space: nowrap; transition: border-color .12s ease, color .12s ease; }
.de-pin-btn:hover { border-color: var(--green); color: var(--green); }
.de-pin-ico { display: inline-flex; color: var(--gray); }
.de-pin-btn:hover .de-pin-ico { color: var(--green); }
.de-pin-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red, #dc2626); color: #fff; font-size: 11px; font-weight: 700; font-family: 'Inter', var(--font); }
.de-pin-empty { font-size: 12.5px; }

/* 8. Top 5 Rankings (Numbered Circle) */
.de-rank-row { padding: 9px 0; gap: 10px; }
.de-rank-num { width: 24px; height: 24px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; font-size: 12px; font-weight: 700; font-family: 'Inter', var(--font); background: var(--zebra, #f3f5f8); color: var(--gray); border: 1px solid var(--border); }
.de-rank-num.is-top { background: var(--green); color: #fff; border-color: var(--green); }

/* 9. Menu Search Box (when header search hidden) */
.de-search-card { padding: 12px; }
.de-search-box { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; color: var(--gray); }
.de-search-inp { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; font-size: 14px; margin: 0; padding: 0; color: var(--text); box-shadow: none; }
.de-ms-list { margin-top: 6px; max-height: 320px; overflow-y: auto; }
.de-ms-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border); }
.de-ms-row:last-child { border-bottom: 0; }
.de-ms-ico { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--green-light); color: var(--green); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.de-ms-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.de-ms-lbl { font-size: 13.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.de-ms-sec { font-size: 11.5px; color: var(--gray); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.de-ms-empty { padding: 14px 8px; font-size: 13px; }

/* 10. Slide-Over Customize Drawer (#dashEdit) */
.de-drawer-backdrop { position: fixed; inset: 0; z-index: 120; background: rgba(15, 23, 42, 0.42); display: flex; justify-content: flex-end; }
.de-drawer { width: 100%; max-width: 390px; height: 100%; max-height: 100dvh; background: #fff; color: var(--text); display: flex; flex-direction: column; box-shadow: -8px 0 30px rgba(15, 23, 42, 0.18); }
.de-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.de-drawer-title { margin: 0; font-size: 16px; font-weight: 700; }
.de-drawer-sub { font-size: 12px; margin-top: 2px; }
.de-drawer-close { width: 34px; height: 34px; min-width: 34px; padding: 0; margin: 0; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.de-drawer-body { flex: 1; overflow-y: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 16px; }
.de-sec-lbl { font-size: 12px; font-weight: 700; color: var(--gray); margin-bottom: 6px; }
.de-sec-hint { font-size: 12px; margin-top: 4px; line-height: 1.4; }
.de-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.de-choice { display: flex; align-items: center; gap: 7px; padding: 9px 10px; margin: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; font-size: 13px; font-weight: 500; cursor: pointer; }
.de-choice input { width: auto; margin: 0; flex-shrink: 0; }
.de-choice.on { border-color: var(--green); background: var(--green-light); color: var(--green-dark, var(--green)); font-weight: 600; }
.de-drawer-shortcut-link { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); text-decoration: none; color: var(--text); font-size: 13px; font-weight: 600; background: var(--zebra, #f7f8fa); }
.de-drawer-shortcut-link:hover { border-color: var(--green); color: var(--green); }
.de-drawer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); background: #fff; flex-shrink: 0; }
.de-drawer-foot button { width: auto; margin: 0; }

/* 11. Global Command Palette (⌘K) */
.de-cmd-backdrop { position: fixed; inset: 0; z-index: 130; background: rgba(15, 23, 42, 0.45); display: flex; align-items: flex-start; justify-content: center; padding: 14px; padding-top: min(12vh, 84px); }
.de-cmd-box { width: 100%; max-width: 540px; background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25); overflow: hidden; }
.de-cmd-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--gray); }
.de-cmd-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14.5px; color: var(--text); margin: 0; padding: 0; box-shadow: none; }
.de-cmd-esc { width: auto; margin: 0; padding: 3px 7px; font-size: 11px; font-weight: 600; background: var(--bg); color: var(--gray); border: 1px solid var(--border); border-radius: 4px; cursor: pointer; box-shadow: none; }
.de-cmd-list { max-height: min(56vh, 380px); overflow-y: auto; }
.de-cmd-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border); }
.de-cmd-item:last-child { border-bottom: 0; }
.de-cmd-item.on, .de-cmd-item:hover { background: var(--green-light); }
.de-cmd-enter { font-size: 12px; color: var(--gray); flex-shrink: 0; }

/* Compact Density Support */
html[data-density="compact"] .de-card { padding: 12px 14px; }
html[data-density="compact"] .de-wrap .de-kpis .kpi.de-kpi { padding: 11px 13px; }
html[data-density="compact"] .de-inbox-row,
html[data-density="compact"] .de-rank-row { padding-top: 7px; padding-bottom: 7px; }

/* Mobile Refinements (≤ 600px) */
@media (max-width: 600px) {
  .de-wrap { gap: 10px; }
  .de-ctx-time, .de-ctx-close, .de-ctx-lbl, .de-kbd { display: none; }
  .de-ctx-btn { padding: 7px 9px; }
  .de-seg-btn { padding: 5px 9px; font-size: 12px; }
  html .de-wrap .de-kpis .kpi.de-kpi,
  html[data-theme] .de-wrap .de-kpis .kpi.de-kpi { padding: 11px 11px 11px 10px; gap: 4px; }
  html .de-wrap .de-kpis .kpi.de-kpi .num,
  html[data-theme] .de-wrap .de-kpis .kpi.de-kpi .num { font-size: clamp(15px, 4.6vw, 21px); }
  .de-card { padding: 13px; }
  .de-qa-btn { flex: 1 1 calc(50% - 4px); padding: 8px 10px; font-size: 12.5px; }
  .de-ch-readout { padding: 7px 10px; }
}

/* ============ Unified ERP Design System (Phases 1–4) ============ */
.inbox-btn.active { background: rgba(255, 255, 255, .24); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .55); }
html[data-theme="bright"] .inbox-btn.active { background: var(--green-light); color: var(--green); box-shadow: inset 0 0 0 1.5px var(--green); }

/* Unified Horizontal Underline Tabs (never converted to <select> on mobile) */
.erp-tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--border); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; margin: 4px 0 12px; }
.erp-tabs::-webkit-scrollbar { display: none; }
.erp-tab { flex: 0 0 auto; width: auto; margin: 0; padding: 9px 13px; background: transparent; border: 0; border-bottom: 2.5px solid transparent; border-radius: 0; color: var(--gray); font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; box-shadow: none; display: inline-flex; align-items: center; gap: 6px; transition: color .15s, border-color .15s; }
.erp-tab:hover { color: var(--text); background: transparent; }
.erp-tab.active { color: var(--green); border-bottom-color: var(--green); }
.erp-tab-cnt { font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 99px; background: var(--bg); color: var(--gray); }
.erp-tab.active .erp-tab-cnt { background: var(--green-light); color: var(--green); }

/* SAP Fiori Smart Filter Bar (Primary 1-row + Collapsible Advanced Filters) */
.erp-fbar { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.erp-fbar-main { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.erp-fbar-main > input, .erp-fbar-main > select { width: auto; flex: 1 1 160px; min-width: 120px; margin: 0; }
.erp-fbar-main > input[type="date"], .erp-fbar-main > .date-field { width: auto; flex: 0 1 175px; min-width: 145px; margin: 0; }
.erp-fbar-adv { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius, 8px); }
.erp-fbar-adv > input, .erp-fbar-adv > select { width: auto; flex: 1 1 170px; min-width: 130px; margin: 0; }
.erp-fbar-adv > input[type="date"], .erp-fbar-adv > .date-field { width: auto; flex: 0 1 175px; min-width: 145px; margin: 0; }
.erp-adv-btn { flex: 0 0 auto; width: auto; margin: 0; padding: 8px 12px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.erp-adv-btn.has-on { border-color: var(--green); color: var(--green); background: var(--green-light); }
.erp-adv-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--green); color: #fff; font-size: 11px; font-weight: 700; }

/* Action Overflow Menu (⋯) */
.erp-more { position: relative; display: inline-block; }
.erp-more > summary { list-style: none; }
.erp-more > summary::-webkit-details-marker { display: none; }
.erp-more-btn { width: auto; margin: 0; padding: 5px 10px; font-size: 15px; line-height: 1.2; cursor: pointer; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }
.erp-more-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; min-width: 185px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(15, 23, 42, .16); padding: 5px; display: flex; flex-direction: column; gap: 2px; }
.erp-more-menu > a, .erp-more-menu > button { display: flex; align-items: center; gap: 6px; width: 100%; margin: 0; padding: 8px 10px; text-align: left; justify-content: flex-start; background: transparent; border: 0; border-radius: 6px; color: var(--text); font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer; box-shadow: none; }
.erp-more-menu > a:hover, .erp-more-menu > button:hover { background: var(--bg); }
.erp-more-menu > button.danger, .erp-more-menu > a.danger { color: var(--red, #dc2626); }

/* Grouped Form Section Card */
.erp-sec-card { border: 1px solid var(--border); border-radius: var(--radius, 8px); padding: 12px 14px; margin: 10px 0; background: var(--card); }
.erp-sec-head { font-size: 14px; font-weight: 700; color: var(--text); margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.erp-sec-card .su-58f8fc:last-child, .erp-sec-card .su-941456:last-child { margin-bottom: 0; }

/* Unified Search Row & Compact KPI Strip */
.erp-search-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.erp-search-row > input[type="search"], .erp-search-row > input[type="text"] { flex: 1 1 200px; min-width: 0; margin: 0; }
.erp-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 10px 0; }
.erp-kpis-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.erp-kpi { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius, 8px); padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; text-decoration: none; color: inherit; min-width: 0; }
.erp-kpi-lbl { font-size: 12px; color: var(--gray); font-weight: 500; }
.erp-kpi-val { font-size: 18px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.erp-kpi.warn .erp-kpi-val { color: var(--red, #dc2626); }
.erp-kpi.ok .erp-kpi-val { color: var(--green); }

/* Inbox Assign Button Label & Drawer Collapsible Shortcuts */
.ib-send-btn { width: auto; padding: 6px 10px; gap: 5px; font-size: 13px; font-weight: 600; }
.de-sec-fold > summary { cursor: pointer; padding: 4px 0; user-select: none; }

/* Inline-row action wrap & compact modal/toggle box */
.erp-row-acts { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.erp-ded-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin: 8px 0; background: var(--bg); }
.erp-danger-note { border-left: 3px solid var(--red, #dc2626); padding: 8px 12px; background: rgba(220, 38, 38, .06); border-radius: 6px; font-size: 13px; margin: 8px 0; }
.rep-gdesc { font-size: 12.5px; margin: -2px 0 8px; padding-left: 4px; }
.rep-closed .rep-gdesc { display: none; }
.w-100 { flex: 1 1 100%; width: 100%; }

@media (max-width: 600px) {
  .ib-send-lbl { display: none; }
  .erp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .erp-kpis > .erp-kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .erp-kpi-val { font-size: 16px; }
  .erp-fbar-main > input, .erp-fbar-main > select, .erp-fbar-main > .date-field, .erp-fbar-adv > input, .erp-fbar-adv > select, .erp-fbar-adv > .date-field { flex: 1 1 100%; }
  .erp-adv-btn { width: 100%; justify-content: center; }
  .erp-more-menu { right: 0; max-width: calc(100vw - 32px); }
}

/* ==================== Phase 5: Executive Pro-ERP Visual Polish ==================== */

/* Hub Search + 1-Click Category Chips */
.erp-hub-bar { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 18px; }
.erp-hub-chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 1px 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.erp-hub-chips::-webkit-scrollbar { display: none; }
.erp-chip { flex: 0 0 auto; width: auto; margin: 0; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: var(--gray); font-size: 12.5px; font-weight: 500; cursor: pointer; white-space: nowrap; box-shadow: none; transition: background .14s ease, color .14s ease, border-color .14s ease; }
.erp-chip:hover { color: var(--text); border-color: #c5bea8; background: var(--zebra); }
.erp-chip.active { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.rep-cat-chips { margin: -4px 0 14px; }

/* Group Count Pill */
.erp-grp-cnt { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--zebra); border: 1px solid var(--border); color: var(--gray); font-size: 11px; font-weight: 600; margin-left: auto; }

/* Executive Menu Hub Card Grid (#/entry, #/finance, #/admin) */
.erp-hub-card .entry-group { padding: 0; margin-bottom: 22px; }
.erp-hub-card .entry-group:last-of-type { margin-bottom: 4px; }
.erp-hub-card .entry-group-title { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 6px; padding: 0 2px; color: var(--text); }
.erp-hub-card .entry-group-desc { font-size: 12.5px; color: var(--gray); margin: -2px 0 10px; padding-left: 18px; }
.erp-hub-card .entry-group .type-grid { display: grid; grid-template-columns: 1fr; gap: 8px; background: transparent; border: 0; box-shadow: none; padding: 0; border-radius: 0; }
.erp-hub-card .entry-group .type-btn {
  display: grid; grid-template-columns: 42px 1fr 16px; grid-template-areas: "ico lbl arr" "ico hint arr";
  column-gap: 12px; align-items: center; padding: 12px 14px; margin: 0;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); text-align: left;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease, background .15s ease;
}
.erp-hub-card .entry-group .type-btn .emoji { width: 42px; height: 42px; border-radius: 10px; font-size: 19px; }
.erp-hub-card .entry-group .type-btn .lbl { font-size: 14px; font-weight: 600; color: var(--text); }
.erp-hub-card .entry-group .type-btn .type-hint { font-size: 12px; color: var(--gray); line-height: 1.35; margin-top: 2px; }
.erp-hub-card .entry-group .type-btn::after { transition: transform .15s ease, color .15s ease; }
@media (hover: hover) {
  .erp-hub-card .entry-group .type-btn:hover {
    border-color: var(--green); box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
    transform: translateY(-1px); background: #fff;
  }
  .erp-hub-card .entry-group .type-btn:hover .lbl { color: var(--green); }
  .erp-hub-card .entry-group .type-btn:hover::after { color: var(--green); transform: translateX(2px); }
}
@media (min-width: 720px) {
  .erp-hub-card .entry-group .type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
@media (min-width: 1120px) {
  .erp-hub-card .entry-group .type-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
}

/* Executive Reports Catalog (2-Column Desktop Grid + Tinted Group Header) */
.rep-menu .rep-group { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04); margin-bottom: 12px; }
.rep-menu button.rep-group-head { background: var(--zebra); padding: 11px 16px; min-height: 46px; font-size: 14.5px; }
.rep-menu .rep-gdesc { padding: 6px 16px 8px; margin: 0; background: var(--zebra); border-bottom: 1px solid var(--border); font-size: 12px; }
.rep-menu .rep-row { transition: background .12s ease; }
@media (hover: hover) {
  .rep-menu .rep-row:hover { background: var(--zebra); }
  .rep-menu .rep-row:hover a.rep-btn .lbl { color: var(--green); }
}
.rep-menu .rep-row a.rep-btn { padding: 10px 6px 10px 16px; }
.rep-menu .rep-row a.rep-btn .lbl { font-size: 14px; font-weight: 600; }
@media (min-width: 860px) {
  .rep-menu .rep-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rep-menu .rep-row:nth-child(even) { border-left: 1px solid var(--border); }
  .rep-menu .rep-quick { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* KPI Tiles & Form Section Cards Polish */
.erp-kpi { background: #fff; border: 1px solid var(--border); border-left: 3px solid var(--green); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); padding: 11px 14px; }
.erp-kpi.warn { border-left-color: var(--red, #dc2626); }
.erp-kpi.ok { border-left-color: var(--green); }
.erp-sec-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
.erp-sec-head { font-size: 14px; font-weight: 700; color: var(--text); margin: -14px -16px 12px; padding: 10px 16px; background: var(--zebra); border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }

/* Tables & Form Controls Crisp Polish */
.table-wrap table td.num, .table-wrap table th.num, .stockcell { font-variant-numeric: tabular-nums; }
@media (hover: hover) {
  .table-wrap table tbody tr:not(.total-row):hover { background: var(--zebra); }
}
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-light);
}

/* Polished Bottom Navigation Bar */
.bottomnav { box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.05); }
.bottomnav a { transition: background .12s ease, color .12s ease; }



