/* ============================================================
   EDL Stock — ส่วนเสริมของระบบบนธีม MatDash (public/theme)
   โหลดต่อจาก theme/assets/css/styles.css ทุกหน้า (หลังบ้าน / เซลล์ / เข้าสู่ระบบ)
   สีหลักตามสีธีมที่เลือก (--bs-primary) · รองรับโหมดมืด ([data-bs-theme="dark"])
   ห้ามใส่สีตายตัวในส่วนประกอบ — ใช้ตัวแปร --edl-* ด้านล่าง เพื่อให้เปลี่ยนตามโหมด/สีธีมได้
   ============================================================ */

:root {
    --edl-font: "Manrope", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;

    /* พื้น / ตัวอักษร / เส้น (โหมดสว่าง) */
    --edl-surface: #ffffff;
    --edl-text: #29343d;
    --edl-text-2: #4f5d6b;
    --edl-muted: #7b8893;
    --edl-muted-2: #a8b3bd;
    --edl-line: #e0e6eb;
    --edl-line-2: #eef1f5;
    --edl-line-3: #cfd8e3;
    --edl-soft: #f4f7fb;
    --edl-soft-2: #f8fafc;
    --edl-soft-3: #e9edf3;
    --edl-dark: #0a2540;
    --edl-dark-2: #183b5e;

    /* สีความหมาย */
    --edl-success: #1f9d5b;
    --edl-warning: #c98a00;
    --edl-danger: #e5446f;
    --edl-info: #1a9fc8;
    --edl-teal: #0e9f99;

    --edl-radius: 12px;
    --edl-radius-sm: 8px;
    --edl-shadow: 0 2px 4px -1px rgba(175, 182, 201, .2), 0 1px 4px 0 rgba(133, 146, 173, .12);
    --edl-shadow-hover: 0 12px 28px rgba(41, 52, 61, .12);

    /* สีสถานะสต๊อก (หน้าตั้งค่าระบบเขียนทับได้) */
    --st-ok: #2f8a62;
    --st-warn: #d99a1e;
    --st-low: #c0503c;
    --st-over: #c0503c;
}

/* โหมดมืด — โทนเดียวกับ dark ของธีม */
:root[data-bs-theme="dark"] {
    --edl-surface: #1a2537;
    --edl-text: #e6ebf1;
    --edl-text-2: #b3bfcc;
    --edl-muted: #8b98a8;
    --edl-muted-2: #66758a;
    --edl-line: #313e54;
    --edl-line-2: #27344a;
    --edl-line-3: #3d4c66;
    --edl-soft: #1f2a3d;
    --edl-soft-2: #222e43;
    --edl-soft-3: #2a3851;
    --edl-dark: #0d1b2e;
    --edl-dark-2: #1c3354;

    --edl-success: #4cc98a;
    --edl-warning: #f2b84b;
    --edl-danger: #ff6f95;
    --edl-info: #46caeb;
    --edl-teal: #2cc5be;

    --edl-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    --edl-shadow-hover: 0 12px 28px rgba(0, 0, 0, .35);
}

