/* ============================================================
   EDL Stock — หน้าเซลล์ (พอร์ทัลเซลล์) บนธีม MatDash
   โหลดต่อจาก styles.css (ธีม) + edl.css (ส่วนกลางของระบบ · ตัวแปรสีทั้งหมดอยู่ที่นั่น)
   ============================================================ */
:root {
    --sp-text: var(--edl-text);
    --sp-text-2: var(--edl-text-2);
    --sp-muted: var(--edl-muted);
    --sp-line: var(--edl-line);
    --sp-line-2: var(--edl-line-2);
    --sp-soft: var(--edl-soft);
    --sp-primary: var(--bs-primary);
    --sp-primary-2: var(--edl-primary-2);
    --sp-primary-soft: var(--edl-primary-soft);
    --sp-primary-line: var(--edl-primary-line);
    --sp-dark: var(--edl-dark);
    --sp-green: var(--edl-success);
    --sp-red: var(--edl-danger);
    --sp-amber: var(--edl-warning);
    /* ชื่อเดิมที่บางหน้ายังอ้างถึง */
    --walnut: var(--sp-primary);
    --muted: var(--sp-muted);
}

body.edl-sale { font-size: .9rem; }
.edl-sale .body-wrapper > .container-fluid { max-width: 1440px; }

@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes cfFade { from { opacity: 0; filter: blur(3px); } to { opacity: 1; filter: blur(0); } }
@keyframes tabPop { 0% { transform: translateY(0) scale(1); } 55% { transform: translateY(-7px) scale(1.14); } 100% { transform: translateY(-4px) scale(1); } }
.rise { animation: riseIn .22s ease-out both; }

/* ---------- โครงหน้า ---------- */
.sp-content { display: flex; flex-direction: column; gap: 16px; }
.flex-none { flex: none; }

