/* ==== ระบบดีไซน์ มังกรยางกูซ่า ==== */
:root {
  --bg: #f7f6f4;
  --surface: #ffffff;
  --surface-2: #f1efec;
  --border: #e4e1db;
  --text: #1c1a17;
  --text-muted: #6b6459;
  --brand: #ea580c;
  --brand-strong: #c2410c;
  --brand-soft: #ffedd5;
  --gold: #b8860b;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #16a34a;
  --ok-soft: #f0fdf4;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --shadow: 0 1px 2px rgba(20,16,10,0.06), 0 4px 16px rgba(20,16,10,0.06);
  --radius: 12px;
  /* จานสี categorical แบบลำดับคงที่ สำหรับกราฟสัดส่วน (แยกกลุ่มสินค้า) — ผ่านการตรวจ CVD/contrast แล้ว อย่าสลับลำดับ */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #4a3aa7; --series-8: #e34948;
  --series-other: #a8a296;
}

:root[data-theme="dark"] {
  --bg: #15140f;
  --surface: #1f1d18;
  --surface-2: #262319;
  --border: #35311f;
  --text: #f3f1ec;
  --text-muted: #a89f8d;
  --brand: #fb923c;
  --brand-strong: #f97316;
  --brand-soft: #3a2410;
  --gold: #d4a72c;
  --danger: #f87171;
  --danger-soft: #2b1414;
  --ok: #4ade80;
  --ok-soft: #10241a;
  --warn: #fbbf24;
  --warn-soft: #2a2010;
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.35);
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --series-other: #6f6a5c;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Anuphan', 'Noto Sans Thai', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ---- App shell ---- */
/* เมนูซ้ายเป็นลิ้นชักพับเก็บได้ทุกขนาดจอ (กดปุ่มเมนูมุมซ้ายบนเพื่อเปิด) — โทนเข้มทั้งโหมดสว่าง/มืด */
:root {
  --side-bg: #17140f; --side-bg-2: #211d16; --side-border: #2f2a20;
  --side-text: #e9e5dc; --side-muted: #9a917f; --side-hover: rgba(255,255,255,0.06);
}
.app-shell { display: flex; min-height: 100vh; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; flex: none; display: flex; align-items: center; justify-content: center;
  font-size: 21px; background: linear-gradient(145deg, #f97316, #c2410c); box-shadow: 0 4px 12px rgba(234,88,12,0.35);
}
.brand-text { min-width: 0; }
.brand-name { font-weight: 700; font-size: 16px; line-height: 1.25; }
.brand-sub { font-size: 12px; color: var(--text-muted); line-height: 1.3; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 14px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-title { padding: 6px 12px 4px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; color: var(--side-muted); }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--side-text); font-size: 14.5px; font-weight: 500;
  min-height: 44px; position: relative; transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--side-hover); }