/* สีที่คำนวณจากสีธีม + พื้น — เปลี่ยนตามทั้งโหมดและสีธีมอัตโนมัติ */
:root {
    --edl-primary: var(--bs-primary);
    --edl-primary-2: color-mix(in srgb, var(--bs-primary) 86%, #000);
    --edl-primary-light: color-mix(in srgb, var(--bs-primary) 70%, #fff);
    --edl-primary-soft: color-mix(in srgb, var(--bs-primary) 11%, var(--edl-surface));
    --edl-primary-tint: color-mix(in srgb, var(--bs-primary) 5%, var(--edl-surface));
    --edl-primary-line: color-mix(in srgb, var(--bs-primary) 40%, var(--edl-surface));
    --edl-primary-line-2: color-mix(in srgb, var(--bs-primary) 22%, var(--edl-surface));
    --edl-success-soft: color-mix(in srgb, var(--edl-success) 12%, var(--edl-surface));
    --edl-success-line: color-mix(in srgb, var(--edl-success) 35%, var(--edl-surface));
    --edl-warning-soft: color-mix(in srgb, var(--edl-warning) 13%, var(--edl-surface));
    --edl-warning-line: color-mix(in srgb, var(--edl-warning) 40%, var(--edl-surface));
    --edl-danger-soft: color-mix(in srgb, var(--edl-danger) 11%, var(--edl-surface));
    --edl-danger-line: color-mix(in srgb, var(--edl-danger) 35%, var(--edl-surface));
    --edl-info-soft: color-mix(in srgb, var(--edl-info) 12%, var(--edl-surface));
    --edl-teal-soft: color-mix(in srgb, var(--edl-teal) 12%, var(--edl-surface));
}

/* ธีมตั้ง secondary เป็นฟ้าอมเขียว — ระบบใช้ secondary แบบ Bootstrap (เทา) */
:root[data-bs-theme][data-color-theme] {
    --bs-secondary: #5a6a85;
    --bs-secondary-rgb: 90, 106, 133;
}

/* ---------- พื้นฐาน ---------- */
* { -webkit-tap-highlight-color: transparent; }
body { font-family: var(--edl-font) !important; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-family: var(--edl-font); color: var(--edl-text); font-weight: 600; }
button, input, select, textarea, .btn, .form-control, .form-select { font-family: var(--edl-font); }
a { color: var(--bs-primary); }
a:hover { color: var(--edl-primary-2); }
.text-muted { color: var(--edl-muted) !important; }
.text-dark { color: var(--edl-text) !important; }
ul.list-styled, .tl { list-style: none; }

/* ธีมย่อ fs-1…fs-6 ให้เล็ก — คืนขนาดแบบ Bootstrap (หน้าในระบบใช้ความหมายนี้) */
.fs-1 { font-size: calc(1.375rem + 1.5vw) !important; }
.fs-2 { font-size: calc(1.325rem + .9vw) !important; }
.fs-3 { font-size: calc(1.3rem + .6vw) !important; }
.fs-4 { font-size: calc(1.275rem + .3vw) !important; }
.fs-5 { font-size: 1.25rem !important; }
.fs-6 { font-size: 1rem !important; }
@media (min-width: 1200px) {
    .fs-1 { font-size: 2.5rem !important; }
    .fs-2 { font-size: 2rem !important; }
    .fs-3 { font-size: 1.75rem !important; }
    .fs-4 { font-size: 1.5rem !important; }
}

.btn-secondary { --bs-btn-bg: #5a6a85; --bs-btn-border-color: #5a6a85; --bs-btn-hover-bg: #4a5870; --bs-btn-hover-border-color: #4a5870; --bs-btn-color: #fff; --bs-btn-hover-color: #fff; }
.text-secondary { color: #5a6a85 !important; }

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--edl-line-3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--edl-line-3); }

/* ============================================================
   โครงหน้า (เมนูซ้าย + แถบบน) — ต่อยอดจาก side-mini-panel ของธีม
   ============================================================ */
.side-mini-panel { box-shadow: 1px 0 0 var(--edl-line-2); }
.side-mini-panel .mini-nav { display: flex; flex-direction: column; }
.side-mini-panel .mini-nav ul.mini-nav-ul { height: auto; flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: none; padding: 4px 0 16px; margin: 0; }
.side-mini-panel .mini-nav ul.mini-nav-ul::-webkit-scrollbar { display: none; }
.side-mini-panel .mini-nav .brand-logo .sidebartoggler { font-size: 1.45rem; color: var(--edl-text); display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; }
.side-mini-panel .mini-nav .brand-logo .sidebartoggler:hover { background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
.side-mini-panel .mini-nav .mini-nav-item > a > i { z-index: 2; position: relative; color: var(--edl-text); font-size: 1.2rem; line-height: 1; }
.side-mini-panel .mini-nav .mini-nav-item > a:hover > i { color: var(--bs-primary); }
.side-mini-panel .mini-nav .mini-nav-item.selected > a > i { color: #fff; }
.edl-mini-badge {
    position: absolute; z-index: 3; top: 2px; left: 50%; margin-left: 8px; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 999px; background: var(--edl-danger); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center;
    border: 2px solid var(--edl-soft);
}
.edl-mini-badge:empty { display: none; }

.sidebar-nav ul .sidebar-item .sidebar-link > i { font-size: 1.05rem; color: var(--edl-text); opacity: .8; flex: none; width: 20px; text-align: center; }
.sidebar-nav ul .sidebar-item .sidebar-link { color: var(--edl-text-2); font-size: .9rem; }
.sidebar-nav ul .sidebar-item .sidebar-link:hover > i { color: var(--bs-primary); opacity: 1; }
.sidebar-nav ul .sidebar-item > .sidebar-link.active > i { color: #fff; opacity: 1; }
.sidebar-nav ul .sidebar-item > .sidebar-link.active { box-shadow: 0 12px 20px -8px rgba(var(--bs-primary-rgb), .45); }
.side-mini-panel .sidebarmenu .sidebar-nav { overflow-y: auto; scrollbar-width: thin; }
.nav-small-cap { letter-spacing: .5px; font-size: .74rem; }
.edl-nav-badge {
    flex: none; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--bs-primary-bg-subtle); color: var(--bs-primary);
    font-size: .72rem; font-weight: 700; line-height: 20px; text-align: center;
}
.edl-nav-badge.is-red { background: var(--edl-danger-soft); color: var(--edl-danger); }
.edl-nav-badge:empty { display: none; }
.sidebar-link.active .edl-nav-badge { background: rgba(255, 255, 255, .22); color: #fff; }

/* โลโก้ / ชื่อร้าน */
.nav-logo { display: flex; }
.edl-brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--edl-text); }
.edl-brand:hover { color: var(--edl-text); }
.edl-brand img { width: 38px; height: 38px; border-radius: 10px; object-fit: contain; flex: none; background: #fff; border: 1px solid var(--edl-line-2); padding: 2px; }
.edl-brand-mark {
    width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 1.05rem;
    background: linear-gradient(140deg, var(--edl-primary-light), var(--bs-primary)); color: #fff; box-shadow: 0 6px 14px rgba(var(--bs-primary-rgb), .3);
}
.edl-brand b { display: block; font-size: .98rem; font-weight: 700; line-height: 1.2; }
.edl-brand small { display: block; font-size: .72rem; color: var(--edl-muted); line-height: 1.3; }

/* แถบบน */
.topbar { border-bottom: 1px solid transparent; transition: box-shadow .2s, border-color .2s; }
.topbar.is-scrolled { box-shadow: 0 6px 18px rgba(41, 52, 61, .06); }
.topbar .navbar { gap: 8px; flex-wrap: nowrap; }
.topbar .navbar .navbar-nav .nav-item .nav-link { line-height: 1; margin: 0; padding: 0; width: 42px; height: 42px; justify-content: center; color: var(--edl-text); font-size: 1.2rem; }
.topbar .navbar .navbar-nav .nav-item.dropdown > .nav-link[aria-label="บัญชีของฉัน"] { width: auto; padding: 0 4px; }
.topbar .navbar .navbar-nav .nav-item.dropdown:hover .dropdown-menu { display: none; }
.topbar .navbar .navbar-nav .nav-item.dropdown .dropdown-menu.show { display: block; }
.nav-icon-hover-bg:hover, .nav-icon-hover-bg[aria-expanded="true"] { background: var(--bs-primary-bg-subtle); color: var(--bs-primary) !important; }
.edl-burger { display: none; }
@media (max-width: 1299.98px) {
    .edl-burger { display: flex; }
    /* ฉากหลังตอนเปิดเมนู ต้องอยู่เหนือแท็บล่าง / แถบตะกร้าของหน้าเซลล์ */
    .show-sidebar + .dark-transparent { z-index: 98; background: rgba(10, 37, 64, .45); }
    .side-mini-panel { box-shadow: 8px 0 30px rgba(10, 37, 64, .12); }
}
.edl-pagetitle { flex: 1 1 auto; padding: 0 6px; line-height: 1.25; }
.edl-pagetitle .edl-kicker { font-size: .74rem; color: var(--edl-muted); }
.edl-pagetitle .edl-title { font-size: 1.05rem; font-weight: 700; color: var(--edl-text); }
.edl-dot {
    position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--edl-danger); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 14px; text-align: center; border: 2px solid var(--edl-surface);
}
.edl-dot:empty { display: none; }
.edl-ava {
    width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; display: inline-grid; place-items: center;
    background: linear-gradient(140deg, var(--edl-primary-light), var(--bs-primary)); color: #fff; font-size: .9rem; font-weight: 700;
}
.edl-ava.lg { width: 52px; height: 52px; font-size: 1.15rem; }
.edl-dd { min-width: 300px; border: 0; border-radius: 14px; box-shadow: 0 14px 40px rgba(41, 52, 61, .16); }
.edl-dd .dropdown-item { color: var(--edl-text-2); font-size: .88rem; }
.edl-dd .dropdown-item:hover { background: var(--edl-soft); color: var(--edl-text); }
.edl-dd .dropdown-item.text-danger:hover { background: var(--edl-danger-soft); color: var(--edl-danger) !important; }
.edl-icobtn {
    width: 42px; height: 42px; border-radius: 50%; display: inline-grid; place-items: center; border: 0; background: transparent;
    color: var(--edl-text); font-size: 1.2rem; position: relative; flex: none; cursor: pointer;
}
.edl-icobtn:hover { background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }

/* พื้นที่เนื้อหา */
.body-wrapper { min-height: calc(100vh - 102px); }
.body-wrapper > .container-fluid { max-width: 1680px; margin: 0 auto; }
@media (max-width: 575.98px) {
    .body-wrapper { margin-left: 6px; margin-right: 6px; margin-bottom: 12px; border-radius: 16px; }
    .body-wrapper > .container-fluid { padding: 12px 10px; }
    .topbar { padding: 0 8px; }
    .topbar .navbar { min-height: 64px; }
    .body-wrapper { margin-top: 64px; }
    .edl-pagetitle .edl-kicker { display: none; }
    .edl-pagetitle .edl-title { font-size: .98rem; }
}

/* ---------- การ์ด ---------- */
.card {
    border: 0;
    border-radius: var(--edl-radius);
    box-shadow: var(--edl-shadow);
    background: var(--edl-surface);
    margin-bottom: 24px;
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--edl-line-2);
    padding: 16px 22px;
    font-weight: 600;
    font-size: .95rem;
    color: var(--edl-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.card-header:first-child { border-radius: var(--edl-radius) var(--edl-radius) 0 0; }
.card-body { padding: 22px; color: var(--edl-text-2); }
.card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 0; color: var(--edl-text); }
.card-subtitle { font-size: .78rem; color: var(--edl-muted); }

/* หัวเรื่องของแต่ละหน้า (การ์ดชื่อหน้าแบบธีม)
   วงกลมจาง ๆ มุมขวาเป็นพื้นหลัง (ไม่ใช้ overflow: hidden — ไม่งั้นเมนู dropdown ของปุ่มในหัว เช่น "ส่งออก" ถูกตัด)
   z-index ให้อยู่เหนือการ์ดตัวเลขด้านล่าง เมนูที่เปิดลงมาจะไม่ถูกบัง */
.lc-page-head {
    background: radial-gradient(circle 90px at calc(100% - 50px) 30px, rgba(var(--bs-primary-rgb), .09), rgba(var(--bs-primary-rgb), 0) 70%), var(--edl-surface);
    border-radius: var(--edl-radius);
    box-shadow: var(--edl-shadow);
    padding: 18px 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    position: relative;
    z-index: 3;
}
.lc-page-head > * { position: relative; z-index: 1; }
.lc-page-head > div:first-child { min-width: 0; flex: 1 1 320px; }
.lc-page-head h4 { margin: 0; font-size: 1.15rem; font-weight: 700; display: flex; align-items: center; color: var(--edl-text); }
.lc-page-head h4 .lc-head-ico {
    width: 42px; height: 42px; border-radius: 10px; display: inline-grid; place-items: center; margin-right: 12px; flex: none;
    background: var(--bs-primary-bg-subtle); color: var(--bs-primary); font-size: 1.15rem;
}
.lc-page-head p { margin: 4px 0 0; font-size: .8rem; color: var(--edl-muted); }
.lc-page-head .lc-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.lc-page-head .lc-chip {
    background: var(--edl-soft); border: 1px solid var(--edl-line-2); border-radius: 999px;
    padding: 3px 11px; font-size: .76rem; color: var(--edl-text-2); white-space: nowrap;
}
.lc-page-head .lc-chip b { color: var(--edl-text); font-weight: 700; margin-right: 3px; }
.lc-page-head .lc-head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.lc-page-head .lc-hsel { flex: 0 0 auto; }   /* กล่อง select2 ในหัวหน้า (กว้างตาม style ของกล่อง) */
/* ปุ่มบนหัวเรื่อง: btn-light = ปุ่มหลัก · btn-ghost = ปุ่มรอง */
.lc-page-head .btn-light { --bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary); --bs-btn-color: #fff; --bs-btn-hover-bg: var(--edl-primary-2); --bs-btn-hover-border-color: var(--edl-primary-2); --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--edl-primary-2); --bs-btn-active-color: #fff; box-shadow: 0 8px 16px -6px rgba(var(--bs-primary-rgb), .5); }
.lc-page-head .btn-ghost,
.btn-ghost { --bs-btn-bg: var(--bs-primary-bg-subtle); --bs-btn-border-color: transparent; --bs-btn-color: var(--bs-primary); --bs-btn-hover-bg: var(--bs-primary); --bs-btn-hover-border-color: var(--bs-primary); --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--bs-primary); --bs-btn-active-color: #fff; }
.lc-page-head .form-select, .lc-page-head .form-control { background-color: var(--edl-surface); }

/* สลับกลุ่มบนหัวเรื่อง */
.lc-seg-head { display: inline-flex; gap: 3px; background: var(--edl-soft); border-radius: 10px; padding: 4px; flex-wrap: wrap; }
.lc-seg-head button { border: 0; background: transparent; color: var(--edl-text-2); border-radius: 8px; padding: 6px 14px; font-size: .84rem; white-space: nowrap; font-weight: 500; }
.lc-seg-head button:hover { color: var(--bs-primary); }
.lc-seg-head button.on { background: var(--edl-surface); color: var(--bs-primary); font-weight: 700; box-shadow: 0 2px 8px rgba(41, 52, 61, .1); }

.lc-stat-row { margin-bottom: 24px; }

/* การ์ดตัวเลขสรุป */
.lc-stat {
    border-radius: var(--edl-radius);
    padding: 18px 20px;
    border: 1px solid transparent;
    box-shadow: var(--edl-shadow);
    background: var(--edl-surface);
    height: 100%;
    position: relative;
    overflow: hidden;
    color: var(--edl-text-2);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.lc-stat.is-link { cursor: pointer; }
.lc-stat.is-link:hover { transform: translateY(-3px); box-shadow: var(--edl-shadow-hover); border-color: var(--hover-bd, var(--edl-primary-line)); }
.lc-stat.is-active { border-color: var(--bs-primary); box-shadow: 0 0 0 2px var(--bs-primary) inset, var(--edl-shadow); }
.lc-stat .lc-stat-label { font-size: .8rem; color: var(--edl-muted); margin-bottom: 6px; font-weight: 500; }
.lc-stat .lc-stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.15; color: var(--edl-text); }
.lc-stat .lc-stat-sub { font-size: .74rem; color: var(--edl-muted); margin-top: 4px; }
.lc-stat .lc-stat-bar { height: 6px; border-radius: 999px; background: var(--edl-line-2); margin-top: 12px; overflow: hidden; }
.lc-stat .lc-stat-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--bar, var(--bs-primary)); transition: width .4s ease; }
.lc-stat .lc-stat-icon {
    position: absolute; right: 16px; top: 16px; width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.lc-stat .lc-stat-tag { position: absolute; right: 14px; bottom: 14px; border-radius: 999px; padding: 1px 9px; font-size: .68rem; }
.lc-stat.lc-stat-primary { background: linear-gradient(135deg, var(--bs-primary) 0%, var(--edl-primary-light) 100%); color: #fff; }
.lc-stat.lc-stat-primary .lc-stat-value { color: #fff; }
.lc-stat.lc-stat-primary .lc-stat-label,
.lc-stat.lc-stat-primary .lc-stat-sub { color: rgba(255, 255, 255, .8); }
.lc-stat.lc-stat-primary .lc-stat-icon { background: rgba(255, 255, 255, .18); color: #fff; }
.lc-stat.lc-stat-blue { background: linear-gradient(135deg, var(--edl-dark) 0%, var(--edl-dark-2) 100%); color: #fff; }
.lc-stat.lc-stat-blue .lc-stat-value { color: #fff; }
.lc-stat.lc-stat-blue .lc-stat-label,
.lc-stat.lc-stat-blue .lc-stat-sub { color: rgba(255, 255, 255, .72); }
.lc-stat.lc-stat-blue .lc-stat-icon { background: rgba(255, 255, 255, .14); color: #fff; }

.lc-stat-icon-success, .tint-green { background: var(--edl-success-soft); color: var(--edl-success); }
.lc-stat-icon-warning, .tint-amber { background: var(--edl-warning-soft); color: var(--edl-warning); }
.lc-stat-icon-error, .tint-red { background: var(--edl-danger-soft); color: var(--edl-danger); }
.lc-stat-icon-info, .tint-blue { background: var(--edl-info-soft); color: var(--edl-info); }
.lc-stat-icon-secondary, .tint-walnut, .tint-primary { background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
.tint-ink { background: var(--edl-dark); color: #fff; }

/* ---------- ปุ่ม (เพิ่มจากธีม) ---------- */
.btn { white-space: nowrap; }
.btn:focus-visible { box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .25); }
.btn-sm { --bs-btn-padding-y: 5px; --bs-btn-padding-x: 11px; --bs-btn-font-size: .8rem; }
.btn-lg { --bs-btn-padding-y: 11px; --bs-btn-padding-x: 24px; --bs-btn-font-size: .95rem; }
.btn-primary:disabled, .btn-primary.disabled { background: var(--edl-primary-line-2); border-color: var(--edl-primary-line-2); color: #fff; opacity: 1; }
.btn-dark { --bs-btn-bg: var(--edl-dark); --bs-btn-border-color: var(--edl-dark); --bs-btn-hover-bg: var(--edl-dark-2); --bs-btn-hover-border-color: var(--edl-dark-2); }
.btn-light { --bs-btn-bg: var(--edl-soft); --bs-btn-border-color: var(--edl-soft); --bs-btn-color: var(--edl-text); --bs-btn-hover-bg: var(--edl-soft-3); --bs-btn-hover-border-color: var(--edl-soft-3); --bs-btn-hover-color: var(--edl-text); --bs-btn-active-bg: var(--edl-soft-3); --bs-btn-active-border-color: var(--edl-soft-3); }
.btn-light-primary, .btn-light-info, .btn-light-success, .btn-light-danger, .btn-light-warning, .btn-light-dark { border: 0; }
.btn-light-primary { background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
.btn-light-primary:hover, .btn-light-primary:focus { background: var(--bs-primary); color: #fff; }
.btn-light-info { background: var(--edl-info-soft); color: var(--edl-info); }
.btn-light-info:hover, .btn-light-info:focus { background: var(--edl-info); color: #fff; }
.btn-light-success { background: var(--edl-success-soft); color: var(--edl-success); }
.btn-light-success:hover, .btn-light-success:focus { background: var(--edl-success); color: #fff; }
.btn-light-danger { background: var(--edl-danger-soft); color: var(--edl-danger); }
.btn-light-danger:hover, .btn-light-danger:focus { background: var(--edl-danger); color: #fff; }
.btn-light-warning { background: var(--edl-warning-soft); color: var(--edl-warning); }
.btn-light-warning:hover, .btn-light-warning:focus { background: #e8a10c; color: #fff; }
.btn-light-dark { background: var(--edl-soft-3); color: var(--edl-text); }
.btn-light-dark:hover, .btn-light-dark:focus { background: var(--edl-dark); color: #fff; }
.btn-outline-secondary { --bs-btn-color: var(--edl-text-2); --bs-btn-border-color: var(--edl-line); --bs-btn-bg: var(--edl-surface); --bs-btn-hover-bg: var(--edl-soft); --bs-btn-hover-border-color: var(--edl-line); --bs-btn-hover-color: var(--edl-text); --bs-btn-active-bg: var(--edl-soft); --bs-btn-active-color: var(--edl-text); --bs-btn-active-border-color: var(--edl-line); }
.btn-accent { background: var(--bs-primary-bg-subtle); border-color: transparent; color: var(--bs-primary); }
.btn-accent:hover { background: var(--bs-primary); color: #fff; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; border-radius: 8px; }
.btn-group > .btn, .btn-group-sm > .btn { border-radius: 8px; }

/* ปุ่มขณะกำลังบันทึก — กันกดซ้ำ */
.btn.is-loading { pointer-events: none; opacity: .75; position: relative; }
.btn.is-loading > .lc-spin, .lc-spin {
    display: inline-block; width: .9em; height: .9em; margin-right: .4em; border: 2px solid currentColor; border-right-color: transparent;
    border-radius: 50%; animation: lc-spin .65s linear infinite; vertical-align: -2px;
}
@keyframes lc-spin { to { transform: rotate(360deg); } }

/* ---------- ฟอร์ม ---------- */
.form-label { font-size: .8rem; font-weight: 600; color: var(--edl-text); margin-bottom: .35rem; }
.form-label .req { color: var(--edl-danger); }
.form-text { font-size: .74rem; color: var(--edl-muted); }
.form-control, .form-select { border-radius: var(--edl-radius-sm); border-color: var(--edl-line); font-size: .88rem; color: var(--edl-text); }
.form-control::placeholder { color: var(--edl-muted-2); }
.form-control:focus, .form-select:focus { border-color: var(--bs-primary); box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .12); }
.form-control[readonly], .form-control:disabled, .form-select:disabled { background-color: var(--edl-soft-2); }
.form-control-sm, .form-select-sm { font-size: .8rem; padding: .35rem .7rem; border-radius: 8px; }
.form-control-color { width: 46px; padding: .25rem; }
.input-group-text { background: var(--edl-soft); border-color: var(--edl-line); font-size: .82rem; color: var(--edl-text-2); }
.form-check-input { border-color: var(--edl-line-3); }
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .15); border-color: var(--edl-primary-line); }
.form-switch .form-check-input { width: 2.3em; }

/* ---------- ตาราง ---------- */
.table { --bs-table-color: var(--edl-text-2); font-size: .85rem; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .7rem .7rem; }
.table > thead th {
    background: var(--edl-soft); color: var(--edl-text); font-weight: 600; font-size: .78rem; border-bottom: 0;
    white-space: nowrap; vertical-align: middle;
}
.table > thead th:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.table > thead th:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.table > tbody > tr > td { border-color: var(--edl-line-2); vertical-align: middle; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--edl-soft-2); }
.table-sm { font-size: .8rem; }
.table-sm > :not(caption) > * > * { padding: .45rem .55rem; }
.table tr.row-warn > td { background: color-mix(in srgb, var(--st-warn) 7%, var(--edl-surface)); }
.table tr.row-alert > td { background: color-mix(in srgb, var(--st-low) 7%, var(--edl-surface)); }
.text-wrap-cell { white-space: normal; word-wrap: break-word; max-width: 260px; }
@media (max-width: 575.98px) { .text-wrap-cell { max-width: 180px; } }

/* ---------- DataTables ---------- */
.lc-dt-top, .lc-dt-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.lc-dt-top { margin-bottom: 14px; }
.lc-dt-bottom { margin-top: 16px; }
.lc-dt-search { flex: 1 1 220px; min-width: 0; }
.lc-dt-len, .lc-dt-page { flex: 0 0 auto; }
.lc-dt-info { flex: 1 1 auto; min-width: 0; }
div.dataTables_wrapper div.dataTables_filter,
.table-responsive .dataTables_wrapper .dataTables_filter { text-align: left; margin: 0; }
div.dataTables_wrapper div.dataTables_filter label { width: 100%; margin: 0; font-weight: 400; }
div.dataTables_wrapper div.dataTables_filter input,
.table-responsive .dataTables_wrapper .dataTables_filter input {
    margin-left: 0; width: 100%; max-width: 340px; min-height: 40px; border-radius: 8px; border: 1px solid var(--edl-line);
    padding: .5rem .95rem .5rem 2.3rem; font-size: .85rem; color: var(--edl-text);
    background: var(--edl-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%237b8893' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat .85rem center;
}
div.dataTables_wrapper div.dataTables_filter input:focus { outline: 0; border-color: var(--bs-primary); box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .12); }
.table-responsive .dataTables_wrapper .dataTables_length select,
div.dataTables_wrapper div.dataTables_length select { min-width: 76px; border-radius: 8px; padding: .4rem 2rem .4rem .7rem; font-size: .82rem; border-color: var(--edl-line); }
.table-responsive .dataTables_wrapper .dataTables_paginate .paginate_button { padding: 0; border: 0; margin: 0; }
div.dataTables_wrapper div.dataTables_length { margin: 0; }
div.dataTables_wrapper div.dataTables_length label { margin: 0; font-weight: 400; font-size: .8rem; white-space: nowrap; color: var(--edl-muted); }
div.dataTables_wrapper div.dataTables_info { font-size: .8rem; color: var(--edl-muted); padding: 0; }
div.dataTables_wrapper div.dataTables_paginate { margin: 0; }
div.dataTables_wrapper div.dataTables_processing {
    border-radius: 999px; box-shadow: var(--edl-shadow-hover); border: 0; background: var(--edl-surface); color: var(--bs-primary);
    width: 170px; margin-left: -85px; padding: 8px; font-size: .82rem;
}
div.dataTables_wrapper div.dataTables_processing > div:last-child { display: none; }
.lc-spin-inline { display: inline-block; width: 13px; height: 13px; margin-right: 7px; vertical-align: -2px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: lc-spin .65s linear infinite; }
.page-link { border: 0; color: var(--edl-text-2); border-radius: 8px !important; margin: 0 2px; font-size: .82rem; min-width: 34px; text-align: center; }
.page-item.active .page-link { background: var(--bs-primary); color: #fff; }
.page-link:hover { background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
.page-link:focus { box-shadow: none; }
table.dataTable > thead .sorting:before, table.dataTable > thead .sorting:after,
table.dataTable > thead .sorting_asc:before, table.dataTable > thead .sorting_asc:after,
table.dataTable > thead .sorting_desc:before, table.dataTable > thead .sorting_desc:after { opacity: .3; }
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before { color: var(--bs-primary); background: none; border: 0; box-shadow: none; margin-right: .4em; }
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control { white-space: nowrap; }

/* ---------- Badge ---------- */
.badge { font-weight: 600; font-size: .72rem; padding: .38em .75em; border-radius: 6px; }
.badge.rounded-pill { border-radius: 999px; }
.badge-primary-soft { background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
.badge-info-soft { background: var(--edl-info-soft); color: var(--edl-info); }
.badge-success-soft { background: var(--edl-success-soft); color: var(--edl-success); }
.badge-warning-soft { background: var(--edl-warning-soft); color: var(--edl-warning); }
.badge-error-soft { background: var(--edl-danger-soft); color: var(--edl-danger); }
.badge-muted-soft { background: var(--edl-soft); color: var(--edl-muted); }
.badge-ink { background: var(--edl-dark); color: #fff; }

/* สถานะเอกสาร (สีมาจากเซิร์ฟเวอร์) */
.lc-status { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 3px 10px; font-size: .74rem; font-weight: 600; white-space: nowrap; line-height: 1.4; }

/* สถานะสต๊อก */
.st-badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 9px; font-size: .74rem; font-weight: 600; white-space: nowrap; color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--edl-surface)); }
.st-qty { font-weight: 700; color: var(--c, inherit); }
.st-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.st-text { color: var(--c); }

/* ---------- Modal ---------- */
.modal-content { border: 0; border-radius: 16px; box-shadow: 0 24px 60px rgba(41, 52, 61, .2); }
.modal-header { border-bottom: 1px solid var(--edl-line-2); padding: 16px 22px; }
.modal-title { font-size: 1.05rem; font-weight: 700; color: var(--edl-text); }
.modal-body { padding: 20px 22px; color: var(--edl-text-2); }
.modal-footer { border-top: 1px solid var(--edl-line-2); padding: 12px 22px; }
.modal { z-index: 1060; }
.modal-backdrop { z-index: 1050; }
.modal-backdrop.show { opacity: .4; background: var(--edl-dark); }
.modal-dialog-scrollable .modal-content > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.modal-dialog-scrollable .modal-content > form > .modal-body { flex: 1 1 auto; min-height: 0; }
.modal-dialog-scrollable .modal-header,
.modal-dialog-scrollable .modal-footer { flex-shrink: 0; }
.modal-dialog-scrollable .modal-body { overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 575.98px) {
    .modal-dialog { margin: .5rem; }
    .modal-dialog-scrollable .modal-content { max-height: calc(100vh - 1rem); }
}
.dropdown-menu { border: 0; border-radius: 12px; box-shadow: 0 12px 32px rgba(41, 52, 61, .14); padding: 6px; }
.dropdown-item { border-radius: 8px; font-size: .86rem; color: var(--edl-text-2); padding: .5rem .8rem; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--edl-soft); color: var(--edl-text); }
.nav-tabs .nav-link.active { color: var(--bs-primary); }

/* ---------- Select2 ---------- */
.select2-container, body .select2-container { width: 100% !important; display: inline-block; vertical-align: middle; }
.select2-container--default .select2-selection--single { height: calc(1.5em + 20px + 2px); border: 1px solid var(--edl-line); border-radius: var(--edl-radius-sm); }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: calc(1.5em + 20px); padding-left: 16px; font-size: .88rem; color: var(--edl-text); }
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--edl-muted-2); }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: calc(1.5em + 20px); right: 8px; }
.select2-container--default .select2-selection--single .select2-selection__clear { position: absolute; top: 50%; right: 30px; transform: translateY(-50%); height: auto; margin: 0; float: none; width: 18px; line-height: 18px; text-align: center; border-radius: 50%; font-size: 17px; font-weight: 600; color: var(--edl-muted); }
.select2-container--default .select2-selection--single .select2-selection__clear:hover { background: var(--edl-soft); color: var(--edl-danger); }
.select2-container--default .select2-selection--single:has(.select2-selection__clear) .select2-selection__rendered { padding-right: 52px; }
.select2-container--default .select2-selection--multiple { border: 1px solid var(--edl-line); border-radius: var(--edl-radius-sm); min-height: calc(1.5em + 20px + 2px); }
.select2-container--default .select2-selection--multiple .select2-selection__choice { background: var(--bs-primary-bg-subtle); border-color: transparent; color: var(--bs-primary); border-radius: 999px; }
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single { border-color: var(--bs-primary); }
.select2-dropdown { border-color: var(--edl-line); border-radius: var(--edl-radius-sm); box-shadow: var(--edl-shadow-hover); z-index: 1080; overflow: hidden; }
.select2-container--open { z-index: 1080; }
.select2-results__option { font-size: .86rem; padding: .5rem .85rem; }
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--bs-primary); }
.select2-search--dropdown .select2-search__field { border-radius: 8px; border: 1px solid var(--edl-line); font-size: .86rem; padding: .4rem .65rem; }
.s2-prod { display: flex; align-items: center; gap: 9px; }
.s2-prod .s2-sub { font-size: .74rem; opacity: .75; }

/* ---------- SweetAlert2 ---------- */
.swal2-container { z-index: 3100 !important; }
.swal2-popup { border-radius: 16px !important; font-family: var(--edl-font) !important; font-size: .92rem; }
.swal2-title { font-size: 1.15rem !important; color: var(--edl-text) !important; }
.swal2-html-container { color: var(--edl-text-2) !important; line-height: 1.6 !important; }
.swal2-styled { border-radius: 8px !important; padding: .62em 1.4em !important; font-weight: 600 !important; box-shadow: none !important; }
.swal2-styled.swal2-confirm { background: var(--bs-primary) !important; }
.swal2-styled.swal2-deny,
.swal2-styled.swal2-confirm.swal2-danger { background: var(--edl-danger) !important; }
.swal2-styled.swal2-cancel { background: var(--edl-surface) !important; color: var(--edl-text-2) !important; border: 1px solid var(--edl-line) !important; }
.swal2-input, .swal2-textarea, .swal2-select { border-radius: 8px !important; font-size: .95rem !important; }
.swal2-toast { border-radius: 14px !important; padding: .6em 1em !important; box-shadow: 0 10px 28px rgba(41, 52, 61, .16) !important; max-width: min(420px, 94vw); }
.swal2-toast .swal2-title { font-size: .88rem !important; font-weight: 600 !important; margin: 0 .4em !important; }

/* ---------- รูป ---------- */
.lc-img-preview {
    border: 1px dashed var(--edl-line-3); border-radius: var(--edl-radius-sm); background: var(--edl-soft-2); padding: 12px;
    display: flex; align-items: center; justify-content: center; min-height: 96px; position: relative;
}
.lc-img-preview img { max-width: 100%; max-height: 150px; object-fit: contain; border-radius: 8px; }
.lc-img-preview .lc-img-empty { font-size: .78rem; color: var(--edl-muted); text-align: center; }
.lc-thumb, .lc-swatch {
    width: 42px; height: 42px; object-fit: cover; border-radius: 10px; background: var(--edl-soft); flex: none;
    display: inline-grid; place-items: center; color: var(--edl-muted-2); font-size: .95rem; border: 1px solid rgba(41, 52, 61, .05);
}
.lc-thumb.sm, .lc-swatch.sm { width: 32px; height: 32px; border-radius: 8px; }
.lc-thumb.lg, .lc-swatch.lg { width: 84px; height: 84px; border-radius: 14px; }
.lc-thumb-lg { width: 84px; height: 84px; object-fit: cover; border-radius: 14px; background: var(--edl-soft); }
img.lc-thumb { cursor: zoom-in; }
.lc-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--edl-soft); flex: none; }
.lc-avatar-txt { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(140deg, var(--edl-primary-light), var(--bs-primary)); color: #fff; display: inline-grid; place-items: center; font-size: .8rem; font-weight: 700; flex: none; }
.grain {
    background-image:
        radial-gradient(120% 70% at 22% 0%, rgba(255, 255, 255, .26), rgba(255, 255, 255, 0) 62%),
        repeating-linear-gradient(93deg, rgba(255, 255, 255, .10) 0 3px, rgba(0, 0, 0, .055) 3px 8px, rgba(0, 0, 0, .02) 8px 15px),
        repeating-linear-gradient(87deg, rgba(0, 0, 0, .05) 0 1px, rgba(0, 0, 0, 0) 1px 26px);
}

/* ---------- กล่องเลือกสิทธิ์ ---------- */
.lc-perm-group { border: 1px solid var(--edl-line); border-radius: var(--edl-radius-sm); padding: 10px 12px; height: 100%; background: var(--edl-surface); }
.lc-perm-group .lc-perm-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .8rem; font-weight: 700;
    color: var(--bs-primary); padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--edl-line-2);
}
.lc-perm-group .form-check { margin-bottom: 2px; }
.lc-perm-group .form-check-label { cursor: pointer; }
.lc-perm-group .btn-link { text-decoration: none; color: var(--bs-primary); }

/* ---------- ตัวช่วย ---------- */
.lc-divider { height: 1px; background: var(--edl-line-2); margin: 16px 0; }
.lc-soft-box { background: var(--edl-soft); border: 1px solid var(--edl-line-2); border-radius: var(--edl-radius-sm); padding: 12px 14px; }
.lc-soft-box.amber { background: var(--edl-warning-soft); border-color: var(--edl-warning-line); }
.lc-soft-box.red { background: var(--edl-danger-soft); border-color: var(--edl-danger-line); }
.lc-soft-box.green { background: var(--edl-success-soft); border-color: var(--edl-success-line); }
.cursor-pointer { cursor: pointer; }
/* ตารางที่กดทั้งแถวเพื่อเปิดรายละเอียด (Viefe) */
.vf-click tbody tr { cursor: pointer; }
.vf-click tbody tr:has(td.dt-empty), .vf-click tbody tr:has(td.dataTables_empty) { cursor: default; }
.fs-xs { font-size: .74rem; }
.fs-sm { font-size: .82rem; }
.fw-medium { font-weight: 500; }
.text-primary-lc { color: var(--bs-primary) !important; }
.text-info-lc { color: var(--edl-info) !important; }
.text-success-lc { color: var(--edl-success) !important; }
.text-error-lc { color: var(--edl-danger) !important; }
.text-warn-lc { color: var(--edl-warning) !important; }
.text-ink { color: var(--edl-text) !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -.2px; }
.min-w-0 { min-width: 0; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gap-10 { gap: 10px; }
.lc-empty { text-align: center; color: var(--edl-muted-2); padding: 30px 10px; font-size: .86rem; }
.lc-empty i { display: block; font-size: 2rem; margin-bottom: 6px; color: var(--edl-line-3); }

/* แถบโหลดตอนรีเฟรชข้อมูลเฉพาะส่วน */
.lc-refreshing { position: relative; }
.lc-refreshing:after { content: ''; position: absolute; inset: 0; background: rgba(255, 255, 255, .45); border-radius: var(--edl-radius); z-index: 5; }
.lc-autorefresh-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--edl-success); margin-right: 5px; animation: lc-pulse 2s ease-in-out infinite; }
@keyframes lc-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes lc-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.lc-rise { animation: lc-rise .22s ease-out both; }

/* Overlay กันกดซ้ำตอน submit */
#lcOverlay {
    position: fixed; inset: 0; background: color-mix(in srgb, var(--edl-soft) 72%, transparent); backdrop-filter: blur(2px); z-index: 3000;
    display: none; align-items: center; justify-content: center; flex-direction: column; gap: 14px;
}
#lcOverlay.show { display: flex; }
#lcOverlay .lc-ring { width: 46px; height: 46px; border: 4px solid var(--edl-primary-line-2); border-top-color: var(--bs-primary); border-radius: 50%; animation: lc-spin .8s linear infinite; }
#lcOverlay span { font-size: .88rem; color: var(--edl-text); font-weight: 600; background: var(--edl-surface); padding: 6px 16px; border-radius: 999px; box-shadow: var(--edl-shadow); }

/* ============================================================
   ส่วนประกอบของหน้าคลัง / รายงาน
   ============================================================ */
.doc-card {
    border: 1px solid var(--edl-line-2); border-radius: var(--edl-radius); background: var(--edl-surface); padding: 14px; height: 100%;
    display: flex; flex-direction: column; gap: 10px; transition: border-color .16s, box-shadow .16s, transform .16s;
}
.doc-card:hover { border-color: var(--edl-primary-line); box-shadow: 0 8px 22px rgba(41, 52, 61, .07); }
.doc-card.is-picked { border-color: var(--bs-primary); box-shadow: 0 0 0 2px var(--bs-primary) inset; }
.doc-card.is-short { border-color: var(--edl-danger-line); }
.doc-card .dc-head { display: flex; align-items: flex-start; gap: 10px; }
.doc-card .dc-no { font-weight: 700; font-size: .95rem; color: var(--edl-text); }
.doc-card .dc-sub { font-size: .76rem; color: var(--edl-muted); }
.doc-card .dc-lines { border: 1px solid var(--edl-line-2); border-radius: 10px; overflow: hidden; }
.doc-card .dc-line { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-bottom: 1px solid var(--edl-line-2); font-size: .82rem; }
.doc-card .dc-line:last-child { border-bottom: 0; }
.doc-card .dc-line .dc-qty { white-space: nowrap; font-weight: 700; }
.doc-card .dc-foot { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.doc-card .dc-foot .btn { flex: 1 1 auto; }
.doc-card .dc-note { font-size: .78rem; background: var(--edl-soft); border-radius: 8px; padding: 6px 9px; color: var(--edl-text-2); }

/* แถวติ๊กของตอนจ่าย */
.tick-row {
    display: flex; align-items: center; gap: 11px; padding: 11px 12px; border: 1px solid var(--edl-line); border-radius: 12px;
    cursor: pointer; transition: border-color .15s, background .15s; user-select: none; background: var(--edl-surface);
}
.tick-row + .tick-row { margin-top: 8px; }
.tick-row:hover { border-color: var(--edl-primary-line); }
.tick-row .tick-box { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--edl-line-3); display: grid; place-items: center; color: #fff; flex: none; transition: all .15s; }
.tick-row.is-on { border-color: var(--edl-success-line); background: var(--edl-success-soft); }
.tick-row.is-on .tick-box { background: var(--edl-success); border-color: var(--edl-success); }
.tick-row .tick-qty { font-size: 1.05rem; font-weight: 700; white-space: nowrap; }
.tick-row.flash { animation: tick-flash .6s ease; }
@keyframes tick-flash { 0% { box-shadow: 0 0 0 0 rgba(31, 157, 91, .5); } 100% { box-shadow: 0 0 0 12px rgba(31, 157, 91, 0); } }

.lc-progress { height: 8px; border-radius: 999px; background: var(--edl-line-2); overflow: hidden; }
.lc-progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #5fd894, var(--edl-success)); transition: width .3s; }

/* กล่องสแกน */
.scan-box { border-radius: var(--edl-radius); background: var(--edl-dark); color: #fff; padding: 16px; position: relative; overflow: hidden; }
.scan-box .scan-input { display: flex; gap: 8px; }
.scan-box .scan-input .form-control { border-radius: 8px; border: 0; padding: .6rem 1rem; font-size: .95rem; }
.scan-box .scan-hint { font-size: .76rem; color: rgba(255, 255, 255, .6); margin-top: 8px; }

/* ตัวเลขจำนวน +/- */
.qty-step { display: inline-flex; align-items: center; gap: 6px; }
.qty-step button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--edl-line); background: var(--edl-surface); display: grid; place-items: center; color: var(--edl-text-2); padding: 0; font-size: .95rem; }
.qty-step button.plus { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; }
.qty-step input { width: 64px; text-align: center; border-radius: 8px; }

/* ขั้นตอนนำเข้า */
.imp-steps { display: flex; gap: 8px; margin-bottom: 18px; }
.imp-steps .imp-step { flex: 1; display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--edl-muted); }
.imp-steps .imp-step b { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--edl-soft); color: var(--edl-muted); flex: none; }
.imp-steps .imp-step.on { color: var(--edl-text); font-weight: 600; }
.imp-steps .imp-step.on b { background: var(--bs-primary); color: #fff; }
.imp-drop { border: 2px dashed var(--edl-primary-line); border-radius: var(--edl-radius); padding: 34px 16px; text-align: center; background: var(--edl-primary-tint); cursor: pointer; transition: background .15s, border-color .15s; }
.imp-drop.drag { background: var(--edl-primary-soft); border-color: var(--bs-primary); }
.imp-drop i { font-size: 2.2rem; color: var(--bs-primary); }
.imp-sheet { border: 1px solid var(--edl-line); border-radius: 12px; padding: 10px 12px; }
.imp-sheet + .imp-sheet { margin-top: 10px; }
.imp-sheet.off { opacity: .6; background: var(--edl-soft-2); }
.imp-num { display: inline-flex; flex-direction: column; align-items: center; min-width: 64px; padding: 4px 8px; border-radius: 10px; background: var(--edl-soft); }
.imp-num b { font-size: 1rem; line-height: 1.2; color: var(--edl-text); }
.imp-num span { font-size: .68rem; color: var(--edl-muted); }
.imp-chg { line-height: 1.45; }
.imp-chg + .imp-chg { margin-top: 2px; }
.imp-chg .bi-arrow-right { font-size: .7rem; color: var(--edl-muted); }

/* กราฟแท่งเล็ก / รายการแบบบาร์ */
.bar-row { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--edl-line-2); }
.bar-row:last-child { border-bottom: 0; }
.bar-row .bar-track { height: 6px; border-radius: 999px; background: var(--edl-line-2); overflow: hidden; }
.bar-row .bar-track > span { display: block; height: 100%; border-radius: 999px; background: var(--c, var(--bs-primary)); }

.feed-item { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--edl-line-2); }
.feed-item:last-child { border-bottom: 0; }
.feed-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 1rem; }