.sp-cart-pill {
    flex: none; display: flex; align-items: center; gap: 7px; background: var(--edl-surface); color: var(--sp-text); border: 1px solid var(--sp-line);
    border-radius: 8px; padding: 8px 14px; font-size: .86rem; font-weight: 500; cursor: pointer; white-space: nowrap; transition: border-color .16s, color .16s;
}
.sp-cart-pill:hover { border-color: var(--sp-primary-line); color: var(--sp-primary); }
.sp-cart-pill .bd { background: var(--sp-red); color: #fff; border-radius: 999px; min-width: 20px; padding: 0 6px; font-size: .74rem; font-weight: 700; line-height: 20px; text-align: center; }
.sp-cart-pill .bd:empty { display: none; }
.sp-mechip { flex: none; display: flex; align-items: center; gap: 8px; border-radius: 999px; padding: 3px; color: var(--sp-text); font-size: .84rem; font-weight: 600; }
.sp-mechip:hover { color: var(--sp-primary); }
.sp-mechip .sp-wide-only { padding-right: 8px; }

/* แท็บล่าง (จอแคบ — ตอนเมนูซ้ายซ่อน) */
.sp-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: color-mix(in srgb, var(--edl-surface) 96%, transparent); backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--sp-line-2); padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -6px 20px rgba(41, 52, 61, .05);
}
.sp-tabbar .sp-wrap { display: flex; height: 68px; align-items: stretch; position: relative; max-width: 640px; margin: 0 auto; }
.sp-tab { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; color: var(--sp-muted); font-size: .74rem; cursor: pointer; padding: 4px 0 0; }
.sp-tab:hover { color: var(--sp-text); }
.sp-tab .ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; transition: background .2s, color .2s, transform .2s; }
.sp-tab .ic i { font-size: 1.15rem; }
.sp-tab.on { color: var(--sp-text); font-weight: 600; }
.sp-tab.on .ic { background: var(--tc, var(--sp-primary)); color: #fff; box-shadow: 0 8px 16px color-mix(in srgb, var(--tc, var(--bs-primary)) 35%, transparent); animation: tabPop .34s cubic-bezier(.16, 1, .3, 1) forwards; }
.sp-tab .bd { position: absolute; top: 4px; left: 50%; margin-left: 8px; min-width: 18px; text-align: center; background: var(--sp-red); color: #fff; border-radius: 999px; padding: 0 5px; font-size: 10.5px; font-weight: 700; line-height: 18px; }
.sp-tab .bd:empty { display: none; }
.sp-tab.scan .ic { width: 50px; height: 50px; border-radius: 15px; background: var(--sp-primary); color: #fff; margin-top: -22px; box-shadow: 0 10px 22px rgba(var(--bs-primary-rgb), .4); border: 4px solid var(--edl-surface); }
.sp-tab.scan .ic i { font-size: 1.3rem; }
.sp-tab.scan.on .ic { animation: none; }

/* แถบตะกร้า */
.sp-cartbar { position: fixed; left: 0; right: 0; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 35; display: flex; justify-content: center; padding: 0 16px; pointer-events: none; }
.sp-cartbar .in { width: 100%; box-sizing: border-box; max-width: 588px; display: flex; align-items: center; gap: 11px; background: var(--sp-dark); border-radius: 14px; padding: 12px 14px; pointer-events: auto; box-shadow: 0 12px 28px rgba(10, 37, 64, .28); animation: riseIn .2s ease-out; }
.sp-cartbar .tx { flex: 1; min-width: 0; color: #fff; font-size: .86rem; line-height: 1.45; }
.sp-cartbar .tx span { color: rgba(255, 255, 255, .65); }
.sp-cartbar .thumbs { display: flex; flex: none; }
.sp-cartbar .thumbs > * { margin-left: -8px; border: 2px solid var(--sp-dark); }
.sp-cartbar[hidden] { display: none; }

@media (min-width: 1300px) {
    .sp-tabbar { display: none; }
    .sp-cartbar { bottom: 20px; }
    body[data-sidebartype="full"] .sp-cartbar { left: 320px; }
    body[data-sidebartype="mini-sidebar"] .sp-cartbar { left: 80px; }
    .sp-narrow-only { display: none !important; }
    .edl-sale .body-wrapper { margin-bottom: 90px; }
}
@media (max-width: 1299.98px) {
    .sp-wide-only { display: none !important; }
    /* เว้นที่ให้แถบตะกร้า (ไม่มีแท็บล่างแล้ว — เมนูเดียวกับหลังบ้าน) */
    .edl-sale .body-wrapper { margin-bottom: calc(90px + env(safe-area-inset-bottom)); }
}

/* ---------- ปุ่ม ---------- */
.sp-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 8px; padding: 11px 18px;
    font-size: .9rem; font-weight: 600; border: 1px solid transparent; cursor: pointer; transition: transform .16s, box-shadow .16s, background .16s, border-color .16s;
    white-space: nowrap; line-height: 1.2; text-decoration: none; user-select: none;
}
.sp-btn:active { transform: scale(.98); }
.sp-btn.block { display: flex; width: 100%; }
.sp-btn.walnut { background: var(--sp-primary); color: #fff; }
.sp-btn.walnut:hover { background: var(--sp-primary-2); color: #fff; box-shadow: 0 10px 20px -6px rgba(var(--bs-primary-rgb), .5); }
.sp-btn.ink { background: var(--sp-dark); color: #fff; }
.sp-btn.ink:hover { background: #183b5e; color: #fff; }
.sp-btn.oak { background: var(--sp-primary-soft); color: var(--sp-primary); }
.sp-btn.oak:hover { background: var(--sp-primary); color: #fff; }
.sp-btn.line { border-color: var(--sp-line); color: var(--sp-text-2); background: var(--edl-surface); }
.sp-btn.line:hover { border-color: var(--sp-primary-line); color: var(--sp-primary); }
.sp-btn.danger { color: var(--sp-red); background: var(--edl-surface); border-color: var(--edl-danger-line); }
.sp-btn.danger:hover { background: var(--edl-danger-soft); }
.sp-btn.sm { padding: 8px 13px; font-size: .84rem; }
.sp-btn[disabled], .sp-btn.disabled { opacity: .55; pointer-events: none; }
.sp-btn.is-loading { pointer-events: none; opacity: .75; }
.sp-spin { display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .65s linear infinite; margin-right: .35em; vertical-align: -2px; }

.sp-icon {
    display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--sp-line);
    color: var(--sp-text-2); background: var(--edl-surface); cursor: pointer; position: relative; flex: none; transition: border-color .16s, color .16s;
}
.sp-icon:hover { border-color: var(--sp-primary-line); color: var(--sp-primary); }
.sp-icon i { font-size: 1.1rem; }
.sp-icon .sp-dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 999px; padding: 0 5px; background: var(--sp-red); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 14px; text-align: center; border: 2px solid var(--edl-surface); }
.sp-icon .sp-dot:empty { display: none; }

/* ---------- ช่องกรอก ---------- */
.sp-field { display: block; }
.sp-field > span.lb { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 600; color: var(--sp-text); margin-bottom: 6px; }
.sp-input, .sp-field input, .sp-field select, .sp-field textarea {
    width: 100%; box-sizing: border-box; border: 1px solid var(--sp-line); border-radius: 8px; padding: 11px 14px;
    font-size: 16px; outline: none; background: var(--edl-surface); color: var(--sp-text); transition: border-color .16s, box-shadow .16s;
}
.sp-input::placeholder, .sp-field input::placeholder, .sp-field textarea::placeholder { color: var(--edl-muted-2); }
.sp-input:focus, .sp-field input:focus, .sp-field select:focus, .sp-field textarea:focus { border-color: var(--sp-primary); box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), .12); }
.sp-field .locked { border: 1px solid var(--sp-line-2); border-radius: 8px; background: var(--sp-soft); padding: 11px 14px; font-size: .9rem; color: var(--sp-muted); display: flex; justify-content: space-between; align-items: center; }
.sp-search { position: relative; flex: 1; min-width: 0; }
.sp-search i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--sp-text); }
.sp-search input { padding-left: 40px; }

/* ---------- ชิป ---------- */
.sp-chips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.sp-chips::-webkit-scrollbar { display: none; }
.sp-chips.wrap { flex-wrap: wrap; overflow: visible; }
.sp-chip {
    flex: none; white-space: nowrap; border-radius: 999px; padding: 7px 14px; font-size: .84rem; font-weight: 500; cursor: pointer;
    border: 1px solid var(--sp-line); background: var(--edl-surface); color: var(--sp-text-2); user-select: none; transition: background .16s, color .16s, border-color .16s;
}
.sp-chip:hover { border-color: var(--sp-primary-line); color: var(--sp-primary); }
.sp-chip.on { background: var(--sp-primary); border-color: var(--sp-primary); color: #fff; }
.sp-chip .n { opacity: .7; margin-left: 4px; font-size: .74rem; }

/* ---------- การ์ด ---------- */
.sp-card { border: 0; border-radius: 12px; background: var(--edl-surface); padding: 16px; box-shadow: var(--edl-shadow); }
.sp-card.flush { padding: 0; overflow: hidden; }
.sp-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--sp-line-2); }
.sp-card-head b { font-size: .95rem; font-weight: 700; color: var(--sp-text); }
.sp-card-title { font-size: .95rem; font-weight: 700; color: var(--sp-text); }
.sp-link { font-size: .82rem; font-weight: 600; color: var(--sp-primary); cursor: pointer; white-space: nowrap; }
.sp-link:hover { color: var(--sp-primary-2); }
.sp-muted-box { border: 0; border-radius: 12px; background: var(--edl-surface); padding: 14px; font-size: .86rem; color: var(--sp-text-2); line-height: 1.6; box-shadow: var(--edl-shadow); }

.sp-badge-pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 3px 10px; font-size: .76rem; font-weight: 600; white-space: nowrap; }

/* ---------- รูป / สีตัวอย่าง ---------- */
.sp-thumb { display: block; width: 42px; height: 42px; border-radius: 10px; flex: none; object-fit: cover; background: var(--edl-soft-3); border: 1px solid rgba(41, 52, 61, .05); }
.sp-thumb.sm { width: 28px; height: 28px; border-radius: 7px; }
.sp-thumb.md { width: 34px; height: 34px; border-radius: 9px; }
.sp-thumb.lg { width: 56px; height: 56px; border-radius: 12px; }