.nav-link.active { background: rgba(249,115,22,0.16); color: #fdba74; font-weight: 600; }
.nav-link.active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: #f97316;
}
.nav-link:focus-visible, .drawer-logout:focus-visible { outline: 2px solid #fb923c; outline-offset: -2px; }
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; }
:root[data-theme="light"] .theme-icon-dark, :root:not([data-theme="dark"]) .theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-light { display: none; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-weight: 700; font-size: 17px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user { display: flex; align-items: center; gap: 8px; }
.topbar-chip { display: flex; align-items: center; gap: 9px; padding: 3px 12px 3px 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.topbar-chip-text { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 13.5px; font-weight: 600; }
.user-role { font-size: 11.5px; color: var(--text-muted); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #fb923c, #c2410c); color: #fff; font-weight: 700; font-size: 15px;
}
.avatar--sm { width: 30px; height: 30px; font-size: 13px; }
.menu-btn { display: inline-flex; }
.icon-btn {
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; flex: none;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.icon-btn svg { width: 20px; height: 20px; }
.content { padding: 22px 24px 32px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---- Drawer (ทุกขนาดจอ) ---- */
.drawer {
  position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh; width: 288px; max-width: 86vw;
  background: var(--side-bg); color: var(--side-text); z-index: 60; transform: translateX(-100%); visibility: hidden;
  transition: transform 0.24s cubic-bezier(.2,.8,.2,1), visibility 0s linear 0.24s; display: flex; flex-direction: column;
  box-shadow: 8px 0 32px rgba(0,0,0,0.28);
}
.drawer.open { transform: translateX(0); visibility: visible; transition: transform 0.24s cubic-bezier(.2,.8,.2,1); }
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(10,8,5,0.55); z-index: 55; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 14px 14px 16px; border-bottom: 1px solid var(--side-border); }
.drawer .brand-sub { color: var(--side-muted); }
.drawer .icon-btn { background: transparent; border-color: var(--side-border); color: var(--side-text); }
.drawer .icon-btn:hover { background: var(--side-hover); }
.drawer-user { border-top: 1px solid var(--side-border); padding: 12px; display: flex; flex-direction: column; gap: 8px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.drawer-user-info { display: flex; align-items: center; gap: 11px; padding: 6px 6px 2px; min-width: 0; }
.drawer-user-text { min-width: 0; }
.drawer-user-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-user-role { font-size: 12px; color: var(--side-muted); }
.drawer-logout {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; min-height: 44px; border-radius: 10px;
  border: 1px solid var(--side-border); background: transparent; color: var(--side-text); font-size: 14.5px; font-weight: 500; cursor: pointer;
}
.drawer-logout:hover { background: var(--side-hover); }
body.drawer-open { overflow: hidden; }

@media (max-width: 900px) {
  .content { padding: 14px 14px 28px; }
  .topbar { padding: 10px 14px; }
  .topbar-chip-text { display: none; }
  .topbar-chip { padding: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer-backdrop { transition: none; }
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 10px; font-size: 14.5px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: filter 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
/* ใช้กับ <a class="btn"> ที่ต้อง "ปิดใช้งาน" ชั่วคราว เพราะ <a> ไม่มี attribute disabled จริงแบบปุ่ม */
.btn-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
/* .btn ตั้ง display: inline-flex เอาไว้ตรง ๆ จึงชนะกฎ [hidden]{display:none} ของเบราว์เซอร์เสมอ (ปุ่ม/ลิงก์ที่ toggle ด้วย .hidden = true จาก JS จึงต้องมีกฎนี้กำกับไว้ด้วย ไม่งั้นจะไม่ถูกซ่อนจริง) */
.btn[hidden] { display: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { filter: brightness(0.94); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.94); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.w-full { width: 100%; }

/* ---- Forms ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
/* .field{display:flex} เป็น author rule ที่ชนะ [hidden]{display:none} ของ UA stylesheet เสมอ (เหมือน .btn/.pm-card ด้านบน) */
.field[hidden] { display: none; }
.field-label { font-size: 13.5px; font-weight: 600; color: var(--text-muted); }
.field-hint { font-size: 12px; color: var(--text-muted); }
/* ---- Menu access checkboxes (หน้าผู้ใช้งานและสิทธิ์ — ติ๊กเลือกเมนูที่พนักงานแต่ละคนเห็นได้) ---- */
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-subtle, var(--surface)); }
.checkbox-item { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 400; color: var(--text); }
.checkbox-item input[type="checkbox"] { width: 16px; height: 16px; flex-shrink: 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="tel"], input[type="search"], select, textarea {
  min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 15px; width: 100%;
}
textarea { min-height: 88px; padding: 10px 14px; resize: vertical; }

/* ---- Dropdown (<select>) ทั้งระบบ ----
   เดิมปล่อยให้เบราว์เซอร์/OS วาดลูกศรเริ่มต้นเอง (หน้าตาไม่เหมือนกันในแต่ละเครื่อง และไม่เข้ากับดีไซน์โทนอบอุ่นของระบบ)
   เปลี่ยนมาปิดสไตล์เริ่มต้น (appearance: none) แล้ววาดลูกศรเองด้วย SVG สีเข้ากับธีม + เว้นที่ด้านขวาให้ลูกศรพอดี
   พร้อม hover/cursor ให้รู้สึกว่ากดเลือกได้ชัดเจนขึ้น — เป็น CSS กลาง ใช้ได้กับ <select> ทุกตัวในทุกหน้าอัตโนมัติ ไม่ต้องแก้ทีละหน้า */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 38px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b6459' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 11px 7px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
select:hover:not(:disabled) { border-color: var(--text-muted); }
select:disabled { cursor: not-allowed; }
/* Firefox: เอาเส้นประ focus ภายในออก ใช้ outline ของระบบแทน (กำหนดด้านล่างร่วมกับ input/textarea) */
select:-moz-focusring { color: transparent; text-shadow: 0 0 0 var(--text); }
select::-ms-expand { display: none; }
:root[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23a89f8d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ---- Custom Dropdown (ครอบ <select> ทุกตัวด้วย UI ที่ออกแบบเอง) ----
   เหตุผลที่ต้องทำเพิ่มจาก CSS ของ <select> ด้านบน: ตัว "แผงตัวเลือก" ที่เปิดขึ้นมาตอนกด <select>
   เป็นเมนูของเบราว์เซอร์/OS โดยตรง (native) — CSS ปรับแต่งหน้าตาตอน "เปิด" ไม่ได้เลยไม่ว่าเบราว์เซอร์ไหน
   (ปรับได้แค่กล่องตอนปิด ซึ่งทำไปแล้วด้านบน) จึงต้องสร้างปุ่ม + แผงลอยของเราเองมาแทนทั้งชุด ให้เข้าธีมร้านทั้งตอนปิดและเปิด
   ดู JS การต่อที่ common.js (enhanceSelect) — <select> จริงยังอยู่ใน DOM เสมอ ถูกซ่อนด้วย .csel-native เท่านั้น
   เพื่อให้โค้ดเดิมที่อ่าน/ตั้งค่า .value, .disabled, .hidden ของแต่ละหน้ายังทำงานได้ปกติทั้งหมดโดยไม่ต้องแก้โค้ดจุดอื่น */
.csel { position: relative; width: 100%; }
.csel[hidden] { display: none; }
.csel-native {
  position: absolute !important; opacity: 0; width: 1px; height: 1px; padding: 0; margin: 0;
  border: none; overflow: hidden; pointer-events: none; clip: rect(0 0 0 0); white-space: nowrap;
}
.csel-btn {
  min-height: 44px; padding: 0 38px 0 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 15px; width: 100%; position: relative;
  display: flex; align-items: center; gap: 8px; cursor: pointer; text-align: left; font-family: inherit;
  transition: border-color 0.15s ease;
}
.csel-btn:hover:not(.csel-btn--disabled) { border-color: var(--text-muted); }
.csel-btn:focus-visible, .csel-btn[aria-expanded="true"] { outline: 2px solid var(--brand); outline-offset: 1px; }
.csel-btn--disabled { cursor: not-allowed; opacity: 0.6; }
.csel-btn-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.csel-caret {
  position: absolute; right: 14px; top: 50%; width: 11px; height: 7px; margin-top: -3px; pointer-events: none;
  background: no-repeat center / contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b6459' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] .csel-caret {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23a89f8d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* แผงตัวเลือก — ย้ายไปแปะที่ document.body ตอนเปิดเสมอ (ดู JS) กันปัญหาโดนตัดขอบเวลา <select> อยู่ในกล่องที่มี overflow (เช่น Modal) */
.csel-panel {
  position: fixed; z-index: 80; max-height: 280px; overflow-y: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
}
.csel-panel[hidden] { display: none; }
.csel-option { padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--text); }
.csel-option:hover, .csel-option.csel-option--active { background: var(--surface-2); }
.csel-option.csel-option--selected { color: var(--brand); font-weight: 600; }
.csel-option.csel-option--disabled { color: var(--text-muted); cursor: not-allowed; pointer-events: none; }
.csel-empty { padding: 14px 10px; color: var(--text-muted); font-size: 13.5px; text-align: center; }
/* ตัวย่อขนาดเล็ก ใช้กับจุดที่เดิมเป็น select ขนาดกะทัดรัด เช่น ตัวเลือก Lot ในแถวตะกร้า */
.csel--sm .csel-btn { min-height: 36px; font-size: 13px; padding: 0 30px 0 10px; }
.csel--sm .csel-caret { right: 10px; width: 10px; height: 6px; margin-top: -3px; }

/* ---- Custom Tooltip (ครอบ title="" / <title> ของ SVG) ----
   กล่องข้อความเดิมที่เบราว์เซอร์/OS วาดเองตอน hover (เช่นจุดข้อมูลในกราฟแดชบอร์ด) ปรับแต่งด้วย CSS ไม่ได้เลย
   เปลี่ยนมาใช้กล่องลอยที่สร้างเอง สีกลับด้าน (พื้นเข้ม/ตัวอักษรสว่าง) เหมือน toast แบบ info ที่ใช้อยู่แล้วในระบบ ให้เข้าชุดกัน
   ดู JS การต่อที่ common.js — ใส่ data-tooltip หรือ data-tooltip-html ที่ element ใดก็ได้ ใช้งานได้ทันทีอัตโนมัติ */
.cstip {
  position: fixed; z-index: 90; max-width: 260px; pointer-events: none;
  background: var(--text); color: var(--bg); font-size: 12.5px; line-height: 1.5;
  padding: 8px 10px; border-radius: 8px; box-shadow: var(--shadow);
}
.cstip[hidden] { display: none; }
.cstip::after {
  content: ""; position: absolute; left: var(--cstip-arrow-left, 50%); width: 8px; height: 8px;
  background: var(--text); transform: translateX(-50%) rotate(45deg);
}
.cstip[data-placement="top"]::after { bottom: -4px; }
.cstip[data-placement="bottom"]::after { top: -4px; }
.cstip-title { font-weight: 600; margin-bottom: 4px; }
.cstip-row { display: flex; justify-content: space-between; gap: 14px; }
.cstip-row + .cstip-row { margin-top: 1px; }

input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
input:disabled, select:disabled { opacity: 0.6; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.form-error {
  background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger);
  border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-bottom: 12px;
}
.form-success {
  background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok);
  border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-bottom: 12px;
}
.form-warn {
  background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn);
  border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 12px;
}
.form-warn a { color: inherit; text-decoration: underline; font-weight: 600; }

/* ---- Card / table ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-title { font-weight: 600; font-size: 16px; margin: 0 0 12px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); cursor: grab; }
.table-scroll.dragging { cursor: grabbing; user-select: none; }
.table-scroll.dragging * { user-select: none; }
table { border-collapse: collapse; width: 100%; min-width: 640px; background: var(--surface); }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 14px; white-space: nowrap; }
th { color: var(--text-muted); font-weight: 600; font-size: 13px; background: var(--surface-2); position: sticky; top: 0; }
tbody tr:hover { background: var(--surface-2); }
.clickable-row { cursor: pointer; }
.clickable-row .actions-cell { cursor: default; }
td.wrap, th.wrap { white-space: normal; }

/* สีทั้งแถวตามสถานะสินค้าคงเหลือ (หน้าสินค้าคงเหลือ) — ปกติ=เขียวอ่อน, ใกล้หมด=ส้มอ่อน, หมด=แดงอ่อน
   แถบสีซ้าย (border-left) เข้มกว่าพื้นหลัง ให้กวาดตาเห็นสถานะได้ทันทีโดยไม่ต้องอ่านคอลัมน์สถานะทีละแถว */
tr.row-status-ok { background: var(--ok-soft); border-left: 3px solid var(--ok); }
tr.row-status-warn { background: var(--warn-soft); border-left: 3px solid var(--warn); }
tr.row-status-danger { background: var(--danger-soft); border-left: 3px solid var(--danger); }
tbody tr.row-status-ok:hover { background: var(--ok-soft); filter: brightness(0.95); }
tbody tr.row-status-warn:hover { background: var(--warn-soft); filter: brightness(0.95); }
tbody tr.row-status-danger:hover { background: var(--danger-soft); filter: brightness(0.95); }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.badge-role { background: var(--brand-soft); color: var(--brand-strong); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: var(--surface-2); color: var(--text-muted); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 16px; }
/* แถวการ์ดหลัก (ตัวเลขเงินสำคัญ) — การ์ดใหญ่กว่า ขึ้นก่อนแถวรอง ให้สัดส่วนความสำคัญของหน้าดูง่ายตั้งแต่แวบแรก */
/* ช่องไฟ (gap/margin) ใช้ 16px เท่ากันทุกจุดในหน้านี้ — ระหว่างการ์ด, ระหว่างแถว, และระหว่างคอลัมน์ */
.stat-grid--primary { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat-card { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 44px 16px 16px; box-shadow: var(--shadow); }
.stat-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--border); }
.stat-card--lg { padding: 22px 48px 20px 20px; }
.stat-card--lg .stat-value { font-size: 28px; }
.stat-icon { position: absolute; top: 14px; right: 14px; font-size: 18px; line-height: 1; opacity: 0.55; }
.stat-card--lg .stat-icon { top: 18px; right: 18px; font-size: 21px; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ป้ายเปอร์เซ็นต์เปลี่ยนแปลงเทียบช่วงก่อนหน้า บนการ์ดหลัก */
.stat-delta-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.stat-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; line-height: 1.5; white-space: nowrap; }
.stat-badge--ok { background: var(--ok-soft); color: var(--ok); }
.stat-badge--danger { background: var(--danger-soft); color: var(--danger); }
.stat-delta-caption { font-size: 11px; color: var(--text-muted); }

/* แถวสองคอลัมน์ (กราฟยอดขาย + สัดส่วนตามกลุ่มสินค้า/ลูกค้า) — เคียงกันบนจอกว้าง ซ้อนกันบนมือถือ
   ใช้ align-items: stretch (ไม่ใช่ start) ให้ทั้งสองคอลัมน์สูงเท่ากันเสมอ การ์ดกราฟจะยืดตามคอลัมน์ขวาที่มักสูงกว่า
   (เพราะมีรายการกลุ่มสินค้าหลายแถว) แทนที่จะเหลือพื้นที่ว่างเป็นแถบขาวด้านล่างเหมือนเดิม ดูสมส่วนกันทั้งแถว */
.dash-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: stretch; }
.dash-row > .card { margin-bottom: 0; display: flex; flex-direction: column; }
.dash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dash-col > .card { margin-bottom: 0; }
/* กราฟถูกยืดการ์ดให้สูงเท่าคอลัมน์ขวา — จัดกราฟให้อยู่กึ่งกลางแนวตั้งของพื้นที่ที่เหลือ แทนที่จะค้างอยู่บนสุดแล้วเหลือที่ว่างด้านล่าง */
#chartWrap { flex: 1; display: flex; flex-direction: column; justify-content: center; }
#chartWrap > div { width: 100%; }
#bestSellerWrap { flex: 1; }
#storeHealthWrap { flex: 1; display: flex; flex-direction: column; justify-content: center; }
@media (max-width: 860px) { .dash-row { grid-template-columns: 1fr; } .dash-row > .card { display: block; } #chartWrap { display: block; } }

/* แท่งสัดส่วน (part-to-whole) ยอดขายตามกลุ่มสินค้า */
.proportion-bar-track { display: flex; height: 30px; border-radius: 8px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.proportion-segment { height: 100%; min-width: 3px; }
.proportion-segment:first-child { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.proportion-segment:last-child { border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
.proportion-legend { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.proportion-legend-item { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.proportion-swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.proportion-legend-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proportion-legend-value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* กริดไลน์/ป้ายแกน + เส้น/พื้นที่ไล่สีของกราฟยอดขาย SVG */
.chart-gridline { stroke: var(--border); stroke-width: 1; }
.chart-axis-label { font-size: 10px; fill: var(--text-muted); }
.chart-line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { pointer-events: none; }
.chart-point { fill: var(--brand); stroke: var(--surface); stroke-width: 2; transition: r 0.12s; }
.chart-hit { fill: transparent; cursor: pointer; outline: none; }
.chart-hit:hover, .chart-hit:focus-visible { fill: var(--brand); opacity: 0.08; }

/* รายการแท่งจัดอันดับ (สินค้าขายดี) — เลขอันดับ + แท่งยาวตามสัดส่วนจำนวนขาย + ตัวเลขกำกับด้านขวา */
.rank-list { display: flex; flex-direction: column; gap: 14px; }
.rank-row { display: flex; align-items: center; gap: 12px; }
.rank-num { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); color: var(--text-muted); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.rank-body { flex: 1; min-width: 0; }
.rank-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; margin-bottom: 5px; }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.rank-sku { flex: none; font-size: 11px; }
.rank-bar-track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.rank-bar-fill { height: 100%; border-radius: 4px; background: var(--brand); }
.rank-value { flex: none; text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.rank-value-sub { font-size: 12px; margin-top: 1px; }

/* มาตรวัดครึ่งวงกลม (gauge) สำหรับตัวเลขสุขภาพร้าน */
.gauge-wrap { position: relative; display: flex; justify-content: center; align-items: flex-end; flex: 1; }
.gauge-svg { width: 100%; max-width: 240px; height: auto; }
.gauge-track { stroke: var(--surface-2); }
.gauge-fill { stroke-linecap: round; transition: stroke-dashoffset 0.3s ease; }
.gauge-fill--ok { stroke: var(--ok); }
.gauge-fill--warn { stroke: var(--warn); }
.gauge-fill--danger { stroke: var(--danger); }
.gauge-center { position: absolute; top: 62%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
.gauge-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gauge-title { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* โทนสีการ์ดสรุปยอด — สื่อความหมายของตัวเลข ไม่ใช่แค่ตกแต่ง (ยอดขาย=สีหลักร้าน, กำไร/สินค้าใกล้หมด-หมด=สถานะ, ต้นทุน/มูลค่าสต๊อก=โทนทอง) */
.stat-card--brand::before { background: var(--brand); }
.stat-card--brand .stat-value { color: var(--brand); }
.stat-card--ok::before { background: var(--ok); }
.stat-card--ok .stat-value { color: var(--ok); }
.stat-card--warn::before { background: var(--warn); }
.stat-card--warn .stat-value { color: var(--warn); }
.stat-card--danger::before { background: var(--danger); }
.stat-card--danger .stat-value { color: var(--danger); }
.stat-card--gold::before { background: var(--gold); }
.stat-card--gold .stat-value { color: var(--gold); }
.stat-card--neutral::before { background: var(--border); }

/* การ์ดสรุปสถานะที่คลิกได้ (เช่น หน้าสินค้าคงเหลือ) — คลิกเพื่อกรองตารางด้านล่างตามสถานะนั้น */
.stat-card--clickable { display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s, background 0.15s; }
.stat-card--clickable:hover { border-color: var(--brand); }
.stat-card--clickable:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.stat-card--active { border-color: var(--brand); background: var(--brand-soft); }
.stat-card--active .stat-label { color: var(--brand-strong); }

/* ---- States ---- */
.spinner {
  width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,0.4); border-top-color: #fff;
  animation: spin 0.7s linear infinite; display: inline-block;
}
.spinner[hidden] { display: none; }
.btn-outline .spinner, .btn-ghost .spinner { border-color: rgba(0,0,0,0.15); border-top-color: var(--text); }
:root[data-theme="dark"] .btn-outline .spinner, :root[data-theme="dark"] .btn-ghost .spinner { border-color: rgba(255,255,255,0.2); border-top-color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 40px; margin-bottom: 10px; }
.loading-row { text-align: center; padding: 30px; color: var(--text-muted); }

.toast-root { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; width: 92%; max-width: 420px; }
.toast {
  padding: 12px 18px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); width: 100%; text-align: center;
  animation: toast-in 0.18s ease;
}
.toast-success { background: var(--ok); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--text); color: var(--bg); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Login ---- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(160deg, var(--bg), var(--surface-2)); padding: 20px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 36px 28px; width: 100%; max-width: 380px; box-shadow: var(--shadow); text-align: center; }
.login-logo { font-size: 44px; margin-bottom: 8px; display: flex; align-items: center; justify-content: center; }
.login-logo img { max-width: 96px; max-height: 96px; object-fit: contain; }
.login-title { margin: 0 0 4px; font-size: 22px; }
.login-sub { color: var(--text-muted); font-size: 13.5px; margin: 0 0 24px; }
.login-form { text-align: left; }

/* ---- Utility ---- */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-0 { margin-top: 0; }
.text-muted { color: var(--text-muted); }
.compare-bar-track { margin-top: 4px; height: 5px; border-radius: 3px; background: var(--border, #e5e5e5); overflow: hidden; min-width: 90px; }
.compare-bar-fill { height: 100%; background: var(--brand); border-radius: 3px; }

/* ช่องเลือกหลายรายการแบบติ๊กเช็คบ็อกซ์ในกล่อง dropdown (ใช้ในตัวกรองแดชบอร์ด) */
.msf { position: relative; min-width: 200px; }
.msf-btn {
  min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14.5px; width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; text-align: left;
}
.msf-btn:hover { background: var(--surface-2); }
.msf-btn[aria-expanded="true"] { outline: 2px solid var(--brand); outline-offset: 1px; }
.msf-btn-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msf-caret { color: var(--text-muted); font-size: 11px; flex: none; }
.msf-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40;
  width: max(100%, 260px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 10px;
}
.msf-search { margin-bottom: 8px; min-height: 38px; }
.msf-actions { display: flex; gap: 14px; margin-bottom: 6px; padding: 0 2px; }
.msf-link { background: none; border: none; padding: 2px 0; font-size: 12.5px; font-weight: 600; color: var(--brand); cursor: pointer; }
.msf-link:hover { text-decoration: underline; }
.msf-list { max-height: 260px; overflow-y: auto; }
.msf-option { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.msf-option:hover { background: var(--surface-2); }
.msf-option input[type="checkbox"] { width: 17px; height: 17px; flex: none; accent-color: var(--brand); }
.msf-empty { padding: 14px 6px; color: var(--text-muted); font-size: 13.5px; text-align: center; }
.text-danger { color: var(--danger); }
.text-ok { color: var(--ok); }
.text-right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }
.section-title { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.section-sub { color: var(--text-muted); font-size: 13.5px; margin: 0 0 16px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: flex-end; }
.filter-bar .field { margin-bottom: 0; min-width: 150px; }
.pagination { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 70; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 700px) { .modal-backdrop { align-items: center; } }
.modal { background: var(--surface); border-radius: 16px 16px 0 0; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; padding: 22px; box-shadow: var(--shadow); }
@media (min-width: 700px) { .modal { border-radius: 16px; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-title { font-size: 17px; font-weight: 700; margin: 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* ---- Cart (POS) ---- */
.pos-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .pos-layout { grid-template-columns: 1fr; } }
.cart-item { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cart-item:last-child { border-bottom: none; }
.cart-item-name { font-weight: 600; font-size: 14.5px; }
.cart-item-meta { font-size: 12.5px; color: var(--text-muted); }
.cart-qty-input { width: 64px; min-height: 38px; text-align: center; }
.cart-price-input { width: 96px; min-height: 38px; text-align: right; }
.cart-lot-select { width: 100%; min-height: 36px; font-size: 13px; padding: 0 30px 0 10px; background-position: right 10px center; background-size: 10px 6px; }
.search-result { padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.search-result:hover { background: var(--surface-2); }
.search-result-list { max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; margin-top: 8px; }
.totals-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14.5px; }
.totals-row.net { font-size: 19px; font-weight: 700; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 12px; }

/* ---- Print receipt ---- */
.receipt-page { max-width: 210mm; margin: 20px auto; background: #fff; color: #111; }
.receipt-toolbar { max-width: 210mm; margin: 0 auto 12px; display: flex; gap: 10px; justify-content: flex-end; }
.receipt-sheet { background: #fff; color: #111; padding: 14mm 12mm; border: 1px solid #ddd; font-size: 10.5pt; }
.receipt-header { display: flex; gap: 14px; align-items: flex-start; border-bottom: 2px solid #111; padding-bottom: 10px; margin-bottom: 10px; }
.receipt-logo-box { width: 104px; height: 104px; border: 1px solid #ccc; display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 6px; }
.receipt-logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.receipt-store-info { flex: 1; }
.receipt-store-name { font-size: 20pt; font-weight: 700; margin: 0 0 2px; }
.receipt-doc-title { text-align: right; }
.receipt-doc-title h2 { font-size: 16pt; margin: 0 0 4px; }
.receipt-copy-label { font-weight: 700; font-size: 11pt; margin: 0 0 4px; letter-spacing: 0.5px; }
/* เว้นระยะระหว่างต้นฉบับ/สำเนาตอนดูบนจอ (ตอนพิมพ์จะขึ้นหน้าใหม่ด้วย page-break-after อยู่แล้ว ไม่ต้องพึ่ง margin นี้) */
.receipt-copy + .receipt-copy { margin-top: 24px; border-top: 2px dashed #ccc; }
/* พิมพ์สำเนาเป็นขาวดำทั้งแผ่น (โลโก้/สีต่าง ๆ กลายเป็นเฉดเทา) เพื่อแยกจากต้นฉบับให้ชัดเจนตั้งแต่มองแวบแรก
   ต้องใส่ print-color-adjust ด้วย ไม่งั้นบางเบราว์เซอร์จะตัด filter ทิ้งตอนสั่งพิมพ์ */
.receipt-copy-bw { filter: grayscale(100%); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.receipt-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; margin-bottom: 10px; font-size: 10pt; }
.receipt-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.receipt-table th, .receipt-table td { border-bottom: 1px solid #ccc; padding: 5px 6px; font-size: 9.5pt; text-align: left; white-space: normal; }
.receipt-table th { background: #f2f2f2; }
.receipt-totals { margin-left: auto; width: 260px; }
.receipt-totals .totals-row { font-size: 10pt; padding: 3px 0; }
.receipt-totals .net { font-size: 13pt; }
.receipt-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 40px; }
.receipt-sign-line { border-top: 1px solid #333; margin-top: 40px; padding-top: 6px; text-align: center; font-size: 9.5pt; }
.receipt-watermark { position: fixed; top: 40%; left: 10%; font-size: 60pt; color: rgba(220,38,38,0.25); transform: rotate(-25deg); font-weight: 800; z-index: 5; pointer-events: none; }
.receipt-void-note { border: 1.5px solid #dc2626; color: #dc2626; padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; font-weight: 600; }
/* ใบเช็คสต๊อก: ช่องว่างสำหรับเขียนจำนวนนับจริง/ผลต่างด้วยมือ */
.stockcheck-blank { min-width: 60px; }

/* ตารางในเอกสารพิมพ์ที่อาจยาวหลายหน้า (เช่น ใบเช็คสต๊อก) ให้หัวตารางขึ้นซ้ำทุกหน้า และไม่ตัดแถวคาบกลางหน้า */
.receipt-table thead { display: table-header-group; }
.receipt-table tr { page-break-inside: avoid; }

@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff !important; }
  .app-shell, .receipt-toolbar, .toast-root { display: none !important; }
  .receipt-page { margin: 0; max-width: none; }
  .receipt-sheet { border: none; padding: 0; }
  .receipt-a4-page { border: none; }
}

/* ---- ใบเสร็จรับเงิน (receipt.page.ts) เท่านั้น: พิมพ์ 1 แผ่น A4 แบ่งครึ่งบน-ล่างเป็น A5 สองใบ (ต้นฉบับ/สำเนา) ตัดตามรอยประได้
   ใช้คลาสของตัวเอง (.receipt-a4-page/.receipt-half) แยกจาก .receipt-sheet เดิม เพื่อไม่กระทบใบเสนอราคา/ใบงานช่าง/ใบเช็คสต๊อก ที่ยังพิมพ์เต็ม A4 ตามปกติ */
.receipt-a4-page { display: flex; flex-direction: column; height: 277mm; background: #fff; border: 1px solid #ddd; }
.receipt-cut-divider {
  flex: 0 0 auto; height: 6mm; display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap;
  border-top: 1px dashed #999; border-bottom: 1px dashed #999; font-size: 7pt; color: #999; letter-spacing: 0.5px;
}
.receipt-half { flex: 1 1 0; min-height: 0; overflow: hidden; position: relative; background: #fff; color: #111; }
.receipt-half-inner { padding: 6mm 9mm; font-size: 8.3pt; transform-origin: top left; }
.receipt-half .receipt-watermark { position: absolute; top: 38%; left: 12%; font-size: 26pt; }
.receipt-half .receipt-header { gap: 8px; padding-bottom: 6px; margin-bottom: 6px; }
.receipt-half .receipt-logo-box { width: 56px; height: 56px; padding: 3px; }
.receipt-half .receipt-store-name { font-size: 12.5pt; }
.receipt-half .receipt-doc-title h2 { font-size: 11pt; margin: 0 0 2px; }
.receipt-half .receipt-copy-label { font-size: 9pt; margin: 0 0 2px; }
.receipt-half .receipt-meta-grid { font-size: 7.8pt; gap: 2px 16px; margin-bottom: 5px; }
.receipt-half .receipt-table { margin-bottom: 5px; }
.receipt-half .receipt-table th, .receipt-half .receipt-table td { padding: 2px 4px; font-size: 7.6pt; }
.receipt-half .receipt-totals { width: 190px; }
.receipt-half .receipt-totals .totals-row { font-size: 7.8pt; padding: 1px 0; }
.receipt-half .receipt-totals .net { font-size: 10pt; }
.receipt-half .receipt-signatures { margin-top: 14px; gap: 16px; }
.receipt-half .receipt-sign-line { margin-top: 14px; padding-top: 3px; font-size: 7.6pt; }
.receipt-half .receipt-void-note { padding: 4px 8px; margin-bottom: 5px; font-size: 7.8pt; }

@media (max-width: 700px) {
  .receipt-header { flex-direction: column; }
  .receipt-doc-title { text-align: left; }
  .receipt-meta-grid { grid-template-columns: 1fr; }
}

/* ==== หน้าเมนูออนไลน์สาธารณะ (/menu) — เอกลักษณ์ร้าน "ขาว-แดง" (แดงเป็นตัวเน้น, ดำใช้เฉพาะตัวอักษร) แยกจากธีมระบบหลังบ้านโดยตั้งใจ ==== */
.pm-body {
  --pm-bg: #ffffff;
  --pm-bg-soft: #f7f6f6;
  --pm-red: #e21030;
  --pm-red-dark: #ad0d25;
  --pm-white: #ffffff;
  --pm-ink: #16151a;
  --pm-muted-on-dark: #f1d9dd;
  --pm-muted-on-light: #79787e;
  --pm-chip-bg: #fde3e7;
  --pm-line: #ececea;
  background: var(--pm-bg);
  color: var(--pm-ink);
  min-height: 100vh;
  font-family: "Anuphan", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.pm-wrap { max-width: 1320px; margin: 0 auto; padding: 0 16px 60px; }

/* แถบเมนูบนสุดสไตล์เว็บช็อป — โลโก้/ชื่อร้านด้านซ้าย ปุ่มโทรด้านขวา ค้างอยู่บนสุดตลอดการเลื่อนหน้า */
.pm-topbar { background: var(--pm-ink); position: sticky; top: 0; z-index: 40; }
.pm-topbar-inner {
  max-width: 1320px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}
.pm-topbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pm-topbar-logo {
  flex: none; width: 34px; height: 34px; border-radius: 8px; background: var(--pm-white);
  display: flex; align-items: center; justify-content: center; font-size: 18px; overflow: hidden;
}
.pm-topbar-logo img { width: 100%; height: 100%; object-fit: cover; }
.pm-topbar-name { color: #fff; font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-topbar-phone {
  flex: none; display: inline-flex; align-items: center; gap: 6px; background: var(--pm-red); color: #fff;
  padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; text-decoration: none;
  transition: background 0.15s ease;
}
.pm-topbar-phone:hover { background: var(--pm-red-dark); }

/* แถบประเภทสินค้า (สไตล์เมนูเว็บช็อป) — แถวที่ 2 ของแถบบนสุด เลื่อนแนวนอนได้เมื่อมีหลายหมวดจนล้นจอ */
.pm-category-nav {
  display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 0 10px 10px; max-width: 1320px; margin: 0 auto; scrollbar-width: thin;
}
.pm-category-nav-item {
  flex: none; background: transparent; border: none; color: var(--pm-muted-on-dark); font-family: inherit;
  font-size: 13.5px; font-weight: 600; padding: 8px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.pm-category-nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.pm-category-nav-item--active { background: var(--pm-red); color: #fff; }

/* ภาพหน้าปก (cover) แบบเดียวกับหน้าเพจ — ปรับเปลี่ยนได้จากหน้าตั้งค่า */
.pm-hero {
  position: relative; height: 150px; background-size: cover; background-position: center;
  background-color: var(--pm-bg-soft);
}
.pm-hero--fallback {
  background-image:
    radial-gradient(circle at 18% 22%, rgba(255,255,255,0.22), transparent 55%),
    radial-gradient(circle at 88% 78%, rgba(16,15,17,0.25), transparent 50%),
    linear-gradient(135deg, var(--pm-red), var(--pm-red-dark));
}
.pm-hero-scrim { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.35) 62%, var(--pm-bg) 100%); }
@media (min-width: 620px) { .pm-hero { height: 200px; } }
@media (min-width: 900px) { .pm-hero { height: 240px; } }

/* ชื่อร้าน — แสดงเรียบ ๆ ใต้ภาพหน้าปก (โลโก้/ชื่อหลักย้ายไปแถบเมนูบนสุดแล้ว) */
.pm-identity { position: relative; z-index: 2; text-align: center; padding: 18px 16px 0; }
.pm-store-name { font-size: 23px; font-weight: 800; letter-spacing: 0.2px; color: var(--pm-ink); }
.pm-store-sub { color: var(--pm-muted-on-light); font-size: 13.5px; margin-top: 3px; }
.pm-contact { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; margin-top: 14px; }
.pm-contact-btn {
  display: inline-flex; align-items: center; gap: 6px; background: var(--pm-red); color: #fff;
  padding: 9px 18px; border-radius: 999px; font-weight: 700; font-size: 13.5px; text-decoration: none;
  box-shadow: 0 6px 16px rgba(226,16,48,0.3); transition: background 0.15s ease;
}
.pm-contact-btn:hover { background: var(--pm-red-dark); }
.pm-address { color: var(--pm-muted-on-light); font-size: 13px; }

/* โครงหน้า: แถบตัวกรองด้านซ้าย + เนื้อหาหลัก (สไตล์เว็บช็อปทั่วไป) — บนมือถือ/แท็บเล็ตแถบตัวกรองเป็นลิ้นชักเลื่อนออกมา */
.pm-layout { position: relative; }
@media (min-width: 900px) {
  .pm-layout { display: grid; grid-template-columns: 250px 1fr; gap: 30px; align-items: start; }
}

/* แถบตัวกรอง (sidebar) */
.pm-sidebar {
  position: fixed; top: 0; left: 0; height: 100vh; width: min(84vw, 300px); background: var(--pm-white);
  z-index: 60; transform: translateX(-100%); transition: transform 0.22s ease; overflow-y: auto;
  box-shadow: 10px 0 30px rgba(0,0,0,0.2); padding: 4px 18px 24px;
}
.pm-sidebar--open { transform: translateX(0); }
.pm-sidebar-header {
  display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 15px;
  padding: 16px 0 10px; color: var(--pm-ink);
}
.pm-sidebar-close {
  border: none; background: var(--pm-bg-soft); width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  font-size: 14px; color: var(--pm-ink); display: flex; align-items: center; justify-content: center;
}
.pm-sidebar-backdrop { position: fixed; inset: 0; background: rgba(10,9,10,0.45); z-index: 55; }
@media (min-width: 900px) {
  .pm-sidebar {
    position: static; height: auto; width: auto; transform: none; box-shadow: none; z-index: 1;
    padding: 0 0 0 2px; border-right: 1px solid var(--pm-line);
  }
  .pm-sidebar-header { display: none; }
  .pm-sidebar-backdrop { display: none !important; }
}

/* กลุ่มตัวกรองแบบ checkbox (details/summary ทำให้พับ/กางได้โดยไม่ต้องใช้ JS เพิ่ม) */
.pm-filter-group { border-bottom: 1px solid var(--pm-line); padding: 14px 0; }
.pm-filter-group:first-of-type { padding-top: 6px; }
.pm-filter-group-title {
  font-size: 14px; font-weight: 700; color: var(--pm-ink); cursor: pointer; list-style: none;
  display: flex; align-items: center; justify-content: space-between;
}
.pm-filter-group-title::-webkit-details-marker { display: none; }
.pm-filter-group-title::after {
  content: ""; flex: none; width: 8px; height: 8px; border-right: 2px solid #9a999e; border-bottom: 2px solid #9a999e;
  transform: rotate(45deg); margin-top: -3px; transition: transform 0.15s ease;
}
.pm-filter-group[open] .pm-filter-group-title::after { transform: rotate(-135deg); margin-top: 3px; }
.pm-filter-list { margin-top: 10px; max-height: 240px; overflow-y: auto; }
.pm-filter-check { display: flex; align-items: center; gap: 9px; padding: 6px 2px; font-size: 13.5px; color: var(--pm-ink); cursor: pointer; }
.pm-filter-check input { width: 16px; height: 16px; accent-color: var(--pm-red); cursor: pointer; flex: none; }
.pm-select-empty { padding: 10px 2px; color: #9a999e; font-size: 13px; }

/* แถบค้นหา + ปุ่มเปิดตัวกรอง (มือถือ/แท็บเล็ต) */
.pm-toolbar {
  position: sticky; top: 96px; z-index: 25; background: var(--pm-bg); padding: 22px 0 12px; margin-top: 4px;
  display: flex; gap: 10px; align-items: stretch;
}
.pm-filter-toggle-btn {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 50px; padding: 0 16px;
  border-radius: 999px; border: 1.5px solid var(--pm-line); background: var(--pm-white); color: var(--pm-ink);
  font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.pm-search-box { position: relative; flex: 1; min-width: 0; }
.pm-search-icon {
  position: absolute; left: 17px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2379787e' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-size: contain; background-repeat: no-repeat; pointer-events: none;
}
.pm-search-box .pm-search {
  width: 100%; min-height: 50px; padding: 0 18px 0 46px; border-radius: 999px; border: 1.5px solid var(--pm-line);
  background: var(--pm-white); color: var(--pm-ink); font-size: 15px; box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.pm-search::placeholder { color: #9a999e; }
.pm-search-box .pm-search:focus { outline: none; border-color: var(--pm-red); box-shadow: 0 0 0 3px rgba(226,16,48,0.16); }
@media (min-width: 900px) { .pm-filter-toggle-btn { display: none; } }

/* ตารางสินค้า */
.pm-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 20px; }
@media (min-width: 480px) { .pm-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 900px) { .pm-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; } }
.pm-card {
  background: var(--pm-white); border-radius: 16px; overflow: hidden; border: 1px solid var(--pm-line);
  box-shadow: 0 4px 14px rgba(0,0,0,0.06);
  display: flex; flex-direction: column; transition: transform 0.18s ease, box-shadow 0.18s ease;
}
/* .pm-card{display:flex} เป็น author rule ที่ชนะ [hidden]{display:none} ของ UA stylesheet เสมอ (ไม่ว่า specificity เท่าไหร่)
   ต้องมีกฎนี้เจาะจงเพื่อให้การซ่อนการ์ดตอนกรอง (card.hidden = true จาก public-menu.js) มีผลจริง ไม่งั้นการ์ดจะยังโชว์อยู่แม้ถูกกรองออกแล้ว */
.pm-card[hidden] { display: none; }
.pm-card:hover { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(0,0,0,0.12); }
.pm-card-img { position: relative; aspect-ratio: 1 / 1; background: #f1efec; display: flex; align-items: center; justify-content: center; }
.pm-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pm-card-img--clickable { cursor: pointer; }
.pm-card-img--clickable:active { opacity: 0.85; }
.pm-card-img-count {
  position: absolute; right: 8px; bottom: 8px; background: rgba(12,12,14,0.72); color: #fff;
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; line-height: 1.5;
}
.pm-card-placeholder { font-size: 40px; opacity: 0.4; }
.pm-card-body { padding: 12px 13px 14px; flex: 1; display: flex; flex-direction: column; gap: 5px; }
.pm-card-name { font-weight: 700; font-size: 14.5px; line-height: 1.3; color: var(--pm-ink); }
.pm-card-brand {
  display: inline-block; align-self: flex-start; background: var(--pm-chip-bg); color: var(--pm-red-dark);
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.3px; text-transform: uppercase; padding: 3px 9px; border-radius: 999px;
}
.pm-card-desc { color: var(--pm-muted-on-light); font-size: 12.5px; line-height: 1.4; flex: 1; }
.pm-card-price { color: var(--pm-red); font-weight: 800; font-size: 15px; margin-top: 2px; }
.pm-empty { text-align: center; padding: 60px 20px; color: var(--pm-muted-on-light); }
.pm-footer { text-align: center; color: var(--pm-muted-on-light); font-size: 12px; padding: 40px 0 10px; }

/* ---- แกลเลอรี่รูปภาพขนาดใหญ่ (popup ตอนคลิกรูปสินค้า) ---- */
.pm-lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(8,7,7,0.94);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px;
}
.pm-lightbox[hidden] { display: none; }
.pm-lightbox-stage { width: 100%; max-width: 640px; flex: 1; max-height: 70vh; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: pan-y; }
.pm-lightbox-stage img { max-width: 100%; max-height: 70vh; object-fit: contain; border-radius: 10px; user-select: none; -webkit-user-drag: none; }
.pm-lightbox-close {
  position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.12); color: #fff; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.pm-lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.12); color: #fff; font-size: 26px; cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1;
  transition: background 0.15s ease;
}
.pm-lightbox-nav:hover { background: var(--pm-red, #e21030); }
.pm-lightbox-prev { left: 10px; }
.pm-lightbox-next { right: 10px; }
.pm-lightbox-nav[hidden], .pm-lightbox-dots:empty { display: none; }
.pm-lightbox-dots { display: flex; gap: 6px; margin-top: 12px; }
.pm-lightbox-dots span { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,0.35); }
.pm-lightbox-dots span.active { background: #e21030; }
.pm-lightbox-caption { text-align: center; color: #fff; margin-top: 14px; }
.pm-lightbox-name { font-weight: 600; font-size: 15.5px; }
.pm-lightbox-price { color: #ff6b7f; font-weight: 700; font-size: 14.5px; margin-top: 2px; }
@media (max-width: 620px) {
  .pm-lightbox-nav { width: 38px; height: 38px; font-size: 22px; }
}

/* ==================== แดชบอร์ด (ดีไซน์ใหม่) ==================== */
:root { --chart-sales: var(--brand); --chart-profit: var(--series-1); --hero-bg: #17140f; --hero-bg-2: #2a2117; }
:root[data-theme="dark"] { --hero-bg: #1d1a14; --hero-bg-2: #2d2418; }
.neg { color: var(--danger) !important; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: baseline; flex: none; }
.dot--cost { background: #8a8170; }
.dot--profit { background: #f97316; }

.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; margin-bottom: 16px; }
.dash-title { font-size: 24px; font-weight: 700; margin: 0; line-height: 1.25; }
.dash-sub { margin: 2px 0 0; color: var(--text-muted); font-size: 13.5px; }
.dash-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dash-head-actions .btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; }
.seg-btn {
  border: 0; background: transparent; color: var(--text-muted); font-size: 13.5px; font-weight: 500; padding: 0 13px; min-height: 36px;
  border-radius: 8px; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--surface); color: var(--brand-strong); font-weight: 700; box-shadow: 0 1px 3px rgba(20,16,10,0.12); }
.seg-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.dash-filters { padding: 0; }
.filter-summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 18px; font-weight: 600; font-size: 14.5px; border-radius: var(--radius);
}
.filter-summary::-webkit-details-marker { display: none; }
.filter-summary::after { content: "▾"; color: var(--text-muted); font-size: 12px; transition: transform 0.2s; }
.dash-filters[open] .filter-summary::after { transform: rotate(180deg); }
.filter-summary-text { margin-left: auto; font-weight: 500; font-size: 13px; color: var(--text-muted); }
.dash-filters .filter-bar { margin: 0; padding: 4px 18px 18px; }

/* การ์ดตัวเลขหลัก (โทนเข้มทั้งสองโหมด) */
.dash-hero {
  position: relative; overflow: hidden; display: flex; align-items: stretch; justify-content: space-between; gap: 20px;
  background: radial-gradient(120% 140% at 100% 0%, var(--hero-bg-2) 0%, var(--hero-bg) 62%); color: #f6f1e7;
  border-radius: 16px; padding: 26px 28px; margin-bottom: 16px; box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,0.06);
}
.dash-hero .loading-row, .dash-hero .empty-state { color: #b9b09d; width: 100%; }
.hero-main { flex: 1 1 52%; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.hero-label { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; font-size: 14px; color: #cfc7b4; font-weight: 500; }
.hero-value { font-size: clamp(34px, 6vw, 52px); font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.hero-cur { font-size: 0.55em; font-weight: 600; margin-right: 4px; color: #fdba74; vertical-align: 0.28em; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; line-height: 1.6; white-space: nowrap;
}
.chip-note { font-weight: 500; opacity: 0.85; }
.chip--ghost { background: rgba(255,255,255,0.1); color: #f1ebdd; }
.chip--good { background: rgba(74,222,128,0.16); color: #4ade80; }
.chip--bad { background: rgba(248,113,113,0.16); color: #fca5a5; }
.mini-stat .chip--good { background: var(--ok-soft); color: var(--ok); }
.mini-stat .chip--bad { background: var(--danger-soft); color: var(--danger); }
.hero-split { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: rgba(255,255,255,0.08); gap: 2px; margin-top: 6px; }
.hero-split-cost { background: #8a8170; transform-origin: left; animation: mk-grow 0.9s cubic-bezier(.2,.8,.2,1) both; }
.hero-split-profit { background: linear-gradient(90deg, #f97316, #fb923c); transform-origin: left; animation: mk-grow 0.9s 0.15s cubic-bezier(.2,.8,.2,1) both; }
.hero-split-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; color: #cfc7b4; }
.hero-split-legend b { color: #fff; margin-left: 2px; font-weight: 700; }
.hero-split-legend .neg { color: #fca5a5 !important; }
.hero-spark { position: relative; flex: 1 1 40%; min-width: 0; min-height: 110px; align-self: stretch; }
.spark { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.spark-line { fill: none; stroke: #fb923c; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 0; animation: mk-draw 1.3s cubic-bezier(.4,.1,.2,1) both; }
.spark-area { animation: mk-fade 1.2s 0.3s both; }
.spark-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #fb923c; box-shadow: 0 0 0 5px rgba(251,146,60,0.25); animation: mk-fade 0.4s 1.1s both; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi { margin-bottom: 0; padding: 18px 20px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi-label { font-size: 13.5px; color: var(--text-muted); font-weight: 500; }
.kpi-value { font-size: 28px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.kpi-sub { font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; }
.kpi-bar { display: flex; height: 8px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--surface-2); margin-top: auto; }
.kpi-bar > span { height: 100%; transform-origin: left; animation: mk-grow 0.9s cubic-bezier(.2,.8,.2,1) both; }
.kpi-legend { display: flex; flex-wrap: wrap; gap: 3px 14px; font-size: 12.5px; color: var(--text-muted); margin-top: 8px; }
.kpi-legend b { color: var(--text); font-weight: 700; margin-left: 2px; }
.mini-bars { display: flex; align-items: flex-end; gap: 4px; height: 44px; margin-top: auto; }
.mini-bar { flex: 1; min-width: 3px; background: var(--ok); border-radius: 3px 3px 1px 1px; opacity: 0.85; transform-origin: bottom; animation: mk-rise-y 0.7s var(--d, 0ms) cubic-bezier(.2,.8,.2,1) both; }
.mini-bar--neg { background: var(--danger); }

.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.mini-stats[hidden] { display: none; }
.mini-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; min-width: 0; }
.mini-stat-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.mini-stat-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 1px 0; }
.mini-stat-note { font-size: 12px; color: var(--text-muted); }
.mini-stat-delta { margin-top: 6px; }

.dash-grid { display: grid; gap: 16px; margin-bottom: 16px; }
.dash-grid--chart { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }
.dash-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-grid > .card { margin-bottom: 0; min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head .card-title { margin-bottom: 2px; }
.card-note { font-size: 12.5px; color: var(--text-muted); }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--text-muted); }
.legend-item { display: inline-flex; align-items: center; }

/* กราฟเส้น */
.chart-box { position: relative; width: 100%; }
.chart-svg { display: block; max-width: 100%; outline: none; overflow: visible; }
.chart-svg:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.c-grid { stroke: var(--border); stroke-width: 1; }
.c-grid--zero { stroke: var(--text-muted); stroke-opacity: 0.5; }
.c-axis { font-size: 11px; fill: var(--text-muted); font-family: inherit; }
.c-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.c-line--sales { stroke: var(--chart-sales); }
.c-line--profit { stroke: var(--chart-profit); }
.c-area { pointer-events: none; }
.c-hit { fill: transparent; cursor: crosshair; touch-action: pan-y; }
.c-cross-line { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.c-mark { stroke: var(--surface); stroke-width: 2.5; }
.c-mark--sales { fill: var(--chart-sales); }
.c-mark--profit { fill: var(--chart-profit); }
.chart-anim .c-line { stroke-dasharray: 1; animation: mk-draw 1.2s cubic-bezier(.4,.1,.2,1) both; }
.chart-anim .c-line--profit { animation-delay: 0.15s; }
.chart-anim .c-area { animation: mk-fade 1.1s 0.35s both; }
.c-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 168px; padding: 9px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.5;
  background: var(--text); color: var(--bg); box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.c-tip[hidden] { display: none; }
.c-tip-title { font-weight: 700; margin-bottom: 3px; }
.c-tip-row { display: flex; justify-content: space-between; gap: 14px; }
.c-tip-m { opacity: 0.75; font-weight: 500; }

/* โดนัท */
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.donut { position: relative; width: 100%; max-width: 190px; aspect-ratio: 1; }
.donut svg { width: 100%; height: 100%; display: block; overflow: visible; }
.donut-seg { stroke-linecap: butt; animation: mk-seg 0.9s var(--d, 0ms) cubic-bezier(.3,.7,.2,1) both; outline: none; }
.donut-seg:hover, .donut-seg:focus-visible { filter: brightness(1.12); stroke-width: 22; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.donut-total { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.donut-cap { font-size: 12px; color: var(--text-muted); }
.legend-list { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 9px; }
.legend-row { display: flex; align-items: center; gap: 0; font-size: 13.5px; min-width: 0; }
.legend-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-val { white-space: nowrap; font-variant-numeric: tabular-nums; margin-left: 8px; }

/* อันดับ/แท่งสัดส่วน */
.rank-list { gap: 15px; }
.rank-label { margin-bottom: 6px; }
.rank-value-inline { flex: none; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-bar-fill { background: var(--series-1); transform-origin: left; animation: mk-grow 0.8s var(--d, 0ms) cubic-bezier(.2,.8,.2,1) both; }
.rank-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-list { display: flex; flex-direction: column; gap: 13px; }
.bar-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13.5px; margin-bottom: 5px; }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; min-width: 0; }
.bar-val { flex: none; font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 12.5px; }
.bar-val b { color: var(--text); font-weight: 700; margin-left: 3px; }
.bar-track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; transform-origin: left; animation: mk-grow 0.8s var(--d, 0ms) cubic-bezier(.2,.8,.2,1) both; }

/* ต้องจัดการ */
.attn-list { display: flex; flex-direction: column; gap: 8px; }
.attn-row { display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-radius: 10px; background: var(--surface-2); color: inherit; text-decoration: none; transition: background 0.15s, transform 0.15s; }
a.attn-row:hover { background: var(--border); }
a.attn-row:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.attn-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.attn-dot--danger { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.attn-dot--warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.attn-dot--info { background: var(--series-1); box-shadow: 0 0 0 4px color-mix(in srgb, var(--series-1) 18%, transparent); }
.attn-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.attn-title { font-weight: 600; font-size: 14px; }
.attn-sub { font-size: 12.5px; color: var(--text-muted); }
.attn-go { color: var(--text-muted); font-size: 20px; line-height: 1; }
.attn-ok { display: flex; align-items: center; gap: 10px; padding: 18px 8px; color: var(--text-muted); font-size: 14px; }
.attn-ok-icon { width: 28px; height: 28px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }

/* อนิเมชันเข้าหน้า */
.rise { animation: mk-rise 0.55s calc(var(--i, 0) * 60ms) cubic-bezier(.2,.8,.2,1) both; }
@keyframes mk-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes mk-rise-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes mk-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes mk-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mk-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes mk-seg { from { stroke-dasharray: 0 100; } }
@media (prefers-reduced-motion: reduce) {
  .rise, .hero-split-cost, .hero-split-profit, .spark-line, .spark-area, .spark-dot, .kpi-bar > span, .mini-bar, .rank-bar-fill, .bar-fill, .donut-seg,
  .chart-anim .c-line, .chart-anim .c-area { animation: none !important; }
}

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-grid .kpi:last-child { grid-column: 1 / -1; }
  .dash-grid--chart { grid-template-columns: 1fr; }
  .dash-grid--three { grid-template-columns: 1fr 1fr; }
  .dash-grid--three > .card:last-child { grid-column: 1 / -1; }
  .donut-wrap { flex-direction: row; align-items: center; }
  .donut { max-width: 170px; flex: none; }
}
@media (max-width: 700px) {
  .dash-title { font-size: 21px; }
  .dash-hero { flex-direction: column; padding: 20px 18px; border-radius: 14px; }
  .hero-spark { min-height: 80px; flex: none; height: 80px; }
  .kpi-grid, .mini-stats, .dash-grid--three { grid-template-columns: 1fr; }
  .kpi-grid .kpi:last-child, .dash-grid--three > .card:last-child { grid-column: auto; }
  .kpi-value { font-size: 25px; }
  .dash-head-actions { width: 100%; }
  .seg { flex: 1; }
  .seg-btn { flex: 1; padding: 0 6px; }
  .dash-head-actions .btn { flex: 1 1 100%; }
  .donut-wrap { flex-direction: column; }
  .dash-filters .filter-bar { padding: 4px 14px 14px; }
}

/* ==================== ปรับสไตล์กลาง (ใช้กับทุกหน้า) ==================== */
/* ไม่แตะโครงหน้า/ขนาดการ์ด — ปรับเฉพาะลายเส้น เงา สี และสถานะโต้ตอบ ให้เข้าชุดกับดีไซน์ใหม่ของแดชบอร์ด */
:root { --radius: 14px; --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 24%, transparent); }
::selection { background: color-mix(in srgb, var(--brand) 28%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* หัวหน้า */
.section-title { font-size: 24px; line-height: 1.3; letter-spacing: -0.005em; margin-bottom: 2px; }
.section-sub { font-size: 13.5px; margin-bottom: 18px; }
@media (max-width: 700px) { .section-title { font-size: 21px; } }

/* เข้าหน้าแบบนุ่ม ๆ (เฉพาะลูกคนแรกของเนื้อหา; ไม่ใช้กับหน้าที่มี .rise ของตัวเอง) */
/* backwards (ไม่ใช่ both): เมื่อเล่นจบต้องไม่ค้าง transform ไว้ ไม่งั้นกล่องนี้จะกลายเป็นจุดอ้างอิงของ position:fixed ทำให้หน้าต่างป๊อปอัป (modal) ไปโผล่ท้ายหน้ายาวๆ */
.content > *:not(.rise) { animation: mk-page-in 0.42s cubic-bezier(.2,.8,.2,1) backwards; }
.content > *:not(.rise):nth-child(2) { animation-delay: 40ms; }
.content > *:not(.rise):nth-child(3) { animation-delay: 80ms; }
.content > *:not(.rise):nth-child(n+4) { animation-delay: 110ms; }
@keyframes mk-page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .content > * { animation: none; } }

/* การ์ด */
.card { border-radius: var(--radius); box-shadow: 0 1px 2px rgba(20,16,10,0.04), 0 6px 20px rgba(20,16,10,0.05); }
:root[data-theme="dark"] .card { box-shadow: 0 1px 2px rgba(0,0,0,0.35), 0 8px 24px rgba(0,0,0,0.25); }
.card-title { font-size: 16px; font-weight: 700; letter-spacing: -0.003em; }

/* ปุ่ม */
.btn { border-radius: 11px; transition: filter 0.15s, opacity 0.15s, box-shadow 0.15s, transform 0.08s, background 0.15s, border-color 0.15s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 92%, #fff), var(--brand-strong, var(--brand))); box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 4px 12px color-mix(in srgb, var(--brand) 30%, transparent); }
:root[data-theme="dark"] .btn-primary { color: #1a0f05; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn-outline:hover:not(:disabled) { border-color: var(--text-muted); }
.btn-danger { box-shadow: 0 4px 12px color-mix(in srgb, var(--danger) 25%, transparent); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }

/* ช่องกรอก */
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="tel"], input[type="search"], select, textarea {
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input:hover:not(:disabled):not(:focus), textarea:hover:not(:disabled):not(:focus) { border-color: var(--text-muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.csel-btn:focus-visible, .csel-btn[aria-expanded="true"], .msf-btn[aria-expanded="true"] { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.field-label { font-size: 13px; letter-spacing: 0.005em; }

/* ตาราง */
.table-scroll { border-radius: var(--radius); box-shadow: 0 1px 2px rgba(20,16,10,0.03); }
th { font-size: 12.5px; letter-spacing: 0.02em; border-bottom: 1px solid var(--border); }
tbody tr { transition: background 0.12s; }
tbody tr:last-child td { border-bottom: none; }
td { font-variant-numeric: tabular-nums; }
.clickable-row:hover { background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }

/* ป้ายสถานะ */
.badge { padding: 3px 10px; font-size: 12px; letter-spacing: 0.005em; }
.badge-ok::before, .badge-warn::before, .badge-danger::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; flex: none; }

/* การ์ดสรุปตัวเลขแบบเดิมที่หน้าอื่นยังใช้ (สินค้าคงเหลือ ฯลฯ) */
.stat-card { border-radius: var(--radius); box-shadow: 0 1px 2px rgba(20,16,10,0.04), 0 6px 20px rgba(20,16,10,0.05); transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
:root[data-theme="dark"] .stat-card { box-shadow: 0 1px 2px rgba(0,0,0,0.35), 0 8px 24px rgba(0,0,0,0.25); }
.stat-card::before { height: 3px; border-radius: 3px 3px 0 0; }
.stat-icon { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--surface-2); opacity: 1; font-size: 17px; }
.stat-card--lg .stat-icon { top: 16px; right: 16px; font-size: 18px; }
.stat-label { font-weight: 500; }
.stat-value { letter-spacing: -0.01em; }
.stat-card--clickable:hover { transform: translateY(-1px); }

/* หน้าต่างป๊อปอัป */
.modal-backdrop { background: rgba(14,11,7,0.55); backdrop-filter: blur(3px); animation: mk-fade 0.18s both; }
.modal { border-radius: 18px 18px 0 0; box-shadow: 0 24px 60px rgba(0,0,0,0.35); animation: mk-modal-in 0.26s cubic-bezier(.2,.8,.2,1) both; }
@media (min-width: 700px) { .modal { border-radius: 18px; } }
.modal-header { padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 18px; }
@keyframes mk-modal-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .modal, .modal-backdrop { animation: none; } }

/* ข้อความแจ้งเตือน */
.toast { border-radius: 12px; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,0.28); }
:root[data-theme="dark"] .toast-success { color: #052e16; }
:root[data-theme="dark"] .toast-error { color: #2b0a0a; }

/* หน้าตะกร้า/ค้นหาสินค้า */
.search-result { transition: background 0.12s; }
.search-result-list { border-radius: 12px; }
.totals-row.net { font-size: 20px; letter-spacing: -0.005em; }
.cart-item-name { letter-spacing: -0.003em; }

/* หน้าเข้าสู่ระบบ */
.login-body { background: radial-gradient(90% 70% at 85% 0%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 60%), radial-gradient(70% 60% at 0% 100%, color-mix(in srgb, var(--series-1) 10%, transparent), transparent 60%), var(--bg); }
.login-card { border-radius: 22px; padding: 38px 30px 32px; box-shadow: 0 20px 60px rgba(20,16,10,0.12); animation: mk-modal-in 0.4s cubic-bezier(.2,.8,.2,1) both; }
:root[data-theme="dark"] .login-card { box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.login-logo { width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 20px; font-size: 38px; background: linear-gradient(145deg, #fb923c, #c2410c); box-shadow: 0 8px 22px rgba(234,88,12,0.35); }
.login-logo:has(img) { background: transparent; box-shadow: none; width: auto; height: auto; }
.login-title { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
@media (prefers-reduced-motion: reduce) { .login-card { animation: none; } }

/* ==================== หน้าขายสินค้า / ออกบิล (POS) ==================== */
.pos-layout { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; }
.pos-main, .pos-side { min-width: 0; }
.pos-search-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 0 14px; }
.pos-search-row .field { margin-bottom: 8px; }
.pos-scan-input { display: flex; gap: 8px; }
.pos-scan-input .btn { flex: none; }
.pos-add .search-result-list { margin-top: 0; margin-bottom: 8px; }
.pos-browse { margin-top: 6px; border-top: 1px dashed var(--border); padding-top: 12px; }
.pos-browse summary, .pos-hold-help summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--brand-strong); list-style: none; }
.pos-browse summary::-webkit-details-marker, .pos-hold-help summary::-webkit-details-marker { display: none; }
.pos-browse summary::before, .pos-hold-help summary::before { content: "›"; display: inline-block; margin-right: 6px; transition: transform 0.15s; }
.pos-browse[open] summary::before, .pos-hold-help[open] summary::before { transform: rotate(90deg); }
.pos-hold-help { margin-top: 10px; }

/* ตะกร้า */
.pos-cart .cart-item { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; padding: 14px 0; }
.pos-cart .cart-item-name { font-size: 15px; }
.pos-cart .cart-item-meta { margin-top: 1px; }
.pos-cart .cart-qty-input, .pos-cart .cart-price-input { border-radius: 9px; }
.pos-cart .empty-state { padding: 34px 20px; }
.pos-cart .empty-state-icon { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 20px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 30px; }

/* สรุปยอด */
.pos-summary { border-color: color-mix(in srgb, var(--brand) 28%, var(--border)); }
.pos-net { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 16px; margin-bottom: 12px; border-radius: 12px; background: linear-gradient(135deg, var(--hero-bg, #17140f), var(--hero-bg-2, #2a2117)); color: #f6f1e7; }
.pos-net-label { font-size: 14px; color: #cfc7b4; font-weight: 500; }
.pos-net-value { font-size: 30px; font-weight: 700; letter-spacing: -0.01em; color: #fff; }
.pos-change { font-weight: 700; }
.pos-change .mono { color: var(--ok); }
.pos-save { min-height: 52px; font-size: 16px; margin-top: 6px; }

/* แถบสรุปยอดด้านล่าง (มือถือ/แท็บเล็ต) */
.pos-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: none; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border); box-shadow: 0 -8px 24px rgba(20,16,10,0.1);
}
.pos-bar-cap { font-size: 12px; color: var(--text-muted); }
.pos-bar-total { font-size: 21px; font-weight: 700; line-height: 1.2; }
.pos-bar .btn { min-height: 46px; padding: 0 26px; }
@media (max-width: 1000px) {
  .pos-layout { grid-template-columns: 1fr; }
  .pos-bar:not([hidden]) { display: flex; }
  body.pos-has-bar .content { padding-bottom: 96px; }
  .toast-root { bottom: calc(86px + env(safe-area-inset-bottom)); }
}
@media (max-width: 600px) {
  .pos-search-row { grid-template-columns: 1fr; }
}

/* ช่องจำนวน/ราคา/ส่วนลดในตะกร้า: กฎ input[type=number] ทั่วไป (width:100%) ชนะ .cart-qty-input เดิม ทำให้ช่องยืดเต็มบรรทัด — ระบุให้ชัดเพื่อจัดเรียงเป็นแถวเดียว */
.pos-cart input.cart-qty-input { width: 84px; flex: none; }
.pos-cart input.cart-price-input { width: 118px; flex: none; }
.pos-cart .cart-item .flex.gap-8 { gap: 8px; }
@media (max-width: 420px) { .pos-cart input.cart-qty-input { width: 72px; } .pos-cart input.cart-price-input { width: 100px; } }

/* ==================== ตะกร้าสินค้า (ตารางกะทัดรัด) ==================== */
.pos-cart .cart-head, .pos-cart .cart-item {
  display: grid; align-items: center; column-gap: 12px;
  grid-template-columns: minmax(0, 1fr) 156px 112px 92px 108px 34px;
}
.pos-cart .cart-head { padding: 8px 4px; border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.02em; }
.pos-cart .cart-head .r { text-align: right; }
.pos-cart .cart-item { padding: 10px 4px; border-bottom: 1px solid var(--border); gap: 0 12px; transition: background 0.12s; }
.pos-cart .cart-item:last-child { border-bottom: none; }
.pos-cart .cart-item:hover { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.cr-info { min-width: 0; }
.cr-name { display: flex; align-items: baseline; gap: 8px; font-weight: 600; font-size: 14.5px; line-height: 1.35; min-width: 0; }
.cr-idx { flex: none; width: 20px; height: 20px; border-radius: 6px; background: var(--surface-2); color: var(--text-muted); font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; align-self: center; }
.cr-name-text { min-width: 0; overflow-wrap: anywhere; }
.cr-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px; padding-left: 28px; font-size: 12px; color: var(--text-muted); }
.cr-meta > span + span::before { content: "·"; margin-right: 10px; }
.cr-meta .cart-lot-select { width: auto; flex: 1 1 280px; max-width: 560px; min-height: 26px; height: 26px; padding: 0 24px 0 8px; font-size: 12px; border-radius: 7px; background-color: var(--surface-2); border-color: transparent; background-position: right 8px center; background-size: 9px 6px; }
.cr-meta .cart-lot-select:hover:not(:disabled) { border-color: var(--border); }
.cr-meta .csel { flex: 1 1 280px; width: auto; max-width: 560px; min-width: 0; }
.cr-meta .csel-btn { min-height: 26px; padding: 0 24px 0 8px; font-size: 12px; border-radius: 7px; background: var(--surface-2); border-color: transparent; }
.cr-edit-price { font-size: 12px; }
.cr-override { font-size: 12px; }
.cr-cell { display: flex; align-items: center; min-width: 0; }
.cr-cap, .cr-unit { display: none; }
.cr-qty { gap: 6px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.stepper:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.stepper-btn { width: 34px; height: 36px; border: 0; background: transparent; color: var(--text-muted); font-size: 18px; line-height: 1; cursor: pointer; font-family: inherit; }
.stepper-btn:hover { background: var(--surface-2); color: var(--text); }
.pos-cart .stepper input.cart-qty-input { width: 46px; min-height: 36px; height: 36px; padding: 0; border: 0; border-radius: 0; text-align: center; font-weight: 600; box-shadow: none; -moz-appearance: textfield; appearance: textfield; background: transparent; }
.pos-cart .stepper input::-webkit-outer-spin-button, .pos-cart .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pos-cart .cr-price input, .pos-cart .cr-disc input { width: 100%; min-height: 36px; height: 36px; padding: 0 10px; border-radius: 9px; text-align: right; font-size: 14px; font-variant-numeric: tabular-nums; }
.pos-cart .cr-price input[readonly], .pos-cart .cr-disc input[readonly] { border-color: transparent; background: transparent; padding-right: 2px; box-shadow: none; cursor: default; }
.pos-cart .cr-price input[readonly] { color: var(--text); }
.pos-cart .cr-disc input[readonly] { color: var(--text-muted); }
.cr-total { text-align: right; font-weight: 700; font-size: 15px; }
.cr-remove { width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.cr-remove:hover { background: var(--danger-soft); color: var(--danger); }
.cr-remove:focus-visible { outline: none; box-shadow: var(--ring); }

.pos-cart { container-type: inline-size; container-name: poscart; }
.cr-name { flex-wrap: wrap; }
.cr-name-text { flex: 0 1 auto; }
.cr-name .stock-badge, .cr-name > span:not(.cr-idx):not(.cr-name-text) { white-space: nowrap; flex: none; }

/* ตะกร้าแคบ (คอลัมน์ซ้ายของหน้าขายบนจอทั่วไป / แท็บเล็ต): สินค้าเต็มบรรทัดบน ตัวเลขเรียงแถวเดียวด้านล่าง */
@container poscart (max-width: 860px) {
  .pos-cart .cart-head { display: none; }
  .pos-cart .cart-item {
    grid-template-columns: 148px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.1fr) 34px;
    grid-template-areas: "info info info info remove" "qty price disc total .";
    row-gap: 8px; padding: 12px 2px; align-items: end;
  }
  .cr-info { grid-area: info; }
  .cr-remove { grid-area: remove; align-self: start; justify-self: end; }
  .cr-qty { grid-area: qty; flex-direction: column; align-items: flex-start; gap: 3px; }
  .cr-price { grid-area: price; flex-direction: column; align-items: stretch; gap: 3px; }
  .cr-disc { grid-area: disc; flex-direction: column; align-items: stretch; gap: 3px; }
  .cr-cap { display: block; font-size: 11px; color: var(--text-muted); font-weight: 600; }
  .cr-total { grid-area: total; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 16px; line-height: 36px; }
  .cr-total::before { content: "รวม"; font-size: 11px; font-weight: 600; color: var(--text-muted); line-height: 1.2; }
  .pos-cart .cr-price input[readonly] { text-align: right; }
}
/* มือถือ: ตัวเลขสามช่องในแถวเดียว แล้วยอดรวมของรายการอยู่บรรทัดล่าง */
@container poscart (max-width: 520px) {
  .pos-cart .cart-item {
    grid-template-columns: 1.25fr 1fr 1fr; grid-template-areas: "info info remove" "qty price disc" "total total total";
  }
  .cr-total { flex-direction: row; justify-content: space-between; align-items: baseline; padding-top: 8px; border-top: 1px dashed var(--border); line-height: 1.3; }
  .cr-meta { padding-left: 0; gap: 4px 8px; }
  .cr-meta .cart-lot-select, .cr-meta .csel { flex: 1 1 150px; max-width: 260px; text-overflow: ellipsis; }
  .cr-name { gap: 4px 8px; }
}

/* ขั้นตอนฝั่งขวาของหน้าขาย: 1 สรุปยอด → 2 ข้อมูลลูกค้า → 3 ชำระเงินและบันทึกบิล */
.pos-step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.pos-step-head .card-title { margin: 0; }
.pos-step-no { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); color: var(--text-muted); font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.pos-step-opt { font-size: 12.5px; font-weight: 500; color: var(--text-muted); }
.pos-summary .pos-step-no { background: var(--brand); color: #fff; }

/* ==================== แผงชำระเงินหน้าขาย (ยอดสุทธิลอยค้างเสมอ) ==================== */
.pos-panel { padding: 0; display: flex; flex-direction: column; overflow: hidden; margin-bottom: 0; border-color: color-mix(in srgb, var(--brand) 28%, var(--border)); }
.pos-panel-top { padding: 14px 14px 0; }
.pos-panel .pos-net { display: block; padding: 14px 16px 12px; margin: 0 0 4px; }
.pos-net-main { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pos-net-sub { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 14px; margin-top: 6px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.12); font-size: 12px; color: #b9b09d; }
.pos-net-sub .mono { color: #e9e3d3; font-weight: 600; }
.pos-panel-body { padding: 12px 16px 6px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.pos-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.pos-grid2 .field { margin-bottom: 12px; min-width: 0; }
.pos-panel .pos-change { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 14px; margin: -2px 0 12px; border-radius: 10px; background: var(--ok-soft); font-weight: 700; font-size: 14.5px; }
.pos-panel .pos-change .mono { color: var(--ok); font-size: 18px; }
.pos-cust { border: 1px solid var(--border); border-radius: 12px; padding: 0 14px; margin-bottom: 12px; background: var(--surface); }
.pos-cust > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; font-size: 14px; font-weight: 600; }
.pos-cust > summary::-webkit-details-marker { display: none; }
.pos-cust > summary::after { content: "▾"; color: var(--text-muted); font-size: 12px; transition: transform 0.2s; flex: none; margin-left: auto; }
.pos-cust[open] > summary::after { transform: rotate(180deg); }
.pos-cust[open] { padding-bottom: 14px; }
.pos-cust-hint { margin-left: auto; font-size: 12.5px; font-weight: 500; color: var(--brand-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46%; }
.pos-cust-hint:empty { display: none; }
.pos-panel-foot { padding: 12px 16px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.pos-panel-foot .form-error { margin-bottom: 8px; }
.pos-panel .pos-save { margin-top: 0; }
.pos-panel .pos-hold { margin-top: 8px; min-height: 40px; font-size: 13.5px; font-weight: 500; }
.pos-panel .pos-hold-help { margin: 0 0 10px; }

@media (min-width: 1001px) {
  .pos-side { position: sticky; top: 80px; align-self: start; }
  .pos-panel { max-height: calc(100vh - 100px); }
}
@media (max-width: 480px) { .pos-grid2 { grid-template-columns: 1fr; } .pos-grid2 .field { margin-bottom: 10px; } }
.pos-credit-hint { display: block; margin: -6px 0 12px; }
.pos-credit-hint[hidden] { display: none; }

/* ===== รายการสินค้า / สินค้าคงเหลือ (ดีไซน์ใหม่) ===== */
.pl-filters { padding-bottom: 6px; }
.pl-filter-main { margin-bottom: 8px; }
.pl-search { flex: 1 1 260px; min-width: 200px; }
.pl-more { border-top: 1px solid var(--border); margin: 4px -2px 0; padding: 0 2px; }
.pl-more > summary { list-style: none; cursor: pointer; padding: 10px 2px; font-size: 13px; font-weight: 600; color: var(--text-muted); display: flex; align-items: center; gap: 8px; user-select: none; }
.pl-more > summary::-webkit-details-marker { display: none; }
.pl-more > summary::before { content: "▸"; font-size: 11px; transition: transform .15s; }
.pl-more[open] > summary::before { transform: rotate(90deg); }
.pl-more > summary:hover { color: var(--brand-strong, var(--brand)); }
.pl-more-count { background: var(--brand-soft); color: var(--brand-strong, var(--brand)); border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600; }
.pl-more .filter-bar { margin: 2px 0 10px; }

.pl-card { padding: 0; overflow: hidden; }
.pl-card .table-scroll { border: 0; border-radius: 0; box-shadow: none; }
.pl-table th { white-space: nowrap; }
.pl-table .pl-th-thumb { width: 72px; }
.pl-table td { vertical-align: middle; }
.pl-thumb { width: 72px; }
.pl-name { font-weight: 600; line-height: 1.35; }
.pl-sub { font-size: 12px; color: var(--text-muted); line-height: 1.4; font-weight: 400; }
.pl-sub b { color: var(--text); font-weight: 600; }
.pl-price-main { font-weight: 700; }
.pl-price-open { font-weight: 500; font-size: 13px; color: var(--text-muted); }
.pl-status { white-space: nowrap; }
.pl-status .badge + .badge { margin-left: 4px; }
.pl-status .pl-sub { margin-top: 3px; }

.inv-qty { min-width: 96px; }
.inv-qty-num { font-size: 18px; font-weight: 700; }
.inv-bar { height: 5px; border-radius: 999px; background: color-mix(in srgb, var(--text-muted) 18%, transparent); margin-top: 6px; overflow: hidden; margin-left: auto; width: 96px; }
.inv-bar > i { display: block; height: 100%; border-radius: 999px; background: var(--ok); transition: width .4s ease; }
.inv-row.row-status-warn .inv-bar > i { background: var(--warn); }
.inv-row.row-status-danger .inv-bar > i { background: var(--danger); }
@media (prefers-reduced-motion: reduce) { .inv-bar > i { transition: none; } }

.inv-stats .stat-card { padding-top: 14px; padding-bottom: 12px; }

/* มือถือ: ตารางกลายเป็นการ์ดต่อสินค้า อ่านและแตะง่ายกว่าเลื่อนซ้าย-ขวา */
@media (max-width: 720px) {
  .pl-table { min-width: 0; width: 100%; }
  .pl-table thead { display: none; }
  .pl-table, .pl-table tbody, .pl-table tr, .pl-table td { display: block; }
  .pl-table tr.pl-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; grid-template-areas: "thumb main price" "thumb cat status" "act act act"; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); align-items: start; }
  .pl-table tr.pl-row:last-child { border-bottom: 0; }
  .pl-table tr.pl-row > td { padding: 0; border: 0; min-width: 0; width: auto; }
  .pl-table td.pl-thumb { grid-area: thumb; }
  .pl-table td.pl-main { grid-area: main; }
  .pl-table td.pl-cat { grid-area: cat; }
  .pl-table td.pl-price { grid-area: price; text-align: right; }
  .pl-table td.pl-status { grid-area: status; text-align: right; }
  .pl-table td.pl-actions { grid-area: act; margin-top: 6px; }
  .pl-table td.pl-actions .btn { width: 100%; }
  .pl-name { font-size: 15px; }
  .pl-sub.mono { word-break: break-all; }

  /* สินค้าคงเหลือ: จัดวางใหม่ — จำนวนคงเหลือเป็นตัวเด่นขวาบน */
  .inv-table tr.pl-row { grid-template-areas: "thumb main qty" "thumb cat status" "rule rule rule" "cost cost cost"; border-left-width: 3px; }
  .inv-table td.inv-qty { grid-area: qty; text-align: right; min-width: 0; }
  .inv-table td.inv-cost { grid-area: cost; text-align: left; display: flex; gap: 8px; align-items: baseline; }
  .inv-table td.inv-cost > div { display: inline; }
  .inv-table td.inv-rule { grid-area: rule; text-align: left; display: flex; gap: 14px; }
  .inv-table td.inv-rule > div { display: inline; }
  .inv-bar { width: 72px; }
  .inv-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .inv-stats .stat-card { padding: 12px 12px 10px; }
  .inv-stats .stat-card .stat-value { font-size: 22px; }
  .inv-stats .stat-card--gold { grid-column: 1 / -1; }
}

/* ปุ่ม หยุดใช้งาน/เปิดใช้งาน ในรายการสินค้า: โทนอ่อน ไม่ให้แถบแดงเต็มทุกแถวแย่งความสนใจ */
.pl-actions .btn-danger { background: transparent; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--border)); box-shadow: none; }
.pl-actions .btn-danger:hover { background: var(--danger-soft); }
@media (max-width: 720px) {
  .pl-table td.pl-actions { justify-self: end; margin-top: 2px; }
  .pl-table td.pl-actions .btn { width: auto; min-height: 36px; padding: 6px 16px; }
}
@media (max-width: 720px) {
  .inv-table td.inv-cost::before { content: "ต้นทุนเฉลี่ย"; font-size: 12px; color: var(--text-muted); margin-right: 2px; }
}

/* ===== รายการเอกสาร: ประวัติบิล / ใบเสนอราคา / ใบงานช่าง ===== */
.doc-table td { vertical-align: middle; }
.doc-no { font-weight: 700; line-height: 1.35; }
.doc-name { font-weight: 600; line-height: 1.35; }
.doc-sub { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.doc-amount { text-align: right; font-weight: 700; white-space: nowrap; }
.doc-plate { display: inline-block; border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; font-weight: 600; font-size: 13px; background: var(--surface); }
.doc-status { white-space: nowrap; }
.doc-actions { white-space: nowrap; text-align: right; }
.doc-actions .btn + .btn { margin-left: 4px; }
.doc-actions .btn-danger { background: transparent; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--border)); box-shadow: none; }
.doc-actions .btn-danger:hover { background: var(--danger-soft); }
.doc-void { opacity: .62; }
.doc-void .doc-amount { text-decoration: line-through; }
.pl-filters .filter-bar .field { min-width: 140px; }

@media (max-width: 720px) {
  .doc-table tr.doc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main amount" "cust status" "meta meta" "act act"; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); align-items: start; }
  .doc-table tr.doc-row:last-child { border-bottom: 0; }
  .doc-table tr.doc-row > td { padding: 0; border: 0; min-width: 0; width: auto; }
  .doc-table td.doc-main { grid-area: main; }
  .doc-table td.doc-amount { grid-area: amount; font-size: 16px; }
  .doc-table td.doc-cust { grid-area: cust; }
  .doc-table td.doc-status { grid-area: status; text-align: right; }
  .doc-table td.doc-meta { grid-area: meta; display: flex; gap: 6px; align-items: baseline; font-size: 13px; }
  .doc-table td.doc-meta > div { display: inline; }
  .doc-table td.doc-actions { grid-area: act; justify-self: end; margin-top: 4px; }
  .doc-table td.doc-actions .btn { min-height: 36px; padding: 6px 16px; }
  .doc-table td.doc-cust .doc-sub { min-height: 0; }
}

.doc-table thead th:last-child { text-align: right; }
@media (max-width: 720px) {
  .doc-filters .pl-filter-main .field { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .doc-filters .pl-filter-main .btn { flex: 1 1 calc(50% - 6px); }
}
.doc-lbl { display: none; }
@media (max-width: 720px) { .doc-lbl { display: inline; color: var(--text-muted); font-size: 12px; } }

/* ===== ซัพพลายเออร์ / ติดตามลูกค้า ===== */
.sup-phone { color: var(--brand-strong, var(--brand)); text-decoration: none; }
.sup-phone:hover { text-decoration: underline; }
.sup-addr { max-width: 340px; }
.fu-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.fu-table .doc-main { min-width: 180px; }
.fu-rules { padding: 0; }
.fu-rules > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 16px; user-select: none; }
.fu-rules > summary::-webkit-details-marker { display: none; }
.fu-rules > summary::before { content: "▸"; font-size: 12px; color: var(--text-muted); transition: transform .15s; }
.fu-rules[open] > summary::before { transform: rotate(90deg); }
.fu-rules > .section-sub, .fu-rules > .table-scroll { margin-left: 16px; margin-right: 16px; }
.fu-rules > .table-scroll { margin-bottom: 16px; }
.fu-switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.fu-days { display: inline-flex; align-items: center; gap: 6px; }

@media (max-width: 720px) {
  .sup-table tr.doc-row { grid-template-areas: "main status" "cust cust" "meta meta" "act act"; }
  .sup-table td.doc-cust { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
  .sup-table td.doc-cust > div { display: inline; }
  .sup-table td.doc-actions { display: flex; gap: 8px; justify-content: flex-end; }
  .fu-table tr.doc-row { grid-template-areas: "main status" "cust meta" "act act"; }
  .fu-table td.doc-meta { justify-self: end; text-align: right; display: block; }
  .fu-table td.doc-actions { display: flex; gap: 8px; justify-content: flex-end; }
  .fu-table td.doc-actions .btn-primary { flex: 1 1 auto; }

  .fu-rules-table, .fu-rules-table thead, .fu-rules-table tbody { display: block; min-width: 0; width: 100%; }
  .fu-rules-table thead { display: none; }
  .fu-rules-table tr.fu-rule-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "cat on" "days save"; gap: 8px 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: center; }
  .fu-rules-table tr.fu-rule-row > td { display: block; padding: 0; border: 0; width: auto; }
  .fu-rule-cat { grid-area: cat; font-weight: 600; }
  .fu-rule-on { grid-area: on; justify-self: end; }
  .fu-rule-days { grid-area: days; }
  .fu-rule-save { grid-area: save; justify-self: end; }
}
@media (max-width: 720px) {
  .sup-table td.doc-meta { display: block; }
  .sup-addr { max-width: none; overflow-wrap: anywhere; }
}
/* ตารางทั่วไปตั้ง white-space: nowrap ไว้ — ในโหมดการ์ดบนมือถือต้องให้ข้อความยาว (ชื่อ ที่อยู่ ชื่อลูกค้า) ตัดบรรทัดได้ ไม่ล้นขอบ */
.sup-addr { white-space: normal; min-width: 200px; }
@media (max-width: 720px) {
  .pl-table tr.pl-row > td, .doc-table tr.doc-row > td { white-space: normal; }
  .doc-table td.doc-status, .doc-table td.doc-actions, .pl-table td.pl-status { white-space: nowrap; }
  .sup-addr { min-width: 0; }
}

/* รายการสินค้าบนมือถือ: บรรทัด SKU/บาร์โค้ด/แหล่งที่มา ตัดบรรทัดระหว่างรายการ (ไม่ตัดกลางคำ) และปุ่มเปิด/หยุดใช้งานเล็กลง */
.pl-chip { white-space: nowrap; }
@media (max-width: 720px) {
  .pl-sub.mono { word-break: normal; overflow-wrap: break-word; }
  .pl-table tr.pl-row:not(.inv-row) { grid-template-areas: "thumb main price" "thumb cat status" "thumb act act"; }
  .pl-table tr.pl-row:not(.inv-row) td.pl-actions { margin-top: 2px; }
  .pl-table td.pl-actions .btn { min-height: 32px; padding: 4px 14px; font-size: 13px; }
}

/* สินค้าคงเหลือบนมือถือ: ย้ายข้อความ "ล่าสุด..." ลงไปบรรทัดเกณฑ์สต๊อก ไม่ให้คอลัมน์ขวาบนกว้างจนชื่อสินค้าถูกบีบ */
.inv-last-m { display: none; }
@media (max-width: 720px) {
  .inv-last-d { display: none; }
  .inv-last-m { display: inline; margin-left: auto; text-align: right; }
  .inv-table td.inv-rule { flex-wrap: wrap; width: 100%; }
}

/* ===== รายงาน ===== */
.rp-step { font-size: 13px; font-weight: 700; color: var(--text-muted); margin: 2px 0 10px; display: flex; align-items: center; gap: 8px; counter-increment: rp; }
.rp-card { counter-reset: rp; }
.rp-step::before { content: counter(rp); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-strong, var(--brand)); font-size: 12px; }
.rp-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-bottom: 18px; }
.rp-type { text-align: left; font: inherit; color: inherit; display: grid; grid-template-columns: 34px 1fr; grid-template-areas: "ic t" "ic d"; column-gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.rp-type:hover { border-color: var(--brand); }
.rp-type:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.rp-type.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand) inset; }
.rp-ic { grid-area: ic; font-size: 22px; line-height: 1; text-align: center; }
.rp-t { grid-area: t; font-weight: 700; font-size: 14px; }
.rp-d { grid-area: d; font-size: 12px; color: var(--text-muted); line-height: 1.4; margin-top: 2px; }
.rp-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.rp-presets button { font: inherit; font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.rp-presets button:hover { border-color: var(--brand); }
.rp-presets button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.rp-result-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; padding: 14px 16px 10px; }
.rp-table td, .rp-table th { white-space: nowrap; }
@media (max-width: 720px) {
  .rp-types { grid-template-columns: 1fr 1fr; gap: 8px; }
  .rp-type { grid-template-columns: 1fr; grid-template-areas: "ic" "t" "d"; padding: 10px 12px; row-gap: 2px; }
  .rp-ic { text-align: left; }
}

/* ===== บัญชี ===== */
.ac-seg { display: flex; flex-wrap: wrap; gap: 8px; }
.ac-seg button { font: inherit; font-size: 13.5px; font-weight: 600; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.ac-seg button:hover { border-color: var(--brand); }
.ac-seg button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.ac-seg button.ac-in.on { background: var(--ok); border-color: var(--ok); }
.ac-seg button.ac-out.on { background: var(--danger); border-color: var(--danger); }
.ac-amount input { font-size: 20px; font-weight: 700; }
#entrySaveBtn, #countSaveBtn { width: 100%; justify-content: center; }
.ac-note { max-width: 320px; white-space: normal; }
.ac-table td.doc-amount .doc-sub { font-weight: 400; }
.doc-actions--none { color: var(--text-muted); }
@media (max-width: 720px) {
  .ac-table td.doc-actions--none { display: none; }
  .ac-table td.doc-cust .ac-note { max-width: none; }
  .ac-table tr.doc-row { grid-template-areas: "main amount" "cust status" "act act"; }
  .ac-seg button { flex: 1 1 calc(50% - 8px); }
}

/* ---- รับสินค้าเข้า / ปรับสต๊อก (.rc-* / .adj-*) ---- */
.rc-note { background: var(--brand-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); border-radius: var(--radius); padding: 10px 14px; font-size: 13.5px; line-height: 1.55; margin-bottom: 16px; }
.rc-scan { display: flex; gap: 10px; align-items: flex-end; }
.rc-scan .field { margin-bottom: 0; }
.rc-scan-input { flex: 1; min-width: 0; }
.rc-scan-input input { font-size: 17px; min-height: 50px; }
.rc-scan > .btn { min-height: 50px; }
.rc-notfound { background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius); padding: 14px; margin-top: 12px; }
.rc-notfound[hidden] { display: none; }
.rc-or { display: flex; align-items: center; gap: 12px; margin: 18px 0 10px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.rc-or::before, .rc-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.rc-pick { margin-top: 14px; }
.rc-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.rc-cols, .rc-row { display: grid; grid-template-columns: minmax(200px, 2.2fr) 92px 128px 128px minmax(110px, 1.2fr) 128px 36px; column-gap: 10px; align-items: center; }
.rc-cols { padding: 8px 12px; background: var(--surface-2); border-radius: 10px; font-size: 12.5px; font-weight: 700; color: var(--text-muted); }
.rc-col-r { text-align: right; }
.rc-row { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.rc-row:last-child { border-bottom: 0; }
.rc-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rc-f input { width: 100%; min-width: 0; }
.rc-lbl { display: none; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.rc-total { text-align: right; min-width: 0; }
.rc-total-main { font-weight: 700; font-size: 15px; }
.rc-total-sub { font-size: 11.5px; color: var(--text-muted); line-height: 1.35; margin-top: 2px; white-space: normal; }
.rc-del { padding: 0; width: 36px; min-height: 36px; justify-content: center; color: var(--text-muted); }
.rc-del:hover { color: var(--danger); }
.rc-warn { grid-column: 1 / -1; margin: 8px 0 0; }
.rc-foot { position: sticky; bottom: 12px; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; margin-top: 12px; }
.rc-foot-main { font-size: 22px; font-weight: 800; line-height: 1.1; }
.rc-foot-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.rc-foot .btn { min-height: 46px; padding-left: 26px; padding-right: 26px; }
.rc-result-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.rc-result-row:last-child { border-bottom: 0; }
.rc-result-lot { font-weight: 700; }
.rc-result-qty { color: var(--ok); font-weight: 600; }
@media (max-width: 980px) {
  .rc-cols { display: none; }
  .rc-row { grid-template-columns: 1fr 1fr; grid-template-areas: "p p" "q c" "e n" "t d"; row-gap: 10px; padding: 14px 12px; margin: 0 -2px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
  .rc-row:last-child { border-bottom: 1px solid var(--border); }
  .rc-row .rc-product { grid-area: p; }
  .rc-row > .rc-f:nth-child(2) { grid-area: q; }
  .rc-row > .rc-f:nth-child(3) { grid-area: c; }
  .rc-row > .rc-f:nth-child(4) { grid-area: e; }
  .rc-row > .rc-note-f { grid-area: n; }
  .rc-row > .rc-total { grid-area: t; text-align: left; align-self: center; }
  .rc-row > .rc-del { grid-area: d; justify-self: end; width: auto; padding: 0 12px; }
  .rc-warn { grid-column: 1 / -1; grid-row: 5; }
  .rc-lbl { display: block; }
  .rc-foot { bottom: 8px; padding: 10px 12px; }
  .rc-foot-main { font-size: 19px; }
  .rc-foot .btn { padding-left: 18px; padding-right: 18px; }
  .rc-scan { flex-wrap: wrap; }
  .rc-scan-input { flex-basis: 100%; }
  .rc-scan > .btn { width: 100%; }
}
.adj-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.adj-seg label { position: relative; cursor: pointer; }
.adj-seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.adj-seg span { display: block; text-align: center; padding: 14px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-weight: 700; font-size: 15px; transition: background .15s, border-color .15s, color .15s; }
.adj-seg label:hover span { border-color: var(--brand); }
.adj-seg input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.adj-in input:checked + span { background: var(--ok); border-color: var(--ok); color: #fff; }
.adj-out input:checked + span { background: var(--danger); border-color: var(--danger); color: #fff; }
.adj-pick { margin-bottom: 0; }
#adjSaveBtn { width: 100%; justify-content: center; min-height: 46px; margin-top: 4px; }
#adjSaveBtn.is-dec { background: linear-gradient(180deg, color-mix(in srgb, var(--danger) 90%, #fff), var(--danger)); box-shadow: 0 4px 12px color-mix(in srgb, var(--danger) 30%, transparent); }
.adj-pick .msf { flex: 1 1 150px; }
.adj-pick #fProductField { flex: 2 1 260px; }

/* ---- สรุปยอดเครดิต (.ps-*) ---- */
.ps-supplier { flex: 2 1 260px; min-width: 200px; }
.ps-hint { margin: -4px 0 10px; }
.ps-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.ps-presets { margin: 0; }
.ps-exports { display: flex; gap: 8px; flex-wrap: wrap; }
.ps-export-panel { min-width: 260px; right: 0; left: auto; }
.ps-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; margin-top: 4px; }
.ps-row > .card { margin-bottom: 0; }
.ps-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 16px 18px 6px; }
.ps-card-head .card-title { margin: 0; }
.ps-table { min-width: 0; width: 100%; }
.ps-table td.doc-meta .doc-lbl { display: none; }
.ps-table tr.clickable-row:hover { background: var(--surface-2); }
@media (max-width: 980px) {
  .ps-row { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .ps-bar { flex-direction: column; align-items: stretch; }
  .ps-exports .btn, .ps-exports .msf { flex: 1 1 calc(50% - 4px); }
  .ps-exports .msf .btn { width: 100%; }
  .ps-table tr.doc-row { grid-template-areas: "main amount" "meta meta"; }
  .ps-table td.doc-meta .doc-lbl { display: inline; color: var(--text-muted); }
  .ps-table td.doc-meta { font-size: 12.5px; }
  .ps-table td.doc-meta:empty { display: none; }
}

/* ---- ตั้งค่าร้าน (.st-*) ---- */
.st-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; align-items: start; margin-bottom: 0; }
.st-grid > .card, .st-side > .card { margin-bottom: 16px; }
.st-side { display: flex; flex-direction: column; }
.st-upload { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.st-logo { width: 104px; height: 104px; border-radius: 12px; border-color: var(--border); background: var(--surface-2); }
.st-banner { width: 100%; aspect-ratio: 3 / 1; border-radius: 12px; border-color: var(--border); background: var(--surface-2); padding: 0; overflow: hidden; }
.st-upload-ctl { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-width: 0; }
.st-upload-ctl input[type="file"] { max-width: 100%; font-size: 13px; }
.st-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.st-chip { display: inline-flex; align-items: center; gap: 4px; padding: 6px 6px 6px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-size: 14px; font-weight: 600; }
.st-chip button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; width: 24px; height: 24px; border-radius: 50%; font-size: 12px; line-height: 1; }
.st-chip button:hover { background: var(--danger-soft); color: var(--danger); }
.st-add { display: flex; gap: 8px; max-width: 420px; }
.st-add input { flex: 1; min-width: 0; }
.st-save { width: 100%; justify-content: center; min-height: 48px; }
.st-bk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.st-drive { margin: 10px 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.st-bk-status { margin: 12px 0 0; padding: 10px 14px; border-radius: var(--radius); background: var(--surface-2); font-size: 13.5px; }
.st-bk-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
@media (max-width: 900px) {
  .st-grid { grid-template-columns: 1fr; }
  .st-grid > .st-main { margin-bottom: 16px; }
}
@media (max-width: 720px) {
  .doc-filters .pl-filter-main .field.ps-supplier { flex: 1 1 100%; }
}
.st-upload-ctl input[type="file"]::file-selector-button { font: inherit; font-size: 13px; font-weight: 600; padding: 7px 14px; margin-right: 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); cursor: pointer; }
.st-upload-ctl input[type="file"]::file-selector-button:hover { border-color: var(--brand); }
.st-upload-ctl input[type="file"] { border: 0; padding: 0; min-height: 0; background: transparent; box-shadow: none; }

/* ---- ผู้ใช้ / Audit / เมนูออนไลน์ (.usr-* .aud-* .mn-*) ---- */
.usr-sum { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.usr-sum .pl-more-count { font-size: 13px; padding: 3px 12px; }
.usr-sum-ok { background: var(--ok-soft); color: var(--ok); }
.usr-sum-off { background: var(--danger-soft); color: var(--danger); }
.usr-off .doc-no { color: var(--text-muted); }
.usr-table td.doc-meta .doc-lbl, .aud-table td.doc-meta .doc-lbl { display: none; }
.aud-presets { margin: 0 0 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.aud-table td.doc-status { font-size: 13px; color: var(--text-muted); font-weight: 400; }
.aud-table td.doc-cust .doc-sub { margin-left: 6px; }
.aud-table td.aud-reason { white-space: normal; max-width: 420px; color: var(--text); }
.aud-table thead th:last-child { text-align: left; }
.mn-img img, .mn-noimg { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.mn-noimg { background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.mn-order-chip { display: none; }
.mn-table thead th:nth-child(4) { text-align: right; }
.mn-table td.mn-price { white-space: normal; max-width: 180px; }
.mn-table .doc-void .doc-amount { text-decoration: none; }
@media (max-width: 720px) {
  .usr-table tr.doc-row { grid-template-areas: "main status" "cust cust" "meta meta" "act act"; }
  .usr-table td.doc-cust { display: flex; align-items: center; }
  .usr-table td.doc-meta { display: block; font-size: 13px; }
  .usr-table td.doc-meta .doc-lbl { display: inline; }
  .usr-table td.doc-actions { display: flex; gap: 8px; justify-content: flex-end; }
  .aud-table tr.doc-row { grid-template-areas: "cust status" "main main" "meta meta"; }
  .aud-table td.doc-cust { display: flex; align-items: baseline; flex-wrap: wrap; }
  .aud-table td.doc-main { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .aud-table td.aud-reason { max-width: none; font-size: 13px; }
  .aud-table td.aud-reason .doc-sub:only-child { display: none; }
  .mn-table tr.doc-row { grid-template-columns: 52px minmax(0, 1fr) auto; grid-template-areas: "img main amount" "img meta status" "act act act"; align-items: start; }
  .mn-table td.mn-img { grid-area: img; padding: 0; }
  .mn-table td.mn-img img, .mn-table .mn-noimg { width: 52px; height: 52px; }
  .mn-table td.mn-order { display: none; }
  .mn-table td.doc-meta { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
  .mn-order-chip { display: inline-flex; }
  .mn-table td.doc-status { align-self: center; }
  .mn-table td.doc-actions { display: flex; gap: 8px; justify-content: flex-end; }
}

/* โหมดมืด: สีเติมของปุ่มที่เลือกอยู่ (สว่างกว่าโหมดปกติ) ต้องใช้ตัวอักษรเข้มเพื่อให้อ่านชัด */
:root[data-theme="dark"] .rp-presets button.on,
:root[data-theme="dark"] .ac-seg button.on,
:root[data-theme="dark"] .rp-presets button.on:hover { color: #1a0f05; }
:root[data-theme="dark"] .ac-seg button.ac-in.on,
:root[data-theme="dark"] .adj-in input:checked + span { color: #06210f; }
:root[data-theme="dark"] .ac-seg button.ac-out.on,
:root[data-theme="dark"] .adj-out input:checked + span { color: #190303; }

/* ---- รายละเอียดบิล (.inv-*) ---- */
.inv-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.inv-no { font-size: 22px; font-weight: 800; line-height: 1.3; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inv-sub { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.inv-hero-total { text-align: right; }
.inv-total { font-size: 32px; font-weight: 800; line-height: 1.15; }
.inv-hero-total.is-void .inv-total { text-decoration: line-through; color: var(--text-muted); }
.inv-info { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.inv-info-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.inv-info-h { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }
.inv-info-v { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.inv-edit { margin-top: 12px; }
.inv-note { margin-top: 12px; padding: 10px 14px; border-radius: var(--radius); background: var(--surface-2); font-size: 14px; }
.inv-note .inv-info-h { display: inline; margin-right: 6px; }
.inv-items thead th:nth-child(n+2) { text-align: right; }
.inv-items td.inv-qty, .inv-items td.inv-price, .inv-items td.inv-disc { text-align: right; white-space: nowrap; }
.inv-items td.inv-meta { display: none; }
.inv-sum { padding: 12px 18px 16px; border-top: 1px solid var(--border); margin-left: auto; max-width: 360px; }
.inv-sum-row { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; font-size: 14px; }
.inv-sum-net { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; font-size: 18px; font-weight: 800; }
@media (max-width: 720px) {
  .inv-info { grid-template-columns: 1fr; }
  .inv-hero-total { text-align: left; width: 100%; }
  .inv-total { font-size: 28px; }
  .inv-items tr.doc-row { grid-template-areas: "main amount" "meta meta"; }
  .inv-items td.inv-qty, .inv-items td.inv-price, .inv-items td.inv-disc { display: none; }
  .inv-items td.inv-meta { display: block; grid-area: meta; font-size: 13px; color: var(--text-muted); }
  .inv-sum { max-width: none; }
}
.inv-info--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.inv-total--text { font-size: 22px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.inv-bar { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; margin-top: 8px; }
.inv-bar > span { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.po-rem { color: var(--warn); font-weight: 700; }
.po-items td.doc-amount { font-weight: 600; }
.po-items thead th:nth-child(5) { text-align: right; }
.po-items thead th:last-child, .jo-items thead th:last-child { text-align: left; }
.po-items td.po-note, .jo-items td.po-note { white-space: normal; color: var(--text-muted); }
.jo-items thead th:nth-child(2) { text-align: right; }
.jo-items td.jo-qty { white-space: nowrap; }
@media (max-width: 720px) {
  .inv-info--2 { grid-template-columns: 1fr; }
  .po-items tr.doc-row { grid-template-areas: "main amount" "meta meta" "cust cust"; }
  .po-items td.inv-qty { display: none; }
  .po-items td.po-note .doc-sub { display: none; }
  .po-items td.doc-cust:empty { display: none; }
  .jo-items tr.doc-row { grid-template-areas: "main amount" "cust cust"; }
  .jo-items td.po-note { font-size: 13px; }
}

/* PO receive form — mobile cards */
@media (max-width: 720px) {
  table.po-recv { min-width: 0; display: block; }
  table.po-recv thead { display: none; }
  table.po-recv tbody { display: block; }
  table.po-recv tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  table.po-recv td { display: block; padding: 0; border: 0; white-space: normal; width: auto !important; text-align: left !important; }
  table.po-recv td:first-child { grid-column: 1 / -1; font-weight: 600; }
  table.po-recv td.po-recv-rem { grid-column: 1 / -1; color: var(--text-muted); font-size: 13px; }
  table.po-recv td[data-lbl]::before { content: attr(data-lbl); display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
  table.po-recv td.po-recv-rem::before { display: inline; margin: 0 6px 0 0; }
  table.po-recv input { width: 100%; }
}

/* ===== หน้ารายละเอียดสินค้า (.pd-*) ===== */
.pd-wrap { display: flex; flex-direction: column; gap: 14px; }
.pd-wrap > .card { margin-bottom: 0; }
.pd-hero { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; padding: 20px; }
.pd-photo-col { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pd-photo { width: 240px; height: 240px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pd-photo img { width: 100% !important; height: 100% !important; object-fit: cover; border: 0 !important; border-radius: 0 !important; }
.pd-photo-empty { font-size: 72px; }
.pd-photo-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pd-upload { cursor: pointer; }
.pd-photo-name { font-size: 12.5px; color: var(--brand); text-align: center; word-break: break-all; }
.pd-photo-hint { text-align: center; max-width: 240px; margin: 0; }
.pd-title-col { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pd-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pd-type { font-size: 12.5px; color: var(--text-muted); }
.pd-name { font-size: 26px; font-weight: 800; line-height: 1.25; word-break: break-word; }
.pd-sku { font-size: 14px; color: var(--text-muted); }
.pd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pd-price { display: flex; flex-direction: column; margin-top: 6px; }
.pd-price-lbl { font-size: 12.5px; color: var(--text-muted); }
.pd-price-val { font-size: 32px; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; line-height: 1.15; }
.pd-price-val--at { font-size: 20px; color: var(--text-muted); font-weight: 700; }
.pd-hero-actions { margin-top: 8px; }
.pd-sec { padding: 18px 20px 20px; }
.pd-sec-h { font-size: 15px; font-weight: 700; margin-bottom: 14px; padding-left: 10px; border-left: 3px solid var(--brand); line-height: 1.2; }
.pd-sec .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pd-sec .form-grid .pd-wide { grid-column: 1 / -1; }
.pd-foot { position: sticky; bottom: 12px; z-index: 15; display: flex; justify-content: flex-end; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; }
.pd-foot .btn { min-height: 46px; padding-left: 26px; padding-right: 26px; }
@media (max-width: 720px) {
  .pd-hero { grid-template-columns: 1fr; gap: 16px; padding: 16px; }
  .pd-photo { width: min(240px, 70vw); height: min(240px, 70vw); }
  .pd-title-col { align-items: flex-start; }
  .pd-name { font-size: 22px; }
  .pd-price-val { font-size: 28px; }
  .pd-sec { padding: 16px; }
  .pd-sec .form-grid { grid-template-columns: 1fr; }
  .pd-foot .btn-primary { flex: 1; }
}

/* ===== ตั้งค่าหน้าแรก + ลำดับเมนู (หน้าผู้ใช้) ===== */
.usr-nav-editor { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.usr-nav-group { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); overflow: hidden; }
.usr-nav-ghead { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; font-weight: 700; font-size: 13.5px; background: var(--surface); border-bottom: 1px solid var(--border); }
.usr-nav-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 12px 6px 22px; font-size: 14px; border-top: 1px solid var(--border); }
.usr-nav-item:first-of-type { border-top: 0; }
.usr-nav-btns { display: inline-flex; gap: 6px; flex-shrink: 0; }
.usr-mv { font: inherit; font-size: 12px; width: 34px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; line-height: 1; }
.usr-mv:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.usr-mv:disabled { opacity: .35; cursor: default; }

/* โลโก้ร้านในกรอบแบรนด์ (เมนูข้างจอ) + ตัวอักษรย่อเมื่อยังไม่ได้อัปโหลดโลโก้ */
.brand-mark { font-weight: 800; }
.brand-mark-img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; display: block; }
.login-logo { font-size: 40px; font-weight: 800; }
.login-logo img { max-height: 72px; max-width: 160px; object-fit: contain; }