/* Timeline ในรายละเอียดเอกสาร */
.tl { padding: 0; margin: 0; }
.tl li { position: relative; padding: 0 0 14px 34px; font-size: .82rem; }
.tl li:before { content: ''; position: absolute; left: 12px; top: 26px; bottom: 0; width: 2px; background: var(--edl-line-2); }
.tl li:last-child:before { display: none; }
.tl li .tl-ico { position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--edl-soft); color: var(--edl-muted-2); font-size: .8rem; }
.tl li.done .tl-ico { background: var(--edl-success-soft); color: var(--edl-success); }
.tl li.bad .tl-ico { background: var(--edl-danger-soft); color: var(--edl-danger); }
.tl li .tl-at { font-size: .72rem; color: var(--edl-muted); }

/* QR */
.qr-box { background: var(--edl-surface); border: 1px solid var(--edl-line); border-radius: 12px; padding: 10px; display: inline-block; line-height: 0; }
.qr-box img, .qr-box canvas { width: 100%; height: auto; }
.qr-card { border: 1px solid var(--edl-line-2); border-radius: var(--edl-radius); padding: 14px; text-align: center; height: 100%; background: var(--edl-surface); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qr-card .qr-box { width: 150px; }
.qr-card .qr-title { font-weight: 600; }

/* แท็บแบบปุ่ม */
.lc-tabs { display: flex; gap: 4px; background: var(--edl-surface); border-radius: var(--edl-radius); padding: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 20px; box-shadow: var(--edl-shadow); }
.lc-tabs::-webkit-scrollbar { display: none; }
.lc-tabs button, .lc-tabs a { flex: none; border: 0; background: transparent; border-radius: 8px; padding: 8px 16px; font-size: .86rem; font-weight: 500; color: var(--edl-text-2); white-space: nowrap; }
.lc-tabs button:hover, .lc-tabs a:hover { color: var(--bs-primary); }
.lc-tabs .active { background: var(--bs-primary); color: #fff !important; box-shadow: 0 8px 16px -6px rgba(var(--bs-primary-rgb), .55); }
.lc-tabs .d-tab-count { background: var(--edl-danger); color: #fff; font-size: .68rem; font-weight: 700; vertical-align: 1px; }
.lc-tabs .active .d-tab-count { background: var(--edl-surface); color: var(--bs-primary); }
.lc-tabs .d-tab-count:empty { display: none; }

/* การ์ดใบเบิกในคิว "อนุมัติ" */
.lc-queue-card { display: block; border: 1px solid var(--edl-line); border-radius: 10px; background: var(--edl-surface); padding: 10px 12px; transition: border-color .15s, box-shadow .15s, background .15s; color: var(--edl-text-2); }
.lc-queue-card:hover { border-color: var(--edl-primary-line); box-shadow: var(--edl-shadow-hover); color: var(--edl-text-2); }
.lc-queue-card.on { border-color: var(--bs-primary); background: var(--edl-primary-tint); box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), .12); }
#docList { max-height: 70vh; overflow-y: auto; }
.lc-chipset { display: flex; gap: 6px; flex-wrap: wrap; }
.lc-chipset .chip { border: 1px solid var(--edl-line); background: var(--edl-surface); border-radius: 999px; padding: 5px 12px; font-size: .8rem; color: var(--edl-text-2); cursor: pointer; user-select: none; }
.lc-chipset .chip:hover { border-color: var(--edl-primary-line); color: var(--bs-primary); }
.lc-chipset .chip.on { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; }

/* ตัวอย่างสีในหน้าตั้งค่า */
.color-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--edl-line-2); }
.color-row:last-child { border-bottom: 0; }