/* ---------- หน้าหลัก ---------- */
.sp-cols { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.sp-col-main { flex: 2.6; min-width: 290px; display: flex; flex-direction: column; gap: 16px; }
.sp-col-side { flex: 1; min-width: 250px; display: flex; flex-direction: column; gap: 16px; }

.sp-hero { background: linear-gradient(135deg, var(--bs-primary) 0%, var(--edl-primary-light) 100%); border-radius: 12px; padding: 20px; color: #fff; position: relative; overflow: hidden; box-shadow: 0 12px 24px -10px rgba(var(--bs-primary-rgb), .55); }
.sp-hero:before { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.sp-hero:after { content: ''; position: absolute; right: 40px; bottom: -70px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.sp-hero > * { position: relative; z-index: 1; }
.sp-hero .k { display: flex; align-items: center; gap: 7px; font-size: .82rem; color: rgba(255, 255, 255, .78); }
.sp-hero .v { display: flex; align-items: baseline; gap: 7px; margin: 4px 0 10px; }
.sp-hero .v b { font-size: 2.1rem; font-weight: 700; line-height: 1; }
.sp-hero .v span { font-size: .88rem; color: rgba(255, 255, 255, .78); white-space: nowrap; }
.sp-hero .spark { display: flex; align-items: flex-end; gap: 3px; height: 34px; margin-top: 5px; }
.sp-hero .spark i { display: block; width: 6px; border-radius: 3px; background: var(--edl-surface); }
.sp-hero .tags { display: flex; gap: 8px; flex-wrap: wrap; }
.sp-hero .tags span { background: rgba(255, 255, 255, .16); border-radius: 999px; padding: 5px 11px; font-size: .78rem; white-space: nowrap; }

.sp-bento { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.sp-bento > div { box-sizing: border-box; border-radius: 12px; background: var(--edl-surface); padding: 18px; min-width: 0; overflow: hidden; box-shadow: var(--edl-shadow); }
.sp-bento .b-primary { background: var(--sp-primary); color: #fff; position: relative; min-height: 180px; display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; }
.sp-bento .b-primary > * { position: relative; }
.sp-bento .b-primary .tag { display: inline-flex; align-self: flex-start; background: rgba(255, 255, 255, .16); border-radius: 999px; padding: 4px 12px; font-size: .78rem; }
.sp-bento .b-primary .val { font-size: clamp(26px, 4vw, 44px); font-weight: 700; line-height: 1.1; margin-top: 18px; word-break: break-word; }
.sp-bento .b-primary .note { font-size: .82rem; color: rgba(255, 255, 255, .75); margin-top: 8px; }
.sp-bento .b-primary .img { position: absolute; right: 14px; top: 14px; width: 70px; height: 70px; border-radius: 14px; object-fit: cover; border: 2px solid rgba(255, 255, 255, .25); }
.sp-bento .b-growth .bars { display: flex; align-items: flex-end; gap: 6px; height: 64px; margin-top: 12px; }
.sp-bento .b-growth .bars i { flex: 1; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--edl-primary-light), var(--bs-primary)); }
.sp-bento .lbl { font-size: .78rem; color: var(--sp-muted); }
.sp-bento .big { font-size: 1.4rem; font-weight: 700; margin-top: 4px; color: var(--sp-text); }
.sp-bento .b-rate { display: flex; align-items: center; gap: 12px; }
.sp-bento .b-rate .ok { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--edl-success-soft); color: var(--sp-green); font-size: 20px; flex: none; }
@media (min-width: 1300px) {
    .sp-bento { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .sp-bento .b-primary { grid-column: span 4; grid-row: span 2; }
    .sp-bento .b-growth { grid-column: span 2; }
    .sp-bento .b-small { grid-column: span 1; text-align: center; }
    .sp-bento .b-rate { grid-column: span 1; flex-direction: column; text-align: center; }
}
@media (min-width: 560px) and (max-width: 1299.98px) {
    .sp-bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sp-bento .b-primary { grid-column: span 2; }
}

.sp-stats { display: flex; gap: 12px; flex-wrap: wrap; }
.sp-stat {
    flex: 1; min-width: 130px; border: 1px solid transparent; border-radius: 12px; background: var(--edl-surface); padding: 13px 14px; cursor: pointer;
    transition: border-color .16s, transform .16s, box-shadow .16s; color: var(--sp-text); box-shadow: var(--edl-shadow);
}
.sp-stat:hover { border-color: var(--sp-primary-line); color: var(--sp-text); transform: translateY(-2px); box-shadow: var(--edl-shadow-hover); }
.sp-stat.green { background: var(--edl-success-soft); }
.sp-stat .k { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--sp-muted); font-weight: 500; }
.sp-stat .v { display: flex; align-items: baseline; gap: 6px; }
.sp-stat .v b { font-size: 1.35rem; font-weight: 700; }
.sp-stat .v span { font-size: .76rem; color: var(--sp-muted); }
.sp-stat .n { font-size: .76rem; color: var(--sp-muted); }

.sp-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.sp-action {
    flex: 1; min-width: 150px; display: flex; align-items: center; gap: 10px; border: 1px solid transparent; border-radius: 12px; padding: 13px;
    cursor: pointer; color: var(--sp-text); background: var(--edl-surface); transition: border-color .16s, transform .16s, box-shadow .16s; text-align: left; box-shadow: var(--edl-shadow);
}
.sp-action:hover { border-color: var(--sp-primary-line); transform: translateY(-2px); color: var(--sp-text); }
.sp-action .ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--sp-primary-soft); color: var(--sp-primary); flex: none; }
.sp-action .ic i { font-size: 1.15rem; }
.sp-action b { display: block; font-size: .9rem; font-weight: 600; }
.sp-action span.s { display: block; font-size: .76rem; color: var(--sp-muted); }
.sp-action.primary { background: var(--sp-primary); color: #fff; box-shadow: 0 10px 20px -8px rgba(var(--bs-primary-rgb), .55); }
.sp-action.primary:hover { color: #fff; border-color: transparent; }
.sp-action.primary .ic { background: rgba(255, 255, 255, .18); color: #fff; }
.sp-action.primary span.s { color: rgba(255, 255, 255, .75); }

.sp-row { display: flex; align-items: center; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--sp-line-2); cursor: pointer; transition: background .16s; color: var(--sp-text); }
.sp-row:last-child { border-bottom: 0; }
.sp-row:hover { background: var(--sp-soft); color: var(--sp-text); }
.sp-row .ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; flex: none; }
.sp-row .ic i { font-size: 1.05rem; }
.sp-row .t b { display: block; font-size: .88rem; font-weight: 600; }
.sp-row .t span { display: block; font-size: .78rem; color: var(--sp-muted); }
.sp-row .chev { color: var(--edl-line-3); font-size: .9rem; }

.sp-mini { display: flex; align-items: center; gap: 9px; }
.sp-mini + .sp-mini { margin-top: 10px; }
.sp-mini .nt { display: block; font-size: .72rem; color: var(--sp-amber); }
.sp-give-btn { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--sp-line); background: var(--edl-surface); color: var(--sp-text); cursor: pointer; transition: border-color .16s, background .16s, color .16s; }
.sp-give-btn:hover { border-color: var(--sp-primary-line); background: var(--sp-primary-soft); color: var(--sp-primary); }
.sp-give-btn i { font-size: .9rem; }
.sp-pick { display: flex; align-items: center; gap: 9px; border: 1px solid var(--sp-line-2); border-radius: 10px; padding: 8px 10px; cursor: pointer; transition: border-color .16s, background .16s; }
.sp-pick + .sp-pick { margin-top: 8px; }
.sp-pick:hover { border-color: var(--sp-primary-line); }
.sp-activity { display: flex; align-items: flex-end; gap: 6px; height: 70px; }
.sp-activity > span { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; align-items: center; height: 100%; }
.sp-activity i { display: block; width: 100%; border-radius: 6px 6px 3px 3px; }
.sp-activity small { font-size: .7rem; color: var(--edl-muted-2); margin-top: 3px; }
.sp-legend { display: flex; gap: 12px; margin-top: 10px; font-size: .76rem; color: var(--sp-muted); }
.sp-legend span { display: flex; align-items: center; gap: 5px; }
.sp-legend i { display: block; width: 8px; height: 8px; border-radius: 3px; }
.sp-empty { text-align: center; color: var(--edl-muted-2); font-size: .86rem; padding: 18px 8px; }
.sp-empty i { display: block; font-size: 30px; margin-bottom: 4px; color: var(--edl-line-3); }

/* ---------- เลือกลาย (coverflow) ---------- */
.sp-cover-card { border-radius: 12px; background: var(--edl-surface); padding: 14px 8px 18px; box-shadow: var(--edl-shadow); }
.cf { position: relative; height: 330px; perspective: 1100px; overflow: hidden; touch-action: pan-y; user-select: none; cursor: grab; }
.cf:active { cursor: grabbing; }
.cf-stage { position: absolute; inset: 0; transform-style: preserve-3d; }
.cf-card { position: absolute; left: 50%; top: 14px; bottom: 14px; border-radius: 16px; overflow: hidden; box-shadow: 0 22px 44px rgba(10, 37, 64, .22); will-change: transform; backface-visibility: hidden; background-size: cover; background-position: center; }
.cf-card .scrim { position: absolute; inset: 0; }
.cf-card .cap { position: absolute; left: 14px; right: 14px; bottom: 12px; }
.cf-card .cap small { display: block; font-size: .72rem; opacity: .85; }
.cf-card .cap b { display: block; font-size: .9rem; font-weight: 700; line-height: 1.3; }
.cf-card .low { position: absolute; top: 12px; left: 12px; background: var(--edl-danger-soft); color: var(--sp-red); border-radius: 999px; padding: 2px 9px; font-size: .72rem; font-weight: 600; }
.cf-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 200; width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, var(--edl-surface) 95%, transparent); border: 1px solid var(--sp-line-2); display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 16px rgba(41, 52, 61, .12); color: var(--sp-text); }
.cf-nav:hover { color: var(--sp-primary); }
.cf-nav.prev { left: 14%; }
.cf-nav.next { right: 14%; }
.cf-info { text-align: center; animation: cfFade .3s; padding: 0 10px; }
.cf-info h5 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.cf-info .sub { font-size: .78rem; color: var(--sp-muted); margin-top: 2px; }
.cf-meta { display: flex; justify-content: center; margin: 12px auto; border: 1px solid var(--sp-line-2); border-radius: 12px; background: var(--sp-soft); max-width: 420px; }
.cf-meta > div { flex: 1; padding: 8px 6px; }
.cf-meta > div + div { border-left: 1px solid var(--sp-line-2); }
.cf-meta small { display: block; font-size: .72rem; color: var(--sp-muted); }
.cf-meta b { display: block; font-size: .86rem; font-weight: 600; }
.cf-dots { display: flex; justify-content: center; gap: 5px; margin-top: 12px; }
.cf-dots i { width: 7px; height: 7px; border-radius: 999px; background: var(--edl-line-3); transition: width .2s, background .2s; }
.cf-dots i.on { width: 22px; background: var(--sp-primary); }
@media (max-width: 559.98px) {
    .cf { height: 290px; }
    .cf-nav { display: none; }
}