/* ช่องค้นหาเล็กใต้ตัวกรอง */
.lc-search-sm { position: relative; }
.lc-search-sm > i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: .8rem; color: var(--edl-muted); pointer-events: none; }
.lc-search-sm input { padding-left: 28px; }
.lc-subfilter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--edl-soft-2); border: 1px dashed var(--edl-line); border-radius: var(--edl-radius-sm); padding: 8px 10px; }
.lc-subfilter .lc-search-sm { flex: 1; min-width: 200px; max-width: 320px; }

/* ============================================================
   สแกนเนอร์ / ค้นหาด้วยรหัส แบบเต็มจอ (หลังบ้าน + เซลล์)
   ============================================================ */
.scanner-ov {
    position: fixed; inset: 0; background: var(--edl-dark); z-index: 2100; display: none; flex-direction: column; align-items: center;
    padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); overflow-y: auto;
}
.scanner-ov.show { display: flex; }
.scanner-ov .sc-top { width: 100%; max-width: 440px; display: flex; align-items: center; justify-content: space-between; color: #fff; font-size: 1rem; margin-bottom: 14px; }
.scanner-ov .sc-close { width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, .12); border: 0; color: #fff; display: grid; place-items: center; }
.scanner-ov .sc-view { width: 100%; max-width: 440px; aspect-ratio: 1/1; border-radius: 22px; background: var(--edl-dark-2); position: relative; overflow: hidden; flex: none; }
.scanner-ov .sc-view video { object-fit: cover; }
.scanner-ov .sc-view #scReader { width: 100%; height: 100%; }
.scanner-ov .sc-view #scReader > div { border: 0 !important; }
.scanner-ov .sc-corner { position: absolute; width: 36px; height: 36px; border: 3px solid var(--edl-primary-light); z-index: 3; pointer-events: none; }
.scanner-ov .sc-corner.tl { top: 16px; left: 16px; border-right: 0; border-bottom: 0; border-radius: 14px 0 0 0; }
.scanner-ov .sc-corner.tr { top: 16px; right: 16px; border-left: 0; border-bottom: 0; border-radius: 0 14px 0 0; }
.scanner-ov .sc-corner.bl { bottom: 16px; left: 16px; border-right: 0; border-top: 0; border-radius: 0 0 0 14px; }
.scanner-ov .sc-corner.br { bottom: 16px; right: 16px; border-left: 0; border-top: 0; border-radius: 0 0 14px 0; }
.scanner-ov .sc-line { position: absolute; left: 24px; right: 24px; height: 2px; background: var(--edl-primary-light); opacity: .85; z-index: 3; animation: sc-move 2.2s ease-in-out infinite; pointer-events: none; }
@keyframes sc-move { 0%, 100% { top: 18%; } 50% { top: 80%; } }
.scanner-ov .sc-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: rgba(255, 255, 255, .6); padding: 30px; z-index: 2; font-size: .9rem; }
.scanner-ov .sc-body { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.scanner-ov.type-only .sc-body { margin-top: 2px; }
.scanner-ov .sc-tabs { width: 100%; max-width: 440px; display: flex; gap: 6px; background: rgba(255, 255, 255, .08); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.scanner-ov .sc-tabs[hidden] { display: none; }
.scanner-ov .sc-tabs button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 9px; padding: 9px; background: transparent; color: rgba(255, 255, 255, .72); font-size: .9rem; }
.scanner-ov .sc-tabs button.on { background: var(--bs-primary); color: #fff; font-weight: 600; }
.scanner-ov .sc-manual { display: flex; gap: 8px; }
.scanner-ov .sc-manual input { flex: 1; min-width: 0; border-radius: 10px; border: 0; padding: 12px 16px; font-size: 16px; box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), .45); }
.scanner-ov .sc-manual input:focus { outline: 0; box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), .8); }
.scanner-ov .sc-manual button { border-radius: 10px; border: 0; background: var(--bs-primary); color: #fff; padding: 0 18px; font-weight: 600; }
.scanner-ov .sc-note { text-align: center; color: rgba(255, 255, 255, .55); font-size: .82rem; }
.scanner-ov .sc-btn { display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; padding: 13px; font-size: .92rem; border: 1px solid rgba(255, 255, 255, .3); color: #fff; background: transparent; cursor: pointer; }
.scanner-ov .sc-btn.solid { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; }
.scanner-ov .sc-sug { display: flex; flex-direction: column; gap: 8px; max-height: 58vh; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 2px 2px 4px; }
.scanner-ov .sc-sug:empty { display: none; }
.scanner-ov .sc-count { font-size: .8rem; color: rgba(255, 255, 255, .55); padding: 0 4px 2px; }
.scanner-ov .sc-empty { text-align: center; color: rgba(255, 255, 255, .75); font-size: .92rem; padding: 18px 8px; }
.scanner-ov .sc-empty i { display: block; font-size: 24px; margin-bottom: 6px; opacity: .6; }
.scanner-ov .sc-empty small { display: block; font-size: .8rem; color: rgba(255, 255, 255, .5); margin-top: 3px; }
.scanner-ov .sc-hit {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; cursor: pointer; background: var(--edl-surface); color: var(--edl-text);
    border-radius: 12px; padding: 10px; box-shadow: 0 2px 10px rgba(0, 0, 0, .18); transition: transform .12s, box-shadow .12s;
}
.scanner-ov .sc-hit:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 0, 0, .28); }
.scanner-ov .sc-hit:active { transform: scale(.99); }
.scanner-ov .sc-hit.dim { background: var(--edl-soft-3); }
.scanner-ov .sc-hit b { display: block; font-weight: 600; font-size: .9rem; }
.scanner-ov .sc-hit small { display: block; font-size: .76rem; color: var(--edl-muted); }
.scanner-ov .sc-hit .pic { flex: none; }
.scanner-ov .sc-hit .pic .sp-thumb { width: 54px; height: 54px; border-radius: 10px; }
.scanner-ov .sc-hit .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.scanner-ov .sc-hit .cd { font-size: .98rem; font-weight: 700; letter-spacing: .01em; line-height: 1.3; overflow-wrap: anywhere; }
.scanner-ov .sc-hit .nm { font-size: .85rem; color: var(--edl-text-2); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scanner-ov .sc-hit .mt { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.scanner-ov .sc-hit .mt > span { font-size: .72rem; line-height: 1; padding: 4px 8px; border-radius: 999px; background: var(--edl-surface); box-shadow: inset 0 0 0 1px var(--edl-line); color: var(--edl-text-2); white-space: nowrap; }
.scanner-ov .sc-hit .mt > .br, .scanner-ov .sc-hit .mt > .tg { box-shadow: none; }
.scanner-ov .sc-hit .mt .br { background: var(--bs-primary-bg-subtle); color: var(--bs-primary); font-weight: 600; }
.scanner-ov .sc-hit .mt .tg.out { background: var(--edl-danger-soft); color: var(--edl-danger); }
.scanner-ov .sc-hit .mt .tg.off { background: var(--edl-soft-3); color: var(--edl-muted); }
.scanner-ov .sc-hit .mt .tg.wait { background: var(--edl-warning-soft); color: var(--edl-warning); }
.scanner-ov .sc-hit .ad, .scanner-ov .sc-hit .add { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--bs-primary); color: #fff; font-size: 18px; }
.scanner-ov .sc-hit .ad b { font-size: .88rem; font-weight: 700; }
.scanner-ov .sc-hit.dim .ad { background: transparent; color: var(--edl-muted-2); }
.scanner-ov .sc-hit mark { background: #fff1b8; color: inherit; padding: 0 1px; border-radius: 3px; }
.scanner-ov .sc-hit img { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; flex: none; }
.scanner-ov .sc-last { background: rgba(255, 255, 255, .08); border-radius: 12px; padding: 10px 12px; color: #fff; font-size: .88rem; display: none; }
.scanner-ov .sc-last.show { display: block; animation: lc-rise .2s ease-out; }

/* ================= ปรับตามขนาดจอ ================= */
@media (max-width: 991.98px) {
    .card { margin-bottom: 16px; }
    .card-body { padding: 16px; }
    .card-header { padding: 13px 16px; }
    .lc-stat-row { margin-bottom: 16px; }
    .lc-page-head { padding: 16px 18px; margin-bottom: 16px; }
    .lc-stat .lc-stat-value { font-size: 1.35rem; }
}

@media (max-width: 767.98px) {
    .lc-page-head { flex-direction: column; align-items: stretch; }
    .lc-page-head > div:first-child { flex: 0 0 auto; }
    .lc-page-head .lc-head-actions { width: 100%; }
    .lc-page-head .lc-head-actions .btn { flex: 1 1 auto; justify-content: center; }
    .lc-page-head .form-select, .lc-page-head .form-control, .lc-page-head .lc-hsel { width: 100% !important; min-width: 0 !important; }
    .lc-seg-head { width: 100%; }
    .lc-seg-head button { flex: 1 1 auto; }

    .card-body { padding: 13px; }
    .card-header { padding: 11px 13px; font-size: .9rem; }

    .lc-stat { padding: 14px; }
    .lc-stat .lc-stat-value { font-size: 1.2rem; }
    .lc-stat .lc-stat-icon { width: 32px; height: 32px; font-size: .95rem; right: 10px; top: 10px; }
    .lc-stat-row { margin-bottom: 12px; }

    div.dataTables_wrapper div.dataTables_filter,
    div.dataTables_wrapper div.dataTables_length,
    div.dataTables_wrapper div.dataTables_info { text-align: left; }
    .table-responsive { -webkit-overflow-scrolling: touch; }
    .table { font-size: .8rem; }
    .table > :not(caption) > * > * { padding: .55rem .5rem; }

    .form-control, .form-select,
    .select2-container--default .select2-selection--single .select2-selection__rendered,
    .select2-search--dropdown .select2-search__field,
    div.dataTables_wrapper div.dataTables_filter input { font-size: 16px; }
    .form-control-sm, .form-select-sm { font-size: 16px; padding: .4rem .6rem; }
    .imp-steps .imp-step span { display: none; }
    .lc-tabs { margin-bottom: 14px; }
}

@media (max-width: 575.98px) {
    .lc-page-head h4 { font-size: 1.02rem; }
    .lc-page-head h4 .lc-head-ico { width: 36px; height: 36px; font-size: 1rem; margin-right: 10px; }
    .lc-page-head p { font-size: .76rem; }
    .lc-dt-top, .lc-dt-bottom { flex-direction: column; align-items: stretch; gap: 8px; }
    .lc-dt-search, .lc-dt-len, .lc-dt-info, .lc-dt-page { flex: 0 0 auto; text-align: left; }
    .lc-dt-page { display: flex; justify-content: center; }
    div.dataTables_wrapper div.dataTables_filter input { max-width: none; }
    .pagination { margin-bottom: 0; flex-wrap: wrap; justify-content: center; }
    .card-body > .row .btn { width: 100%; }
    .card-body > .row .btn-group .btn { width: auto; }
    .btn-group-sm > .btn { padding: .3rem .45rem; font-size: .74rem; }
    .lc-stat .lc-stat-label { font-size: .74rem; }
    .lc-stat .lc-stat-value { font-size: 1.1rem; }
    .lc-stat .lc-stat-sub { font-size: .7rem; }
    .lc-perm-group { padding: 8px 10px; }
    .modal-footer .btn { flex: 1 1 auto; }
    .modal-body { padding: 14px 16px; }
    .modal-header { padding: 13px 16px; }
}

/* ---------- พิมพ์ ---------- */
@media print {
    .side-mini-panel, .topbar, .no-print, .dark-transparent, .sp-tabbar { display: none !important; }
    .page-wrapper { margin: 0 !important; }
    .body-wrapper { margin: 0 !important; background: var(--edl-surface) !important; }
    .body-wrapper > .container-fluid { padding: 0 !important; }
    .card { box-shadow: none; }
    body { background: var(--edl-surface); }
}


/* ============================================================
   ตั้งค่าหน้าตา (customizer) — ปุ่มลอย + แผงด้านขวา + ปุ่มท้ายแถบไอคอน
   ============================================================ */
.edl-customizer-btn { width: 52px; height: 52px; padding: 0; font-size: 1.35rem; z-index: 1030; box-shadow: 0 10px 24px -6px rgba(var(--bs-danger-rgb), .6); }
.edl-customizer-btn i { display: inline-block; animation: edl-gear 8s linear infinite; }
@keyframes edl-gear { to { transform: rotate(360deg); } }
.edl-customizer { --bs-offcanvas-width: 340px; color: var(--edl-text-2); }
.edl-customizer .offcanvas-title { color: var(--edl-text); font-size: 1.05rem; }
.edl-cz-h { font-size: .88rem; font-weight: 700; color: var(--edl-text); margin: 22px 0 10px; }
.edl-customizer .customizer-box label.btn { min-width: 0; padding: 10px 14px; font-size: .86rem; font-weight: 600; color: var(--edl-text-2); }
.edl-customizer .customizer-box .btn-check:checked + .btn { border-color: var(--bs-primary) !important; color: var(--bs-primary); box-shadow: 0 0 0 1px var(--bs-primary) inset !important; }
.edl-cz-color { width: 42px; height: 42px; padding: 0 !important; }
.edl-cz-color .color-box { width: 24px !important; height: 24px !important; }
.edl-customizer .color-pallete { gap: 7px !important; }
.edl-rail-foot { flex: none; display: flex; justify-content: center; padding: 6px 0 16px; }
.edl-rail-foot a { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--edl-text); font-size: 1.2rem; }
.edl-rail-foot a:hover { background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
@media (max-width: 575.98px) {
    .edl-customizer-btn { width: 44px; height: 44px; font-size: 1.15rem; bottom: 14px; right: 14px; }
}
.edl-cz-group { margin: 26px 0 -6px; padding-top: 14px; border-top: 1px solid var(--edl-line-2); font-size: .72rem; font-weight: 700; letter-spacing: .06em; color: var(--edl-muted); text-transform: uppercase; }
.edl-cz-group:first-child { margin-top: 8px; border-top: 0; padding-top: 0; }
.edl-cz-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.edl-customizer .customizer-box label.edl-cz-font { flex-direction: column; justify-content: center; gap: 3px; min-width: 0; padding: 9px 4px; text-align: center; font-weight: 500; font-size: .74rem; white-space: nowrap; }
.edl-cz-font .edl-cz-sample { font-size: 1.05rem; line-height: 1.15; }
.edl-cz-font .edl-cz-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; color: var(--edl-muted); }
.edl-customizer .customizer-box .btn-check:checked + .edl-cz-font .edl-cz-name { color: var(--bs-primary); }
.edl-customizer .customizer-box label.edl-cz-size { padding: 8px 11px; }
.edl-cz-pick { position: relative; overflow: hidden; }
.edl-cz-pick .color-box { background: conic-gradient(#e5446f, #f2b84b, #1f9d5b, #1a9fc8, #635bff, #d63384, #e5446f); color: #fff; font-size: .72rem; }
.edl-cz-pick.is-on { border-color: var(--bs-primary) !important; box-shadow: 0 0 0 1px var(--bs-primary) inset !important; }
.edl-cz-pick.is-on .color-box { background: var(--pick); }
.edl-cz-pick .pick-on, .edl-cz-pick.is-on .pick-off { display: none; }
.edl-cz-pick.is-on .pick-on { display: inline; }
.edl-cz-pick input[type="color"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

/* ============================================================
   ค่าจากแผงตั้งค่าหน้าตา (ui.js ใส่ attribute ไว้ที่ <html>)
   ============================================================ */
/* ปุ่มเส้นขอบสีหลัก: ธีมใส่สีม่วงตายตัว → ใช้สีธีมที่เลือกจริง */
:root .btn-outline-primary {
    --bs-btn-color: var(--bs-primary); --bs-btn-border-color: var(--bs-primary); --bs-btn-hover-bg: var(--bs-primary); --bs-btn-hover-border-color: var(--bs-primary);
    --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb); --bs-btn-active-bg: var(--bs-primary); --bs-btn-active-border-color: var(--bs-primary);
    --bs-btn-disabled-color: var(--bs-primary); --bs-btn-disabled-border-color: var(--bs-primary);
}
/* สีที่เลือกเอง (Custom_Theme — ui.js ตั้ง --bs-primary* ไว้ที่ <html>) */
:root[data-color-theme="Custom_Theme"] .btn-primary {
    --bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary); --bs-btn-hover-bg: var(--edl-primary-2); --bs-btn-hover-border-color: var(--edl-primary-2);
    --bs-btn-active-bg: var(--edl-primary-2); --bs-btn-active-border-color: var(--edl-primary-2); --bs-btn-disabled-bg: var(--bs-primary); --bs-btn-disabled-border-color: var(--bs-primary);
    --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
:root[data-color-theme="Custom_Theme"] .nav-tabs { --bs-nav-tabs-link-active-bg: var(--bs-primary); }
:root[data-color-theme="Custom_Theme"] .dropdown-menu { --bs-dropdown-link-hover-color: var(--bs-primary); }

/* ฟอนต์ */
:root[data-font="sarabun"] { --edl-font: "Sarabun", "Noto Sans Thai", system-ui, sans-serif; }
:root[data-font="plex"] { --edl-font: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif; }
:root[data-font="prompt"] { --edl-font: "Prompt", "Noto Sans Thai", system-ui, sans-serif; }
:root[data-font="kanit"] { --edl-font: "Kanit", "Noto Sans Thai", system-ui, sans-serif; }
:root[data-font="anuphan"] { --edl-font: "Anuphan", "Noto Sans Thai", system-ui, sans-serif; }

/* ขนาดตัวอักษร — ขนาดส่วนใหญ่เป็น rem จึงขยายทั้งหน้าพร้อมกัน */
html[data-size="sm"] { font-size: 93.75%; }
html[data-size="lg"] { font-size: 112.5%; }
html[data-size="xl"] { font-size: 125%; }

/* ความหนาแน่น: กระชับ — ระยะในการ์ด / ตาราง / ฟอร์ม แคบลง เห็นข้อมูลต่อหน้าจอมากขึ้น */
html[data-density="compact"] .card-body { padding: 14px 16px; }
html[data-density="compact"] .card-header { padding-top: 10px; padding-bottom: 10px; }
html[data-density="compact"] .card { margin-bottom: 14px; }
html[data-density="compact"] .lc-stat { padding: 13px 14px; }
html[data-density="compact"] .table > :not(caption) > * > * { padding: .42rem .55rem; }
html[data-density="compact"] .form-control:not(.form-control-sm), html[data-density="compact"] .form-select:not(.form-select-sm) { padding-top: .42rem; padding-bottom: .42rem; }
html[data-density="compact"] .btn:not(.btn-sm):not(.btn-icon):not(.edl-customizer-btn) { --bs-btn-padding-y: .4rem; }
html[data-density="compact"] .body-wrapper > .container-fluid { padding-top: 14px; }
html[data-density="compact"] .row.g-3 { --bs-gutter-y: .75rem; --bs-gutter-x: .75rem; }

/* ตาราง: สลับสีแถว */
html[data-table="striped"] .table > tbody > tr:nth-of-type(odd):not(.child) > * { background-color: var(--edl-soft-2); }
html[data-table="striped"] .table > tbody > tr > td { border-bottom-color: transparent; }
html[data-table="striped"] .table-hover > tbody > tr:hover > * { background-color: var(--edl-soft-3); }

/* ลดการเคลื่อนไหว — ปิดทรานซิชัน / แอนิเมชันตกแต่ง (ตัวหมุนตอนโหลดยังหมุนอยู่) */
html[data-motion="off"] *:not(.lc-spin):not(.lc-spin-inline):not(.lc-ring):not(.spinner-border):not(.spinner-grow),
html[data-motion="off"] *::before, html[data-motion="off"] *::after {
    transition-duration: 0s !important; transition-delay: 0s !important; animation-duration: 0s !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important;
}

/* สีเมนูซ้าย: เข้ม (ทุกโหมด) — เปลี่ยนตัวแปรเฉพาะในเมนู ส่วนประกอบข้างในใช้ --edl-* อยู่แล้ว */
html[data-sidebar-color="dark"] #edlSidebar {
    --edl-text: #e6ebf1; --edl-text-2: #b3bfcc; --edl-muted: #8b98a8; --edl-line-2: #26344b; --edl-soft: rgba(255, 255, 255, .06);
    --edl-surface: #172234; --bs-heading-color: #e6ebf1; --bs-body-color: #b3bfcc; --bs-primary-bg-subtle: rgba(255, 255, 255, .08); color: var(--edl-text-2);
}
html[data-sidebar-color="dark"] #edlSidebar,
html[data-sidebar-color="dark"] #edlSidebar .mini-nav,
html[data-sidebar-color="dark"] #edlSidebar .mini-nav .mini-nav-item > a { background: #111a29 !important; }
html[data-sidebar-color="dark"] #edlSidebar .sidebarmenu .sidebar-nav,
html[data-sidebar-color="dark"] #edlSidebar .nav-logo { background: #172234 !important; }
html[data-sidebar-color="dark"] #edlSidebar .side-mini-panel, html[data-sidebar-color="dark"] .side-mini-panel { box-shadow: none; }
html[data-sidebar-color="dark"] #edlSidebar .edl-brand img { border-color: transparent; }
/* สีเมนูซ้าย: สีธีม — แถบไอคอนเป็นสีธีม · รายการเมนูพื้นปกติ */
html[data-sidebar-color="primary"] #edlSidebar .mini-nav,
html[data-sidebar-color="primary"] #edlSidebar .mini-nav .mini-nav-item > a { background: var(--bs-primary) !important; }
html[data-sidebar-color="primary"] #edlSidebar .mini-nav { --edl-text: #fff; }
html[data-sidebar-color="primary"] #edlSidebar .mini-nav .mini-nav-item > a > i,
html[data-sidebar-color="primary"] #edlSidebar .mini-nav .sidebartoggler,
html[data-sidebar-color="primary"] #edlSidebar .edl-rail-foot a { color: rgba(255, 255, 255, .86); }
html[data-sidebar-color="primary"] #edlSidebar .mini-nav .mini-nav-item > a:hover > i,
html[data-sidebar-color="primary"] #edlSidebar .mini-nav .sidebartoggler:hover,
html[data-sidebar-color="primary"] #edlSidebar .edl-rail-foot a:hover { color: #fff; background: rgba(255, 255, 255, .14); }
html[data-sidebar-color="primary"] #edlSidebar .mini-nav .mini-nav-item > a:hover::before { background: rgba(255, 255, 255, .16); }
html[data-sidebar-color="primary"] #edlSidebar .mini-nav .mini-nav-item.selected > a::before { background: #fff; }
html[data-sidebar-color="primary"] #edlSidebar .mini-nav .mini-nav-item.selected > a > i { color: var(--bs-primary); }

/* ความกว้างหน้าแบบกล่องกลางจอ */
html[data-boxed-layout="boxed"] .body-wrapper > .container-fluid { max-width: 1200px; }

/* การ์ดแบบมีเส้นขอบ (แทนเงา) */
[data-card="border"] :is(.card, .lc-page-head, .lc-stat, .lc-tabs, .sp-card, .sp-muted-box, .sp-stat, .sp-action, .sp-prod, .sp-doc, .sp-prof, .sp-seg, .sp-cover-card, .sp-bento > div) {
    border: 1px solid var(--edl-line);
    box-shadow: none;
}

/* ============================================================
   ฝ่ายขาย (Sales Management) — โครงการ / ความเคลื่อนไหว / เข้าพบ Owner
   ============================================================ */
.lc-avatar.sm, .lc-avatar-txt.sm { width: 28px; height: 28px; font-size: .68rem; }
.truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lc-page-head h4.text-wrap { align-items: flex-start; line-height: 1.35; }

/* ป้ายสถานะโครงการ (สีจากข้อมูลรวม) / ที่มาของการอัพเดท */
.pj-st { background: color-mix(in srgb, var(--c) 15%, var(--edl-surface)); color: color-mix(in srgb, var(--c) 80%, var(--edl-text)); font-weight: 600; }
.pj-src { display: inline-flex; align-items: center; border-radius: 6px; padding: 1px 7px; font-size: .7rem; font-weight: 600;
    background: color-mix(in srgb, var(--c, var(--edl-muted)) 14%, var(--edl-surface)); color: color-mix(in srgb, var(--c, var(--edl-muted)) 85%, var(--edl-text)); }
.lc-tabs .pj-tab-n { background: var(--edl-soft-3); color: var(--edl-text-2); font-size: .68rem; font-weight: 700; vertical-align: 1px; }
.lc-tabs .active .pj-tab-n { background: rgba(255, 255, 255, .25); color: #fff; }
.lc-tabs .pj-tab-n:empty { display: none; }
.pj-spec-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.pj-spec-tag { display: inline-block; border: 1px solid var(--edl-line); background: var(--edl-soft); border-radius: 6px; padding: 1px 7px; font-size: .72rem; color: var(--edl-text-2); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-spec-tag.more { background: transparent; color: var(--edl-muted); }

/* ฟอร์มโครงการ */
.pj-sec { font-size: .82rem; font-weight: 700; color: var(--bs-primary); margin: 22px 0 10px; padding-top: 14px; border-top: 1px solid var(--edl-line-2); }
.pj-sec:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.pj-big { display: flex; gap: 10px; align-items: center; border: 1px solid var(--edl-line); border-radius: var(--edl-radius-sm); padding: 8px 12px; cursor: pointer; background: var(--edl-surface); margin: 0; }
.pj-big:has(input:checked) { border-color: var(--edl-info); background: var(--edl-info-soft); }
.pj-big small { display: block; font-size: .72rem; color: var(--edl-muted); }
.pj-specs { display: flex; flex-direction: column; gap: 8px; }
.pj-spec { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr) auto; gap: 6px; }
@media (max-width: 767.98px) {
    .pj-spec { grid-template-columns: 1fr 1fr auto; padding: 8px; border: 1px solid var(--edl-line-2); border-radius: var(--edl-radius-sm); }
    .pj-spec [data-k=spec] { grid-column: 1 / 3; }
    .pj-spec [data-k=note] { grid-column: 1 / 3; }
    .pj-spec .pj-spec-del { grid-row: 1; grid-column: 3; }
}

/* ฟอร์มโครงการ: ทีมเซลล์ (เซลล์ร่วม) */
.pj-team { border: 1px solid var(--edl-line); border-radius: var(--edl-radius-sm); padding: 6px; background: var(--edl-surface); display: flex; flex-direction: column; gap: 6px; }
.pj-team-chips { display: flex; flex-wrap: wrap; gap: 4px; min-height: 26px; align-items: center; }
.pj-team-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 9px; border-radius: 999px; font-size: .8rem;
    background: color-mix(in srgb, var(--bs-primary) 10%, transparent); color: var(--bs-primary); }
.pj-team-chip.is-owner { padding-right: 9px; background: var(--bs-primary); color: #fff; }
.pj-team-chip.is-raw { background: var(--edl-soft-3); color: var(--edl-muted); }
.pj-team-chip small { font-size: .7rem; opacity: .8; }
.pj-team-x { border: 0; background: transparent; color: inherit; line-height: 1; font-size: 1rem; padding: 0 4px; border-radius: 50%; opacity: .7; }
.pj-team-x:hover { opacity: 1; background: color-mix(in srgb, currentColor 15%, transparent); }

/* หน้ารายละเอียด: ไทม์ไลน์ความเคลื่อนไหว */
.pj-quick { border: 1px dashed var(--edl-line-3); background: var(--edl-soft); color: var(--edl-muted); border-radius: var(--edl-radius-sm); padding: 12px 16px; text-align: left; font-size: .88rem; }
.pj-quick:hover { border-color: var(--bs-primary); color: var(--bs-primary); }
.pj-tl > li { position: relative; display: flex; gap: 12px; padding-bottom: 18px; }
.pj-tl > li:not(:last-child)::before { content: ''; position: absolute; left: 15px; top: 34px; bottom: 4px; width: 2px; background: var(--edl-line-2); }
.pj-tl-ico { width: 32px; height: 32px; border-radius: 10px; flex: none; display: grid; place-items: center; font-size: .9rem;
    background: color-mix(in srgb, var(--c) 14%, var(--edl-surface)); color: var(--c); }
.pj-tl-body { min-width: 0; flex: 1; }
.pj-tl-text { white-space: pre-line; word-break: break-word; font-size: .88rem; margin-top: 4px; color: var(--edl-text); }
.pj-kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .85rem; }
.pj-kv dt { color: var(--edl-muted); font-weight: 500; white-space: nowrap; }
.pj-kv dd { margin: 0; white-space: pre-line; word-break: break-word; }

/* แดชบอร์ด: วง Win rate */
.pj-ring { --p: 0%; width: 92px; height: 92px; border-radius: 50%; flex: none; display: grid; place-content: center; text-align: center;
    background: radial-gradient(closest-side, var(--edl-surface) 78%, transparent 79% 100%), conic-gradient(var(--edl-success) var(--p), var(--edl-danger-soft) 0); }
.pj-ring b { font-size: 1.25rem; line-height: 1; color: var(--edl-text); }
.pj-ring small { font-size: .66rem; color: var(--edl-muted); }

/* เข้าพบ Owner */
.vs-item { border: 1px solid var(--edl-line); border-radius: var(--edl-radius-sm); padding: 10px; background: var(--edl-surface); }
.vs-item + .vs-item { margin-top: 10px; }
.vs-item-head { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.vs-item-no { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--edl-soft-3); font-size: .75rem; font-weight: 700; color: var(--edl-text-2); }
@media (max-width: 767.98px) {
    .vs-item-head { grid-template-columns: auto minmax(0, 1fr) auto; }
    .vs-item-head .select2-container { grid-column: 1 / -1; }
}
.vs-view { padding: 10px 0; border-bottom: 1px solid var(--edl-line-2); }
.vs-view:last-child { border-bottom: 0; }

/* Telegram */
.tg-group { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--edl-line-2); }
.tg-group:last-child { border-bottom: 0; }
.tg-preview { white-space: pre-line; font-size: .82rem; background: var(--edl-soft); border: 1px solid var(--edl-line-2); border-radius: 12px; padding: 12px 14px; max-height: 320px; overflow: auto; }

/* แดชบอร์ดภาพรวมทุกระบบ */
.ov-card { background: var(--edl-surface); border-radius: var(--edl-radius); box-shadow: var(--edl-shadow); padding: 18px 20px; border: 1px solid transparent;
    border-top: 3px solid var(--c, var(--bs-primary)); transition: transform .16s, box-shadow .16s; }
a.ov-card:hover { transform: translateY(-2px); box-shadow: var(--edl-shadow-hover); }
.ov-head { display: flex; align-items: center; gap: 10px; font-size: .95rem; }
.ov-head .bi-arrow-right { color: var(--edl-muted); }
.ov-big { display: flex; align-items: baseline; gap: 8px; margin: 14px 0 12px; }
.ov-big span { font-size: 2rem; font-weight: 700; line-height: 1; color: var(--edl-text); }
.ov-big small { color: var(--edl-muted); font-size: .82rem; }
.ov-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; padding-top: 12px; border-top: 1px dashed var(--edl-line); }
.ov-kv span { display: flex; flex-direction: column; min-width: 0; }
.ov-kv small { font-size: .72rem; color: var(--edl-muted); }
.ov-kv b { font-size: 1.05rem; color: var(--edl-text); }
.ov-soon { border-top-color: var(--edl-line-3); background: color-mix(in srgb, var(--edl-soft) 60%, var(--edl-surface)); }
[data-card="border"] .ov-card { border-color: var(--edl-line); box-shadow: none; }

/* ============================================================
   โหมดมืด — ส่วนที่ธีมไม่ได้ครอบคลุม
   ============================================================ */
/* ป้ายสถานะที่สีมาจากเซิร์ฟเวอร์ (พื้นพาสเทลแบบสว่าง) → พื้นโปร่งจากสีตัวอักษร */
[data-bs-theme="dark"] .edl-tone { background: color-mix(in srgb, currentColor 18%, transparent) !important; filter: brightness(1.3); }
[data-bs-theme="dark"] .topbar.is-scrolled { box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
[data-bs-theme="dark"] .modal-backdrop.show { opacity: .6; background: #000; }
[data-bs-theme="dark"] .swal2-input,
[data-bs-theme="dark"] .swal2-textarea,
[data-bs-theme="dark"] .swal2-select { background: var(--edl-soft) !important; color: var(--edl-text) !important; border-color: var(--edl-line) !important; }
[data-bs-theme="dark"] .swal2-toast { border: 1px solid var(--edl-line) !important; }
[data-bs-theme="dark"] .select2-dropdown { background: var(--edl-surface); }
[data-bs-theme="dark"] .select2-search--dropdown .select2-search__field { background: var(--edl-soft); color: var(--edl-text); border-color: var(--edl-line); }
[data-bs-theme="dark"] .select2-container--default .select2-results__option[aria-selected="true"],
[data-bs-theme="dark"] .select2-container--default .select2-results__option--selected { background: var(--edl-soft-3); }
[data-bs-theme="dark"] .select2-results__option { color: var(--edl-text-2); }
[data-bs-theme="dark"] .lc-thumb, [data-bs-theme="dark"] .lc-swatch { border-color: rgba(255, 255, 255, .06); }
[data-bs-theme="dark"] .scanner-ov .sc-hit { background: var(--edl-surface); color: var(--edl-text); }
[data-bs-theme="dark"] .scanner-ov .sc-hit.dim { background: var(--edl-soft); }
[data-bs-theme="dark"] .scanner-ov .sc-hit mark { background: rgba(255, 214, 72, .35); }
[data-bs-theme="dark"] .scanner-ov .sc-hit .mt > span { background: transparent; }
[data-bs-theme="dark"] .lc-page-head { background: radial-gradient(circle 90px at calc(100% - 50px) 30px, rgba(var(--bs-primary-rgb), .054), rgba(var(--bs-primary-rgb), 0) 70%), var(--edl-surface); }
[data-bs-theme="dark"] input[type="color"] { background-color: var(--edl-soft); }

/* ---------- Administration: ยืม–คืน Viefe ---------- */
.vf-st { background: color-mix(in srgb, var(--c) 14%, var(--edl-surface)); color: var(--c); }
.vf-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 12px; border-radius: var(--edl-radius-sm);
    background: var(--edl-primary-tint); border: 1px solid var(--edl-primary-line); }
.vf-item-grid { display: grid; grid-template-columns: auto minmax(0, 2fr) minmax(0, 1fr) 90px 110px auto; gap: 6px; align-items: center; }
@media (max-width: 767.98px) {
    .vf-item-grid { grid-template-columns: auto minmax(0, 1fr) auto; }
    .vf-item-grid .select2-container { grid-column: 2 / 3; }
    .vf-item-grid > input { grid-column: 1 / -1; }
}
.vf-warn { max-height: 300px; overflow: auto; }
.vf-warn-row { font-size: .8rem; padding: 6px 0; border-bottom: 1px dashed var(--edl-line-2); line-height: 1.45; }
.vf-warn-row:last-child { border-bottom: 0; }
.vf-kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--edl-line-2); font-size: .86rem; }
.vf-kv span { color: var(--edl-muted); }

/* ---------- Warehouse Management (1.3) ---------- */
.wh-thumb { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 8px; object-fit: cover; background: var(--edl-soft); border: 1px solid var(--edl-line-2); display: inline-block; }
[data-bs-theme="dark"] .wh-thumb { border-color: rgba(255, 255, 255, .06); }
/* ฟอร์มเอกสารคลัง: มือถือแสดงรายการเป็นการ์ด (สินค้าบน · คงเหลือ / จำนวน / พาเลทล่าง) ไม่ต้องเลื่อนข้าง */
@media (max-width: 767.98px) {
    .wh-lines, .wh-lines tbody, .wh-lines tfoot { display: block; }
    .wh-lines thead { display: none; }
    .wh-lines tbody tr { display: grid; grid-template-columns: 20px repeat(3, minmax(0, 1fr)) auto; gap: 6px 8px; align-items: end; padding: 10px 0; border-bottom: 1px dashed var(--edl-line-2); }
    .wh-lines tbody td { padding: 0; border: 0; background: transparent; }
    .wh-lines td:first-child { align-self: center; grid-row: 1; }
    .wh-lines td.ln-p { grid-column: 2 / 5; grid-row: 1; }
    .wh-lines td.ln-x { grid-column: 5; grid-row: 1; align-self: center; }
    .wh-lines td[data-lb] { text-align: left !important; }
    .wh-lines td[data-lb]::before { content: attr(data-lb); display: block; font-size: .7rem; color: var(--edl-muted); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .wh-lines td[data-lb]:nth-child(3) { grid-column: 2; }
    .wh-lines td.ln-n { grid-column: 2 / 5; }
    .wh-lines td.lc-empty { grid-column: 1 / -1; }
    .wh-lines tfoot tr { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; }
    .wh-lines tfoot td { padding: 0; border: 0; }
    .wh-lines tfoot td:empty { display: none; }
}

/* ---------- ภาพรวม: เดือนนี้เทียบเดือนก่อน ---------- */
.ov-month { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.ov-m { border: 1px solid var(--edl-line-2); border-radius: var(--edl-radius-sm, 10px); padding: 10px 12px; background: var(--edl-surface); min-width: 0; }
.ov-m-h { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--edl-text-2); }
.ov-m-h i { color: var(--bs-primary); }
.ov-m-h small { margin-left: auto; font-size: .68rem; color: var(--edl-muted); white-space: nowrap; }
.ov-m-v { display: flex; align-items: baseline; gap: 5px; margin: 4px 0 2px; }
.ov-m-v b { font-size: 1.35rem; font-weight: 700; color: var(--edl-text); line-height: 1.2; }
.ov-m-v span { font-size: .75rem; color: var(--edl-muted); }
.ov-m-d { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; font-size: .74rem; font-weight: 600; }
.ov-m-d span { font-weight: 400; color: var(--edl-muted); }
.ov-m-d.up { color: var(--edl-success); }
.ov-m-d.down { color: var(--edl-danger); }
.ov-m-d.same { color: var(--edl-muted); }

/* ---------- ภาพรวม: งานที่ต้องทำ / ค้นหา ---------- */
.ov-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px dashed var(--edl-line-2); color: var(--edl-text); min-width: 0; }
.ov-row:last-child { border-bottom: 0; }
a.ov-row:hover, .ov-row[data-doc]:hover, .ov-row[data-cdoc]:hover { background: var(--edl-soft); color: var(--edl-text); cursor: pointer; }
.ov-row .t { flex: 1; min-width: 0; }
.ov-row .t b { display: block; font-weight: 500; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-row .t span { display: block; font-size: .75rem; color: var(--edl-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-tone { flex: none; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
    background: color-mix(in srgb, var(--c, var(--edl-muted)) 13%, var(--edl-surface)); color: var(--c, var(--edl-muted)); }
.ov-tone.red { --c: var(--edl-danger); } .ov-tone.amber { --c: var(--edl-warning); } .ov-tone.blue { --c: var(--bs-primary); } .ov-tone.green { --c: var(--edl-success); }
.ov-search { position: relative; }
.ov-search i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--edl-muted); font-size: 1.1rem; }
.ov-search input { padding-left: 46px; height: 52px; font-size: 1.05rem; border-radius: 14px; }

/* ---------- ภาพรวม: ปฏิทินงาน ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--edl-line-2); border-left: 1px solid var(--edl-line-2); }
.cal-grid > div { border-right: 1px solid var(--edl-line-2); border-bottom: 1px solid var(--edl-line-2); min-height: 104px; padding: 5px; min-width: 0; }
.cal-grid .cal-h { min-height: 0; padding: 6px; text-align: center; font-size: .75rem; font-weight: 600; color: var(--edl-muted); background: var(--edl-soft); }
.cal-day { cursor: pointer; transition: background .15s; }
.cal-day:hover { background: var(--edl-soft); }
.cal-day.out { background: color-mix(in srgb, var(--edl-soft) 55%, var(--edl-surface)); }
.cal-day.out .cal-n { opacity: .45; }
.cal-day.sel { box-shadow: inset 0 0 0 2px var(--bs-primary); }
.cal-n { font-size: .78rem; font-weight: 600; color: var(--edl-text-2); display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 999px; }
.cal-day.today .cal-n { background: var(--bs-primary); color: #fff; }
.cal-ev { display: flex; align-items: center; gap: 4px; font-size: .7rem; line-height: 1.25; padding: 2px 5px; margin-top: 3px; border-radius: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    background: color-mix(in srgb, var(--c) 13%, var(--edl-surface)); color: var(--edl-text); }
.cal-ev i { color: var(--c); flex: none; }
.cal-ev.late { box-shadow: inset 2px 0 0 var(--edl-danger); }
.cal-more { font-size: .68rem; color: var(--edl-muted); margin-top: 2px; padding-left: 5px; }
.cal-dots { display: none; gap: 3px; flex-wrap: wrap; margin-top: 4px; }
.cal-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); display: block; }
@media (max-width: 767.98px) {
    .cal-grid > div { min-height: 54px; padding: 3px; }
    .cal-ev, .cal-more { display: none; }
    .cal-dots { display: flex; }
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: inline-block; margin-right: 5px; }
/* ชิปที่มีสีประจำประเภท (ปฏิทิน / ความเคลื่อนไหว): ตอนเลือกใช้สีของประเภทนั้น · ไม่เลือก = จาง */
.lc-chipset .chip[style*="--c"].on { background: color-mix(in srgb, var(--c) 14%, var(--edl-surface)); color: var(--edl-text); border-color: color-mix(in srgb, var(--c) 45%, transparent); }
.lc-chipset .chip[style*="--c"]:not(.on) { opacity: .6; }
#acMod .chip[style*="--c"]:not(.on) { opacity: 1; }

/* ---------- Sales: ดูโครงการแบบหน้าต่าง (หน้ารายการ → ไอคอนลูกตา) ---------- */
.pj-peek-body { background: var(--edl-soft); }
.pj-peek-body .card { box-shadow: none; border: 1px solid var(--edl-line-2); }
.pj-peek-head .badge { font-weight: 500; }

/* ข้อความอัพเดทสำเร็จรูป (sales/_tpl) — มือถือเลื่อนแนวนอนแถวเดียว */
.pl-tpl { margin-bottom: 8px; gap: 6px; }
.pl-tpl .chip { font-size: .76rem; padding: 4px 10px; }
.pl-tpl .chip i { font-size: .7rem; opacity: .6; }
@media (max-width: 767.98px) {
    .pl-tpl { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
    .pl-tpl::-webkit-scrollbar { display: none; }
    .pl-tpl .chip { flex: none; }
}

/* รูปแนบการเข้าพบ */
.vs-photos { display: flex; flex-wrap: wrap; gap: 8px; }
.vs-ph, .vs-ph-add { position: relative; width: 84px; height: 84px; border-radius: var(--edl-radius-sm); overflow: hidden; flex: none; }
.vs-ph img { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--edl-soft); }
.vs-ph.is-new { box-shadow: 0 0 0 2px var(--bs-primary); }
.vs-ph-x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border: 0; border-radius: 50%; display: grid; place-items: center; padding: 0;
    background: rgba(0, 0, 0, .55); color: #fff; font-size: .7rem; }
.vs-ph-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 1.5px dashed var(--edl-line-3); color: var(--edl-muted);
    cursor: pointer; font-size: .72rem; margin: 0; }
.vs-ph-add i { font-size: 1.3rem; }
.vs-ph-add:hover { border-color: var(--bs-primary); color: var(--bs-primary); }
.vs-photos.view .vs-ph { width: 96px; height: 96px; cursor: zoom-in; }

/* งานที่ต้องทำ: รายการที่มีปุ่มจัดการท้ายแถว */
.td-row { display: flex; align-items: center; gap: 8px; }
.td-row .td-main { flex: 1; min-width: 0; display: flex; color: inherit; text-decoration: none; }
.td-row .td-main .t { flex: 1; min-width: 0; }
.td-row a.td-main:hover b { color: var(--bs-primary); }
.td-row .td-acts { flex: none; }
.td-row .td-acts .btn { padding: .2rem .5rem; font-size: .76rem; }
@media (max-width: 575.98px) {
    .td-row { flex-wrap: wrap; }
    .td-row .td-acts { width: 100%; justify-content: flex-end; }
}

/* ค้นหาทั้งระบบแบบหน้าต่างลอย (backend/searchpop) */
.edl-sp .modal-dialog { margin-top: 8vh; }
.edl-sp .modal-content { overflow: hidden; }
.edl-sp-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--edl-line-2); }
.edl-sp-head > i { font-size: 1.15rem; color: var(--edl-muted); }
.edl-sp-head .form-control { border: 0; box-shadow: none !important; padding: 6px 0; font-size: 1.02rem; background: transparent; }
.edl-sp-body { max-height: min(60vh, 560px); overflow-y: auto; padding: 6px 8px 10px; }
.edl-sp-group { display: flex; align-items: center; padding: 10px 10px 4px; font-size: .72rem; font-weight: 700; color: var(--edl-muted); text-transform: uppercase; letter-spacing: .03em; }
.edl-sp-group a { font-weight: 500; text-transform: none; letter-spacing: 0; }
.edl-sp-item { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--edl-radius-sm); color: var(--edl-text); text-decoration: none; }
.edl-sp-item.on { background: var(--edl-primary-soft); color: var(--edl-text); }
.edl-sp-item .ic { width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center; background: color-mix(in srgb, var(--c, var(--bs-primary)) 12%, var(--edl-surface));
    color: var(--c, var(--bs-primary)); overflow: hidden; }
.edl-sp-item .ic.has-img img { width: 100%; height: 100%; object-fit: cover; }
.edl-sp-item .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.edl-sp-item .t b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edl-sp-item .t span { font-size: .78rem; color: var(--edl-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edl-sp-item .go { opacity: 0; color: var(--bs-primary); }
.edl-sp-item.on .go { opacity: 1; }
.edl-sp-empty { padding: 26px 12px; text-align: center; color: var(--edl-muted); font-size: .88rem; }
.edl-sp-empty i { display: block; font-size: 1.6rem; margin-bottom: 6px; opacity: .6; }
.edl-sp-foot { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--edl-line-2); font-size: .74rem; color: var(--edl-muted); }
.edl-sp-foot kbd { background: var(--edl-soft); color: var(--edl-text-2); border: 1px solid var(--edl-line); border-radius: 5px; padding: 0 5px; font-size: .7rem; margin: 0 1px; }
@media (max-width: 575.98px) { .edl-sp .modal-dialog { margin-top: 0; } .edl-sp-body { max-height: none; } }

/* ปุ่มลัดขยายกำหนดคืน (Viefe) — วันที่ในปุ่มอ่านออกทั้งตอนเลือก / ไม่เลือก */
.ex-q-date { opacity: .7; font-size: .72rem; }

/* โครงการที่อาจซ้ำ — เตือนในฟอร์ม + หน้ารวมโครงการ */
.pj-dup { margin-top: 6px; padding: 8px 10px; border-radius: var(--edl-radius-sm); background: var(--edl-warning-soft); color: var(--edl-text-2); font-size: .8rem; }
.pj-dup.is-exact { background: var(--edl-danger-soft); }
.pj-dup .pj-dup-row { padding: 2px 0; }
.dp-group { border: 1px solid var(--edl-line); border-radius: var(--edl-radius-sm); padding: 10px 12px; margin-bottom: 12px; }
.dp-group .table { margin-bottom: 6px; }

/* นัดเข้าพบล่วงหน้า (หน้าเข้าพบ Owner) */
.vp-row { display: flex; align-items: center; gap: 10px; }
.vp-row .vp-date { flex: none; width: 92px; display: flex; flex-direction: column; font-size: .8rem; }
.vp-row .vp-date span { font-size: .72rem; color: var(--edl-muted); }
.vp-row .t { flex: 1; min-width: 0; }
.vp-row.is-late .vp-date b { color: var(--edl-danger); }
@media (max-width: 575.98px) { .vp-row { flex-wrap: wrap; } .vp-row .btn-group { width: 100%; justify-content: flex-end; } }
.vp-row .t .badge { display: inline-block; width: auto; font-weight: 500; vertical-align: 1px; }

/* เช็กลิสต์ตั้งค่าระบบให้พร้อมใช้ (แดชบอร์ด) */
.setup-card { border-left: 3px solid var(--bs-primary); }
.setup-bar { height: 6px; border-radius: 999px; background: var(--edl-line-2); overflow: hidden; }
.setup-bar span { display: block; height: 100%; background: var(--edl-success); border-radius: 999px; transition: width .4s ease; }
.setup-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--edl-line-2); }
.setup-row:last-child { border-bottom: 0; }
.setup-row .ck { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--edl-primary-soft); color: var(--bs-primary); }
.setup-row.is-done .ck { background: var(--edl-success-soft); color: var(--edl-success); }
.setup-row .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.setup-row .t span { font-size: .8rem; color: var(--edl-muted); }
.setup-row.is-done .t b { color: var(--edl-muted); text-decoration: line-through; text-decoration-color: var(--edl-line-3); }