/* ---------- รายการสินค้า ---------- */
.sp-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 1300px) { .sp-grid { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); } }
@media (min-width: 640px) and (max-width: 1299.98px) { .sp-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.sp-prod { display: flex; align-items: center; gap: 12px; border: 1px solid transparent; border-radius: 12px; padding: 12px; background: var(--edl-surface); transition: border-color .16s, box-shadow .16s; box-shadow: var(--edl-shadow); }
.sp-prod:hover { border-color: var(--sp-primary-line); box-shadow: 0 8px 20px rgba(41, 52, 61, .08); }
.sp-prod.in-cart { border-color: var(--sp-primary-line); background: var(--edl-primary-tint); }
.sp-prod.closed { opacity: .6; }
.sp-prod .pic { width: 56px; height: 56px; border-radius: 10px; flex: none; object-fit: cover; cursor: zoom-in; background: var(--edl-soft-3); }
.sp-prod .info { flex: 1; min-width: 0; cursor: pointer; }
.sp-prod .info b { display: block; font-size: .9rem; font-weight: 500; line-height: 1.35; color: var(--sp-text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sp-prod .info span { display: block; font-size: .78rem; color: var(--sp-muted); }
.sp-prod .info .stk { color: var(--c, var(--sp-muted)); font-weight: 600; }
.sp-prod .info b.sku { font-weight: 700; font-size: .9rem; letter-spacing: .01em; -webkit-line-clamp: 2; line-height: 1.3; overflow-wrap: anywhere; }
.sp-prod .info .nm { color: var(--sp-text-2); font-size: .84rem; }
.sp-sizereq { display: flex; align-items: center; gap: 12px; border: 1px dashed var(--edl-warning-line); background: var(--edl-warning-soft); border-radius: 12px; padding: 11px 13px; }
.sp-sizereq .ic { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--edl-warning-soft); color: var(--sp-amber); font-size: 1.05rem; }
.sp-sizereq b { display: block; font-weight: 600; font-size: .9rem; color: var(--sp-text); }
.sp-sizereq span > span { display: block; font-size: .78rem; color: var(--sp-muted); }
@media (max-width: 559.98px) { .sp-sizereq { flex-wrap: wrap; } .sp-sizereq .sp-btn { width: 100%; } }
#holdGrid .sp-prod, #catGrid .sp-prod { flex-wrap: wrap; }
.sp-holdnote { flex: 0 0 100%; display: flex; align-items: center; gap: 7px; border-top: 1px dashed var(--sp-line); margin-top: 3px; padding-top: 8px; color: var(--sp-muted); }
.sp-holdnote i { font-size: .82rem; flex: none; }
.sp-holdnote input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: .84rem; padding: 2px 0; color: var(--sp-text); }
.sp-holdnote input:focus { outline: 0; }
.sp-holdnote input::placeholder { color: var(--edl-muted-2); }

.sp-step { display: flex; align-items: center; gap: 7px; flex: none; }
.sp-step button { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--sp-line); color: var(--edl-muted-2); background: var(--edl-surface); cursor: pointer; padding: 0; transition: all .15s; }
.sp-step button.minus.on { border-color: var(--sp-text-2); color: var(--sp-text); }
.sp-step button.plus { background: var(--sp-primary); border-color: var(--sp-primary); color: #fff; }
.sp-step button.plus:disabled { background: var(--edl-primary-line-2); border-color: var(--edl-primary-line-2); }
.sp-step button i { font-size: .95rem; }
.sp-step input { width: 38px; text-align: center; border: 0; font-size: .95rem; font-weight: 600; padding: 4px 0; background: transparent; -moz-appearance: textfield; outline: none; color: var(--sp-text); }
.sp-step input::-webkit-outer-spin-button, .sp-step input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sp-step.big button { width: 44px; height: 44px; border-radius: 10px; }
.sp-step.big input { width: 60px; font-size: 1.25rem; font-weight: 700; }
.sp-more { text-align: center; padding: 10px 0; }

/* ---------- รายการของฉัน ---------- */
.sp-doc { display: flex; align-items: center; gap: 12px; border: 1px solid transparent; border-radius: 12px; padding: 13px; cursor: pointer; transition: border-color .16s, box-shadow .16s; background: var(--edl-surface); box-shadow: var(--edl-shadow); }
.sp-doc:hover { border-color: var(--sp-primary-line); box-shadow: 0 8px 20px rgba(41, 52, 61, .08); }
.sp-doc .ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; flex: none; }
.sp-doc .ic i { font-size: 1.05rem; }
.sp-doc .t b { display: block; font-size: .9rem; font-weight: 700; color: var(--sp-text); }
.sp-doc .t span { display: block; font-size: .78rem; color: var(--sp-muted); }
.sp-doc .r { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: none; }
.sp-doc .r .go { font-size: .78rem; font-weight: 600; color: var(--sp-primary); }
.sp-doc .t .dots { display: flex; margin-top: 5px; }
.sp-doc .t .dots > * { display: block; margin-right: -6px; border: 2px solid var(--edl-surface); }
.sp-daterange { display: flex; gap: 8px; align-items: center; }
.sp-daterange input { flex: 1; min-width: 0; padding: 9px 12px; }