/* บอร์ดสถานะโครงการ (Kanban) */
.kb-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; scroll-snap-type: x proximity; }
.kb-col { flex: 0 0 272px; background: var(--edl-soft); border-radius: var(--edl-radius); padding: 10px; scroll-snap-align: start; max-height: calc(100vh - 230px); display: flex; flex-direction: column; }
.kb-col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; font-size: .86rem; }
.kb-col-head .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.kb-col-head .kb-n { margin-left: auto; font-size: .74rem; font-weight: 700; color: var(--edl-muted); background: var(--edl-surface); border-radius: 999px; padding: 1px 9px; }
.kb-list { flex: 1; min-height: 70px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.kb-card { background: var(--edl-surface); border-radius: var(--edl-radius-sm); padding: 10px 11px; box-shadow: var(--edl-shadow); border-left: 3px solid var(--c, var(--bs-primary)); cursor: grab; }
.kb-card:hover { box-shadow: var(--edl-shadow-hover); }
.kb-card.is-stale { border-left-color: var(--edl-danger); }
.kb-card.is-locked { cursor: pointer; opacity: .85; }
.kb-card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.kb-move { margin-left: auto; border: 0; background: transparent; color: var(--edl-muted); padding: 0 4px; border-radius: 6px; }
.kb-move:hover { background: var(--edl-primary-soft); color: var(--bs-primary); }
.kb-lock { margin-left: auto; color: var(--edl-muted-2); font-size: .8rem; }
.kb-name { font-weight: 600; color: var(--edl-text); line-height: 1.35; }
.kb-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: .76rem; color: var(--edl-text-2); min-width: 0; }
.kb-idle { white-space: nowrap; color: var(--edl-muted); }
.kb-empty { border: 1.5px dashed var(--edl-line-3); border-radius: var(--edl-radius-sm); padding: 14px 8px; text-align: center; font-size: .76rem; color: var(--edl-muted); }
.kb-list:has(.kb-card) .kb-empty { display: none; }
.kb-ghost { opacity: .45; outline: 2px dashed var(--bs-primary); }
.kb-close { background: transparent; padding: 0; gap: 10px; }
.kb-drop { background: color-mix(in srgb, var(--c) 8%, var(--edl-surface)); border: 1.5px dashed color-mix(in srgb, var(--c) 45%, var(--edl-surface)); border-radius: var(--edl-radius); padding: 10px; color: var(--c); }
.kb-drop .kb-col-head { color: var(--c); }
.kb-drop .kb-empty { border: 0; color: inherit; opacity: .8; }
.kb-drop .kb-card { display: none; }
@media (max-width: 575.98px) { .kb-col { flex-basis: 84vw; } }
.kb-dragging { opacity: .95 !important; transform: rotate(2deg); box-shadow: var(--edl-shadow-hover) !important; }
.kb-card { user-select: none; -webkit-user-select: none; }

/* ตรวจรายการ Viefe รอตรวจสอบ (ทีละใบ) */
.rv-card h4 { font-size: 1.3rem; }
.rv-items { display: flex; flex-direction: column; gap: 6px; }
.rv-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--edl-line); border-radius: var(--edl-radius-sm); cursor: pointer; margin: 0; }
.rv-item:has(.rv-chk:checked) { border-color: var(--edl-primary-line); background: var(--edl-primary-tint); }
.rv-acts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.rv-acts .btn { padding: 14px 8px; font-weight: 600; }
.rv-acts kbd { background: rgba(255, 255, 255, .25); color: inherit; border: 0; font-size: .72rem; padding: 1px 6px; }
@media (max-width: 575.98px) { .rv-acts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ตรวจนับสต็อก */
.ct-card { border: 1px solid var(--edl-primary-line); background: var(--edl-primary-tint); border-radius: var(--edl-radius-sm); padding: 12px; }
.ct-row { cursor: pointer; }
.ct-bar { position: sticky; bottom: 10px; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--edl-radius); background: var(--edl-surface); box-shadow: var(--edl-shadow-hover); z-index: 5; }

/* ---------- ทัวร์แนะนำการใช้งาน (tour.js) ---------- */
.tour-box { position: fixed; inset: 0; z-index: 2100; }
.tour-block { position: absolute; inset: 0; }
.tour-spot { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(10, 37, 64, .55), 0 0 0 3px var(--bs-primary); pointer-events: none; transition: top .25s, left .25s, width .25s, height .25s; }
.tour-box.is-center .tour-spot { box-shadow: 0 0 0 9999px rgba(10, 37, 64, .55); }
.tour-pop { position: fixed; width: min(340px, calc(100vw - 24px)); background: var(--edl-surface); color: var(--edl-text); border-radius: 14px; box-shadow: 0 18px 50px rgba(10, 37, 64, .3); padding: 16px 16px 12px; outline: 0; transition: top .25s, left .25s; }
.tour-box.is-center .tour-pop { width: min(400px, calc(100vw - 24px)); }
.tour-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tour-head b { font-size: 1rem; font-weight: 600; flex: 1; min-width: 0; }
.tour-ico { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--edl-primary-soft); color: var(--bs-primary); font-size: 1.05rem; }
.tour-x { flex: none; border: 0; background: none; color: var(--edl-muted); width: 30px; height: 30px; border-radius: 8px; }
.tour-x:hover { background: var(--edl-soft); color: var(--edl-text); }
.tour-text { font-size: .9rem; color: var(--edl-text-2); line-height: 1.6; }
.tour-text kbd, .tour-keys kbd { background: var(--edl-soft); color: var(--edl-text-2); border: 1px solid var(--edl-line); border-radius: 5px; padding: 0 5px; font-size: .72rem; }
.tour-keys { margin-top: 8px; font-size: .78rem; color: var(--edl-muted); }
.tour-foot { display: flex; align-items: center; gap: 6px; margin-top: 14px; }
.tour-dots { display: flex; gap: 4px; flex-wrap: wrap; margin-right: auto; max-width: 45%; }
.tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--edl-line-3); }
.tour-dots i.done { background: color-mix(in srgb, var(--bs-primary) 45%, transparent); }
.tour-dots i.on { background: var(--bs-primary); width: 16px; border-radius: 4px; }
.tour-n { font-size: .75rem; color: var(--edl-muted); margin-right: 4px; white-space: nowrap; }
html[data-bs-theme="dark"] .tour-spot { box-shadow: 0 0 0 9999px rgba(0, 0, 0, .62), 0 0 0 3px var(--bs-primary); }
html[data-bs-theme="dark"] .tour-box.is-center .tour-spot { box-shadow: 0 0 0 9999px rgba(0, 0, 0, .62); }
html.tour-on .edl-customizer-btn { visibility: hidden; }
@media (max-width: 575.98px) { .tour-n { display: none; } }
.ct-left .t .badge, .ct-pick .t .badge { display: inline-block; width: auto; vertical-align: middle; line-height: 1.3; }
@media (max-width: 1299.98px) { .ct-page .edl-customizer-btn { display: none !important; } }   /* หน้าตรวจนับ / ตรวจรายการ Viefe: ปุ่มลอยบังปุ่มล่างขวา (ตั้งค่าหน้าตายังเปิดได้จากเมนูโปรไฟล์) */

/* ---------- ปฏิทินงาน: ลงนัด (+) / ลากเลื่อนวัน ---------- */
.cal-day { position: relative; }
.cal-add { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: 0; border-radius: 7px; display: grid; place-items: center; padding: 0;
    font-size: .8rem; background: var(--edl-primary-soft); color: var(--bs-primary); opacity: 0; transition: opacity .15s; }