/* ---------- คืนของ ---------- */
.sp-mode { display: flex; gap: 10px; }
.sp-mode label { flex: 1; border: 1px solid var(--sp-line); border-radius: 12px; padding: 12px; cursor: pointer; display: flex; align-items: center; gap: 10px; transition: border-color .15s, background .15s; background: var(--edl-surface); }
.sp-mode input { display: none; }
.sp-mode label .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--sp-soft); color: var(--sp-primary); flex: none; }
.sp-mode label b { display: block; font-size: .88rem; font-weight: 600; color: var(--sp-text); }
.sp-mode label span span { display: block; font-size: .74rem; color: var(--sp-muted); }
.sp-mode input:checked + label { border-color: var(--sp-primary); background: var(--edl-primary-tint); box-shadow: 0 0 0 1px var(--sp-primary) inset; }
.sp-mode input:checked + label .ic { background: var(--sp-primary); color: #fff; }
/* คืนของทีละใบเบิก */
.rt-docs { display: flex; flex-direction: column; gap: 8px; }
.rt-doc, .rt-cur { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; border: 1px solid var(--sp-line); border-radius: 12px; padding: 12px; background: var(--edl-surface); color: var(--sp-text); }
.rt-doc { cursor: pointer; transition: border-color .15s, background .15s; }
.rt-doc:hover, .rt-doc:focus-visible { border-color: var(--sp-primary-line); background: var(--edl-primary-tint); }
.rt-doc .ic, .rt-cur .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--sp-soft); color: var(--sp-primary); flex: none; font-size: 17px; }
.rt-cur { border-color: var(--sp-primary-line); background: var(--edl-primary-tint); }
.rt-cur .ic { background: var(--sp-primary); color: #fff; }
.sp-attach { border: 1px dashed var(--edl-line-3); border-radius: 12px; background: var(--edl-surface); padding: 13px; display: flex; align-items: center; gap: 10px; font-size: .86rem; color: var(--sp-muted); cursor: pointer; }
.sp-attach:hover { border-color: var(--sp-primary-line); }
.sp-attach img { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; }

/* ---------- ข้อมูลส่วนตัว ---------- */
.sp-prof { display: flex; align-items: center; gap: 14px; border: 0; border-radius: 12px; padding: 16px; background: var(--edl-surface); box-shadow: var(--edl-shadow); }
.sp-prof .av { width: 64px; height: 64px; border-radius: 50%; background: var(--sp-primary-soft); border: 1px solid var(--sp-line-2); object-fit: cover; flex: none; display: grid; place-items: center; font-size: 22px; font-weight: 700; color: var(--sp-primary); }
.sp-toggle { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--sp-line); border-radius: 10px; padding: 12px 14px; cursor: pointer; background: var(--edl-surface); }
.sp-toggle input { display: none; }
.sp-toggle .sw { display: block; width: 40px; height: 22px; border-radius: 999px; background: var(--edl-line-3); position: relative; transition: background .18s; flex: none; }
.sp-toggle .sw:after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--edl-surface); transition: left .18s; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.sp-toggle input:checked + .sw { background: var(--sp-primary); }
.sp-toggle input:checked + .sw:after { left: 20px; }
.sp-kv { display: flex; gap: 10px; }
.sp-kv > div { flex: 1; min-width: 0; }
.sp-perm { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 4px 10px; font-size: .78rem; font-weight: 600; background: var(--sp-primary-soft); color: var(--sp-primary); margin: 0 5px 5px 0; }
.sp-perm.off { background: var(--sp-soft); color: var(--edl-muted-2); text-decoration: line-through; font-weight: 500; }