.cal-day:hover .cal-add, .cal-day.sel .cal-add, .cal-add:focus-visible { opacity: 1; }
@media (hover: none) { .cal-day.sel .cal-add { opacity: 1; } }
.cal-ev.can-move { cursor: grab; user-select: none; -webkit-user-select: none; }
.cal-ev.can-move:hover { box-shadow: inset 0 0 0 1px var(--c); }
.cal-ghost { opacity: .4; }
.cal-dragging { opacity: .95 !important; box-shadow: var(--edl-shadow-hover); cursor: grabbing; }
.cal-day-row { display: flex; align-items: center; gap: 6px; }
.cal-day-row > .ov-row { flex: 1; min-width: 0; }
.cal-day-row .cal-mv { flex: none; }

/* ---------- ช่องชื่อ Owner / DN / ผรม. — รายชื่อที่เคยใช้ (app.js data-party) ---------- */
.pty-ac { position: fixed; z-index: 2000; max-height: 300px; overflow: auto; background: var(--edl-surface); border: 1px solid var(--edl-line); border-radius: 12px;
    box-shadow: 0 14px 36px rgba(10, 37, 64, .16); padding: 4px; }
.pty-h { font-size: .7rem; color: var(--edl-muted); padding: 4px 8px 2px; }
.pty-it { display: flex; align-items: baseline; gap: 8px; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.pty-it b { font-weight: 500; font-size: .88rem; color: var(--edl-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pty-it span { margin-left: auto; font-size: .72rem; color: var(--edl-muted); white-space: nowrap; flex: none; }
.pty-it:hover, .pty-it.on { background: var(--edl-primary-soft); }
a.pty-link { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--bs-primary) 40%, transparent); text-underline-offset: 3px; }
a.pty-link:hover { color: var(--bs-primary); text-decoration-color: var(--bs-primary); }

/* ---------- ติดดาวโครงการ ---------- */
.pj-star-btn { border: 0; background: none; padding: 0 4px 0 0; color: var(--edl-muted-2); font-size: .95rem; line-height: 1; vertical-align: -1px; cursor: pointer; }
.pj-star-btn:hover { color: var(--edl-warning); }
.pj-star-btn.on { color: #f5a524; }
.pj-star-btn.busy { opacity: .5; pointer-events: none; }
.pj-star-btn.is-btn { padding: .375rem .75rem; font-size: inherit; color: var(--edl-text-2); }
.pj-star-btn.is-btn.on { color: #d48806; }
.kb-name .pj-star-btn { font-size: .85rem; }
.edl-my-noti .dropdown-item.is-new { background: color-mix(in srgb, var(--edl-warning) 9%, var(--edl-surface)); }

/* ---------- หน้ารวมบริษัท ---------- */
.co-search { position: relative; min-width: 240px; }
.co-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--edl-muted); }
.co-search input { padding-left: 34px; }
.co-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.co-tile { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 8px; padding: 10px 12px; border: 1px solid var(--edl-line); border-radius: 12px; transition: border-color .15s, background .15s; min-width: 0; }
.co-tile:hover { border-color: var(--bs-primary); background: var(--edl-primary-soft); }
.co-tile b { font-weight: 500; font-size: .9rem; min-width: 0; }
.co-tile span { grid-column: 1; font-size: .72rem; color: var(--edl-muted); min-width: 0; }
.co-tile em { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-style: normal; font-weight: 600; color: var(--bs-primary); }
.co-pj .t b { white-space: normal; }
.co-pj.is-closed { opacity: .72; }
.co-role { font-style: normal; font-size: .68rem; padding: 0 6px; border-radius: 999px; background: var(--edl-soft-3); color: var(--edl-text-2); margin-left: 4px; }
@media (max-width: 575.98px) { .co-search { min-width: 0; width: 100%; } }
.co-log .t span .pj-src { display: inline-block; vertical-align: 1px; }
.co-log .t span { white-space: normal; }

/* ---------- การใช้งานของทีม ---------- */
.tu-table td { vertical-align: middle; }
.tu-table tr.tu-none td:first-child { box-shadow: inset 3px 0 0 var(--edl-danger); }
.tu-table tr.tu-idle td:first-child { box-shadow: inset 3px 0 0 var(--edl-warning); }
.tu-dots { display: inline-flex; gap: 3px; }
.tu-dots i { font-style: normal; font-size: .62rem; width: 22px; height: 20px; border-radius: 6px; display: grid; place-items: center; background: var(--edl-soft-3); color: var(--edl-muted); }
.tu-dots i.on { background: var(--edl-success); color: #fff; }
.tu-bar { display: block; width: 130px; height: 8px; border-radius: 99px; background: var(--edl-soft-3); overflow: hidden; }
.tu-bar span { display: block; height: 100%; background: var(--edl-success); }

/* ---------- คู่มือการใช้งาน: ศูนย์คู่มือ + หัวทัวร์ ---------- */
.tour-kick { font-size: .72rem; color: var(--edl-muted); margin-bottom: 6px; }
.tour-bar { display: block; width: 90px; height: 6px; border-radius: 99px; background: var(--edl-line-3); overflow: hidden; }
.tour-bar span { display: block; height: 100%; background: var(--bs-primary); }
#guideList { display: grid; gap: 10px; }
.gd-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--edl-line); border-radius: 14px; }
.gd-card.is-here { border-color: color-mix(in srgb, var(--bs-primary) 45%, var(--edl-line)); background: var(--edl-primary-soft); }
.gd-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--edl-primary-soft); color: var(--bs-primary); font-size: 1.15rem; }
.gd-card b { display: block; font-weight: 600; font-size: .95rem; }
.gd-card span { display: block; font-size: .8rem; color: var(--edl-text-2); }
.gd-card em { display: block; font-style: normal; font-size: .72rem; color: var(--edl-muted); margin-top: 2px; }
.gd-acts { flex: none; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 575.98px) {
    .gd-card { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; row-gap: 10px; }
    .gd-acts { grid-column: 1 / -1; }
    .gd-acts .btn { flex: 1; }
}

/* ---------- ประวัติการส่ง Telegram ---------- */
.tg-bubble { background: color-mix(in srgb, var(--edl-info) 8%, var(--edl-surface)); border: 1px solid color-mix(in srgb, var(--edl-info) 22%, var(--edl-line)); border-radius: 14px 14px 14px 4px;
    padding: 12px 14px; font-size: .9rem; line-height: 1.6; white-space: normal; word-break: break-word; }
.tg-bubble code, .tg-bubble pre { font-size: .82rem; }
.tg-items { display: flex; flex-wrap: wrap; gap: 6px; }
.tg-item { display: inline-flex; align-items: center; padding: 4px 10px; border: 1px solid var(--edl-line); border-radius: 999px; font-size: .8rem; }
a.tg-item:hover { border-color: var(--bs-primary); color: var(--bs-primary) !important; }
.tg-sends { font-size: .78rem; color: var(--edl-text-2); }
.tg-sends summary { cursor: pointer; color: var(--edl-muted); }
.tg-sends ul { list-style: none; padding: 4px 0 0; margin: 0; }
.tg-sends li { padding: 2px 0; }

/* ---------- แผ่นตัวอย่าง: ยอดแยกไซส์ ---------- */
.sz-tag { display: inline-block; font-size: .72rem; font-weight: 600; line-height: 1.35; padding: 0 6px; border-radius: 6px; background: var(--edl-primary-soft); color: var(--bs-primary); white-space: nowrap; }
.sz-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 3px; margin-top: 3px; }
.sz-chip { font-size: .7rem; line-height: 1.4; padding: 0 6px; border-radius: 6px; white-space: nowrap; color: var(--c, var(--edl-text-2));
    background: color-mix(in srgb, var(--c, var(--edl-muted)) 10%, var(--edl-surface)); border: 1px solid color-mix(in srgb, var(--c, var(--edl-muted)) 22%, transparent); }
.sz-chip b { font-weight: 600; }
.aj-sizes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.aj-sz { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 4px; border-radius: 10px; border: 1px solid var(--edl-line); background: var(--edl-surface); cursor: pointer; color: var(--edl-text); }
.aj-sz b { font-size: .8rem; }
.aj-sz span { font-size: .78rem; color: var(--c, var(--edl-muted)); font-weight: 600; }
.aj-sz.new span { font-weight: 400; color: var(--edl-muted); }
.aj-sz.on { border-color: var(--bs-primary); box-shadow: 0 0 0 2px var(--edl-primary-soft); }
.si-mode { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--edl-line); border-radius: 12px; cursor: pointer; height: 100%; }
.si-mode input { margin-top: 4px; }
.si-mode .ic { font-size: 1.3rem; color: var(--bs-primary); }
.si-mode b { display: block; }
.si-mode small { display: block; color: var(--edl-muted); }
.si-mode:has(input:checked) { border-color: var(--bs-primary); background: var(--edl-primary-tint); }
.si-mode.disabled { opacity: .55; cursor: not-allowed; }
.si-sz { display: inline-block; font-size: .75rem; margin: 1px 6px 1px 0; color: var(--edl-muted); white-space: nowrap; }
.si-sz.on { color: var(--edl-text); }
.si-sz.on b:last-child { color: var(--bs-primary); }

/* ---------- ปรับยอดหลายรายการ (ตารางแยกไซส์) ---------- */
.ba-wrap { max-height: 70vh; overflow: auto; }
.ba-table thead th { position: sticky; top: 0; z-index: 2; background: var(--edl-surface); white-space: nowrap; }
.ba-table td, .ba-table th { padding: 8px 6px; }
.ba-c { min-width: 90px; text-align: center; vertical-align: top; }
.ba-now { font-size: .72rem; color: var(--edl-muted); line-height: 1.3; }
.ba-now b { color: var(--edl-text-2); }
.ba-c.none .ba-now { color: var(--edl-muted-2, var(--edl-muted)); font-style: italic; }
.ba-in { text-align: center; max-width: 82px; margin: 3px auto; }
.ba-res { font-size: .72rem; min-height: 1.1em; line-height: 1.3; }
.ba-table tr.ba-on > td { background: var(--edl-primary-tint); }
.ba-fill { border: 0; background: none; color: var(--edl-muted); padding: 0 2px; cursor: pointer; }
.ba-fill:hover { color: var(--bs-primary); }
.ba-pulse { animation: ba-pulse 1.3s ease-in-out 4; }
@keyframes ba-pulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--bs-primary) 28%, transparent); } }

/* แคตตาล็อก: แยกตามแบรนด์ (แถบสรุป · ป้ายในตาราง · เลือกในฟอร์ม) — สีแบรนด์ส่งมาเป็น --c */
.cb-card .card-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
@media (max-width: 575.98px) { .cb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }
.cb-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 12px; border-radius: var(--edl-radius-sm);
    border: 1px solid var(--edl-line); background: var(--edl-surface); color: var(--edl-text); border-left: 4px solid var(--c); transition: border-color .15s, background .15s; min-width: 0; }
.cb-tile:hover { border-color: var(--c); }
.cb-tile.on { background: color-mix(in srgb, var(--c) 10%, var(--edl-surface)); border-color: var(--c); box-shadow: 0 0 0 1px var(--c) inset; }
.cb-tile.is-none { border-style: dashed; border-left-style: solid; }
.cb-name { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: .88rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.cb-num { font-size: 1.35rem; font-weight: 700; line-height: 1.2; color: var(--c); }
.cb-num small { font-size: .72rem; font-weight: 500; color: var(--edl-muted); }
.cb-sub { font-size: .74rem; color: var(--edl-muted); }
.cb-badge { display: inline-block; font-size: .68rem; font-weight: 600; letter-spacing: .02em; padding: 1px 7px; border-radius: 999px; margin: 0 6px 2px 0; vertical-align: 1px;
    background: color-mix(in srgb, var(--c) 13%, var(--edl-surface)); color: var(--c); }
.cb-badge.is-none { --c: var(--edl-muted); font-weight: 500; }
.cb-pick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cb-pick .form-control { width: auto; flex: 1 1 150px; min-width: 130px; }
.cb-chip { border: 1px solid color-mix(in srgb, var(--c) 40%, var(--edl-line)); background: var(--edl-surface); color: var(--c); border-radius: 999px; padding: 3px 12px; font-size: .8rem; font-weight: 600; }
.cb-chip:hover { background: color-mix(in srgb, var(--c) 8%, var(--edl-surface)); }
.cb-chip.on { background: var(--c); border-color: var(--c); color: #fff; }

/* เข้าพบลูกค้า: รายงานแยกแบรนด์ — กลุ่ม Designer & Owner / Contractor */
.vr-group { border: 1px solid var(--edl-line); border-radius: var(--edl-radius-sm); overflow: hidden; }
.vr-group-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--edl-soft); font-weight: 600; font-size: .88rem; }
.vr-group-head b { font-size: .78rem; font-weight: 600; color: var(--bs-primary); background: color-mix(in srgb, var(--bs-primary) 10%, transparent); border-radius: 999px; padding: 1px 8px; }
.vr-list-box { max-height: 330px; overflow-y: auto; }
.vr-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--edl-line-2); font-size: .86rem; }
.vr-row:first-child { border-top: 0; }

/* โครงการ: ของ EDL / PP (ชิปกรองบนสุด · ป้ายหน้าชื่อ) · วันที่อัพเดทในแท็บรายสัปดาห์ */
.pj-own { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; }
.pj-own .chip b { font-weight: 600; margin-left: 2px; opacity: .75; }
.pj-own-tag { display: inline-block; font-size: .66rem; font-weight: 700; letter-spacing: .03em; padding: 1px 6px; border-radius: 6px; margin-right: 6px; vertical-align: 1px;
    background: color-mix(in srgb, var(--bs-primary) 12%, var(--edl-surface)); color: var(--bs-primary); }
.pj-own-tag[data-b="PP"] { background: color-mix(in srgb, #0e9f99 14%, var(--edl-surface)); color: #0e9f99; }
.pj-week-days { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.pj-week-days span { font-size: .72rem; padding: 0 7px; border-radius: 999px; background: var(--edl-soft-3); color: var(--edl-text); }

/* นำเข้า Viefe: ตัวเลือกข้ามรายการเดิม */
.vi-onlynew { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border: 1px solid var(--edl-line); border-radius: var(--edl-radius-sm); background: var(--edl-soft); cursor: pointer; }
.vi-onlynew:has(input:checked) { border-color: var(--bs-primary); background: color-mix(in srgb, var(--bs-primary) 7%, var(--edl-surface)); }
.wi-create { padding: 10px 14px; border: 1px solid var(--edl-line); border-radius: var(--edl-radius-sm); background: var(--edl-soft); }
.wi-create:has(input:checked) { border-color: var(--bs-primary); background: color-mix(in srgb, var(--bs-primary) 7%, var(--edl-surface)); }

/* คลัง: ขนาด (2M / 3M) · แยกรหัสคู่ */
.wh-size { display: inline-block; font-size: .7rem; font-weight: 700; padding: 0 6px; border-radius: 6px; margin-right: 6px; vertical-align: 1px;
    background: color-mix(in srgb, var(--edl-info) 14%, var(--edl-surface)); color: var(--edl-info); }
.sp-item { border: 1px solid var(--edl-line); border-radius: var(--edl-radius-sm); margin-bottom: 10px; overflow: hidden; }
.sp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; background: var(--edl-soft); }
.sp-item table { margin: 0; }
.sp-item td, .sp-item th { padding-left: 12px; }