/* ---------- แผ่นล่าง (modal) ---------- */
.sp-sheet .modal-dialog { margin: 1.75rem auto; max-width: 540px; }
.sp-sheet .modal-content { border: 0; border-radius: 16px; }
.sp-sheet .modal-body { padding: 18px 18px 22px; }
.sp-sheet .sh-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.sp-sheet .sh-head .k { display: block; font-size: .8rem; color: var(--sp-muted); }
.sp-sheet .sh-head .t { display: block; font-size: 1.15rem; font-weight: 700; line-height: 1.3; color: var(--sp-text); }
.sp-close { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--sp-line); cursor: pointer; background: var(--edl-surface); flex: none; color: var(--sp-text); }
.sp-close:hover { color: var(--sp-primary); border-color: var(--sp-primary-line); }
.sp-lines { border: 1px solid var(--sp-line-2); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.sp-line { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-bottom: 1px solid var(--sp-line-2); }
.sp-line:last-child { border-bottom: 0; }
.sp-line .t b { display: block; font-size: .88rem; font-weight: 600; color: var(--sp-text); }
.sp-line .t span { display: block; font-size: .78rem; color: var(--sp-muted); }
.sp-line .q { font-size: .88rem; color: var(--sp-text-2); white-space: nowrap; text-align: right; }
.sp-item { border-bottom: 1px solid var(--sp-line-2); }
.sp-item:last-child { border-bottom: 0; }
.sp-item .sp-line { border-bottom: 0; padding-bottom: 4px; }
.sp-linenote { display: flex; align-items: center; gap: 7px; padding: 0 13px 11px 13px; color: var(--sp-muted); }
.sp-linenote i { font-size: .82rem; flex: none; }
.sp-linenote input { flex: 1; min-width: 0; border: 0; border-bottom: 1px dashed var(--sp-line); background: transparent; font-size: .84rem; padding: 3px 0; color: var(--sp-text); }
.sp-linenote input:focus { outline: 0; border-bottom-color: var(--sp-primary); }
.sp-linenote input::placeholder { color: var(--edl-muted-2); }
.sp-linenote.size { margin-top: -5px; }
.sp-linenote.size.on, .sp-linenote.size.on input { color: var(--sp-amber); font-weight: 600; }
/* กล่อง "ให้ลูกค้าแล้ว" ใน SweetAlert */
.sw-give { text-align: left; display: flex; flex-direction: column; gap: 12px; }
.sw-give .hd { display: flex; align-items: center; gap: 10px; background: var(--sp-soft); border-radius: 10px; padding: 10px 12px; }
.sw-give .hd b { display: block; font-size: .9rem; font-weight: 600; color: var(--sp-text); }
.sw-give .hd > span > span { display: block; font-size: .78rem; color: var(--sp-muted); }
.sw-give .fl > span { display: block; font-size: .8rem; font-weight: 600; color: var(--sp-text); margin-bottom: 5px; }
.sw-give .fl > span i { color: var(--sp-red); font-style: normal; }
.sw-give .fl input { width: 100%; border: 1px solid var(--sp-line); border-radius: 8px; padding: 11px 13px; font-size: 16px; font-family: inherit; color: var(--sp-text); background: var(--edl-surface); }
.sw-give .fl input:focus { outline: 0; border-color: var(--sp-primary); box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), .12); }
.sw-give .nt { font-size: .78rem; color: var(--sp-muted); }
.sp-qr { border: 1px solid var(--sp-line-2); border-radius: 12px; padding: 15px; display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 14px; }
.sp-qr .box { background: var(--edl-surface); border: 1px solid var(--sp-line-2); border-radius: 10px; padding: 10px; line-height: 0; }
.sp-qr .box img, .sp-qr .box canvas { width: 180px !important; height: 180px !important; }
.sp-qr.wait .box { opacity: .35; filter: grayscale(1); }
.sp-tl { list-style: none; margin: 0 0 14px; padding: 0; }
.sp-tl li { position: relative; padding: 0 0 12px 32px; font-size: .86rem; color: var(--sp-text-2); }
.sp-tl li:before { content: ''; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px; background: var(--sp-line-2); }
.sp-tl li:last-child:before { display: none; }
.sp-tl .d { position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--sp-soft); color: var(--edl-muted-2); font-size: .75rem; }
.sp-tl li.done .d { background: var(--edl-success-soft); color: var(--sp-green); }
.sp-tl li.bad .d { background: var(--edl-danger-soft); color: var(--sp-red); }
.sp-tl small { display: block; font-size: .74rem; color: var(--sp-muted); }
.sp-note { background: var(--sp-soft); border-radius: 10px; padding: 10px 12px; font-size: .84rem; color: var(--sp-text-2); margin-bottom: 14px; }
.sp-note.red { background: var(--edl-danger-soft); color: var(--edl-danger); }
.sp-pimg { width: 100%; aspect-ratio: 4/3; border-radius: 12px; object-fit: cover; background: var(--edl-soft-3); margin-bottom: 14px; cursor: zoom-in; }
.sp-pimg.swatch { cursor: default; }
@media (max-width: 575.98px) {
    /* แผ่นล่างชิดขอบล่างจอ (ไม่จัดกลางแบบ modal-dialog-centered) */
    .sp-sheet .modal-dialog { position: fixed; bottom: 0; left: 0; right: 0; margin: 0; max-width: none; min-height: 0; align-items: flex-end; transform: translateY(40px); transition: transform .25s ease-out; }
    .sp-sheet.show .modal-dialog { transform: none; }
    .sp-sheet .modal-content { border-radius: 18px 18px 0 0; max-height: 90vh; }
    .sp-sheet .modal-body { overflow-y: auto; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}

/* การแจ้งเตือน */
.sp-noti { position: fixed; top: 76px; right: 16px; width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto; background: var(--edl-surface); border-radius: 14px; box-shadow: 0 14px 40px rgba(41, 52, 61, .18); z-index: 1045; display: none; animation: riseIn .18s ease-out; }
.sp-noti.show { display: block; }
.sp-noti .nh { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--sp-line-2); position: sticky; top: 0; background: var(--edl-surface); }
.sp-noti .nh b { font-weight: 700 !important; color: var(--sp-text); }
.sp-noti .ni { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--sp-line-2); cursor: pointer; }
.sp-noti .ni:hover { background: var(--sp-soft); }
.sp-noti .ni.unread { background: var(--edl-primary-tint); }
.sp-noti .ni .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }

/* ---------- ตารางรายการของฉัน (แบบรายงาน) ---------- */
.sp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sp-table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 640px; color: var(--sp-text-2); }
.sp-table th { text-align: left; font-weight: 600; font-size: .78rem; color: var(--sp-text); padding: 11px 12px; background: var(--sp-soft); border-bottom: 0; white-space: nowrap; }
.sp-table th:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.sp-table th:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.sp-table td { padding: 10px 12px; border-bottom: 1px solid var(--sp-line-2); vertical-align: top; }
.sp-table tr[data-doc] { cursor: pointer; }
.sp-table tr[data-doc]:hover td { background: var(--sp-soft); }
.sp-table tr.first td { border-top: 1px solid var(--sp-line-2); }
.sp-table tr.cont td { border-top: 0; }
.sp-table .r { text-align: right; white-space: nowrap; }
.sp-table td small { display: block; font-size: .72rem; color: var(--sp-muted); }
.sp-table td.no { white-space: nowrap; }
.sp-table td.no b { font-weight: 700; color: var(--sp-text); }
.sp-table td.it b { font-weight: 600; color: var(--sp-text); }
.sp-table td.it span { color: var(--sp-text-2); }
.sp-table td.it small.req { color: var(--sp-amber); font-weight: 600; }
.sp-table td.pj { max-width: 220px; }
.sp-table .sp-badge-pill { white-space: nowrap; }

/* แจ้งเตือนข้อมูลส่วนตัวไม่ครบ */
.sp-profile-need { display: flex; align-items: center; gap: 12px; background: var(--edl-danger-soft); color: var(--edl-danger); border-radius: 12px; padding: 12px 14px; margin-bottom: 4px; }
.sp-profile-need:hover { color: var(--edl-danger); }
.sp-profile-need > i:first-child { font-size: 22px; }
.sp-profile-need b { display: block; font-weight: 700; }
.sp-profile-need span > span { display: block; font-size: .78rem; opacity: .85; }
.sp-profile-need.is-cart, .sp-profile-need.is-cart:hover { background: var(--edl-primary-soft); color: var(--bs-primary); }

/* ---------- สลับ วัสดุตัวอย่าง / แคตตาล็อก ---------- */
.sp-seg { display: flex; gap: 4px; background: var(--edl-surface); border-radius: 12px; padding: 5px; box-shadow: var(--edl-shadow); }
.sp-seg a, .sp-seg button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; border: 0; background: transparent; border-radius: 8px; padding: 9px 10px; font-size: .88rem; font-weight: 500; color: var(--sp-text-2); white-space: nowrap; cursor: pointer; transition: background .16s, color .16s; }
.sp-seg a:hover, .sp-seg button:hover { color: var(--sp-primary); }
.sp-seg .on { background: var(--sp-primary); color: #fff !important; font-weight: 600; box-shadow: 0 8px 16px -6px rgba(var(--bs-primary-rgb), .55); }
.sp-seg .n { background: var(--sp-primary-soft); color: var(--sp-primary); border-radius: 999px; padding: 0 7px; font-size: .72rem; font-weight: 700; line-height: 18px; }
.sp-seg .on .n { background: rgba(255, 255, 255, .22); color: #fff; }
.sp-seg .n:empty { display: none; }

/* ---------- การ์ดแคตตาล็อก (ปกแนวตั้ง) ---------- */
.sp-prod.cat .pic { width: 54px; height: 72px; border-radius: 8px; }
.sp-prod.cat .info .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-empty { display: grid !important; place-items: center; background: var(--sp-primary-soft) !important; color: var(--edl-primary-light); font-size: 22px; cursor: default !important; }
.sp-thumb.cat-empty { font-size: 16px; }
.cat-tag { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; line-height: 1; padding: 4px 8px; border-radius: 999px; background: var(--edl-warning-soft); color: var(--sp-amber); font-weight: 600; vertical-align: 1px; }

/* สแกนเนอร์: ปุ่ม +/- บนพื้นเข้ม */
.scanner-ov .sc-last .sp-step button.minus { background: transparent; border-color: rgba(255, 255, 255, .35); color: #fff; }
.scanner-ov .sc-last .sp-step input { color: #fff; }

@media (max-width: 575.98px) {
    .sp-content { gap: 12px; }
    .sp-stats { gap: 10px; }
    .sp-stat { min-width: calc(50% - 5px); }
}


/* ตั้งค่าหน้าตา: จอแคบมีแท็บล่าง/แถบตะกร้าอยู่แล้ว → เปิดจากปุ่มท้ายเมนูซ้ายแทนปุ่มลอย */
@media (max-width: 1299.98px) { .edl-sale .edl-customizer-btn { display: none !important; } }
html[data-boxed-layout="boxed"] .edl-sale .body-wrapper > .container-fluid { max-width: 1200px; }
[data-bs-theme="dark"] .sp-cartbar .in { border: 1px solid var(--edl-line); }
[data-bs-theme="dark"] .sp-tabbar { box-shadow: 0 -6px 20px rgba(0, 0, 0, .3); }
[data-bs-theme="dark"] .sp-tab.scan .ic { box-shadow: 0 10px 22px rgba(0, 0, 0, .45); }
.sp-noti .nq { padding: 10px 16px 6px; font-size: .72rem; font-weight: 600; color: var(--sp-muted); text-transform: uppercase; letter-spacing: .02em; background: var(--sp-soft); }
.sp-noti a.ni { text-decoration: none; }

/* ---------- หน้าหลัก: สรุปงานของฉันทุกระบบ (ตามสิทธิ์) ---------- */
.sp-mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.sp-mod {
    display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 12px; background: var(--edl-surface); box-shadow: var(--edl-shadow);
    border: 1px solid transparent; border-top: 3px solid var(--c, var(--bs-primary)); color: var(--sp-text); transition: border-color .16s, transform .16s, box-shadow .16s;
}
.sp-mod:hover { color: var(--sp-text); transform: translateY(-2px); box-shadow: var(--edl-shadow-hover); }
.sp-mod .mh { display: flex; align-items: center; gap: 8px; font-size: .86rem; }
.sp-mod .mh b { font-weight: 600; flex: 1; min-width: 0; }
.sp-mod .mh > i { color: var(--sp-muted); font-size: .8rem; }
.sp-mod .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none;
    background: color-mix(in srgb, var(--c, var(--bs-primary)) 14%, var(--edl-surface)); color: var(--c, var(--bs-primary)); }
.sp-mod .mv { display: flex; align-items: baseline; gap: 6px; }
.sp-mod .mv > b { font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.sp-mod .mv > span { font-size: .76rem; color: var(--sp-muted); }
.sp-mod .mk { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .76rem; color: var(--sp-muted); padding-top: 8px; border-top: 1px dashed var(--sp-line-2); }
.sp-mod .mk b { color: var(--sp-text); font-weight: 600; }
.sp-mod .mk:empty { display: none; }

/* ---------- ไซส์แผ่นตัวอย่าง (เลือกไซส์ก่อนเบิก) ---------- */
.sz-tag { display: inline-block; font-size: .72rem; font-weight: 600; line-height: 1.35; padding: 0 6px; border-radius: 6px; background: var(--sp-primary-soft); color: var(--sp-primary); white-space: nowrap; }
.sz-pills { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.sz-pills .sz { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--sp-line);
    background: var(--edl-surface); color: var(--sp-text); font-size: .78rem; font-weight: 600; cursor: pointer; }
.sz-pills button.sz:hover:not(:disabled) { border-color: var(--sp-primary-line); color: var(--sp-primary); }
.sz-pills .sz i { font-style: normal; font-weight: 400; color: var(--sp-muted); }
.sz-pills .sz.out, .sz-pills .sz:disabled { opacity: .5; text-decoration: line-through; cursor: not-allowed; }
.sz-pills .sz.on { padding: 0 3px; gap: 2px; border-color: var(--sp-primary); background: var(--sp-primary-soft); color: var(--sp-primary); cursor: default; }
.sz-pills .sz.on b { padding: 0 3px; }
.sz-pills .sz-d { width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--edl-surface); color: var(--sp-primary); font-weight: 700; line-height: 1; padding: 0; cursor: pointer; }
.sz-pills .sz-d:disabled { opacity: .35; cursor: not-allowed; }
.sz-pills .sz-none { font-size: .76rem; color: var(--sp-muted); }
.sp-prod.has-sizes { align-items: flex-start; }
.sp-prod.has-sizes .info { cursor: default; }
.cf-sizes { display: flex; justify-content: center; margin: 4px 0 10px; }
.cf-sizes .sz-pills { justify-content: center; }
.sz-rows { display: flex; flex-direction: column; gap: 6px; }
.sz-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--sp-line); border-radius: 12px; }
.sz-row .lb { font-weight: 700; min-width: 64px; }
.sz-row .av { flex: 1; font-size: .8rem; color: var(--sp-muted); }
.sz-row.out { opacity: .55; }
.sz-pick-head { display: flex; align-items: center; gap: 10px; text-align: left; margin-bottom: 12px; }
.sz-pick-head b { display: block; font-weight: 500; }
.sz-pick-head span span { display: block; font-size: .8rem; color: var(--sp-muted); }
.sz-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.sz-pick button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; border-radius: 14px; border: 1px solid var(--sp-line); background: var(--edl-surface); cursor: pointer; color: var(--sp-text); }
.sz-pick button b { font-size: 1rem; }
.sz-pick button span { font-size: .75rem; color: var(--sp-muted); }
.sz-pick button:hover:not(:disabled) { border-color: var(--sp-primary); background: var(--sp-primary-soft); }
.sz-pick button:disabled { opacity: .45; cursor: not-allowed; }
/* ป้ายไซส์ในบรรทัดรายการ (ไม่ยืดเต็มบรรทัดตามสไตล์ชื่อ) */
.sp-line .t .sz-tag, .sp-prod .info .sz-tag, .sp-mini .sz-tag, .sp-row .sz-tag, .sw-give .sz-tag, td .sz-tag { display: inline-block; width: auto; font-size: .72rem; font-weight: 600; margin: 0; -webkit-line-clamp: unset; }
/* ปุ่มไซส์ในการ์ด — ไม่ให้สไตล์ชื่อ / บรรทัดย่อยของการ์ดทับ */
.sp-prod .info .sz-pills { display: flex; }
.sp-prod .info .sz-pills .sz { display: inline-flex; }
.sp-prod .info .sz-pills .sz-none { display: inline; }
.sp-prod .info .sz-pills b, .cf-sizes .sz-pills b { display: inline; font-size: .78rem; font-weight: 700; line-height: 1; color: inherit; -webkit-line-clamp: unset; overflow: visible; letter-spacing: 0; }

/* แคตตาล็อก: แบรนด์ (ป้ายบนการ์ด · ชิปกรอง) — สีแบรนด์ส่งมาเป็น --c */
.sp-prod .info .cat-brand { display: inline-block; align-self: flex-start; font-size: .66rem; font-weight: 700; letter-spacing: .03em; padding: 1px 7px; border-radius: 999px; margin-bottom: 2px;
    background: color-mix(in srgb, var(--c) 14%, var(--edl-surface)); color: var(--c); }
.cat-bchip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 5px; vertical-align: 1px; }
