/* ============================================================
   EDL Stock — ธีมหน้าบ้าน (พนักงานขาย) + หน้าเข้าสู่ระบบ
   ถอดแบบจาก public/themefront/EDL-Stock-System-standalone.html
   ink #241f1b · walnut #7a5a3e · oak #c9a37a · amber #e8b856
   ============================================================ */
:root {
    --ink: #241f1b;
    --ink-2: #3b3129;
    --walnut: #7a5a3e;
    --walnut-2: #5b4634;
    --oak: #c9a37a;
    --amber: #e8b856;
    --amber-2: #c8891b;
    --green: #2f8a62;
    --green-2: #4f6b56;
    --blue: #4c5bb0;
    --red: #b5544a;
    --muted: #a8a09a;
    --muted-2: #5c554e;
    --line: #ebebee;
    --line-2: #e7e7ea;
    --line-3: #e2e2e6;
    --soft: #f5f5f6;
    --bg: #ffffff;
    --font: 'Prompt', system-ui, -apple-system, sans-serif;
    --wrap: 640px;
    --st-ok: #2f8a62;
    --st-warn: #d99a1e;
    --st-low: #c0503c;
    --st-over: #c0503c;
}

@media (min-width: 1080px) {
    :root { --wrap: 1440px; }
}

* { -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    font-family: var(--font);
    color: var(--ink);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--walnut); text-decoration: none; }
a:hover { color: var(--ink); }
button { font-family: inherit; }
.text-muted { color: var(--muted) !important; }
.fs-xs { font-size: 12.5px; }
.fs-sm { font-size: 13.5px; }
.min-w-0 { min-width: 0; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cursor-pointer { cursor: pointer; }

@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-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border-radius: 999px; padding: 12px 18px; font-size: 14.5px; border: 1px solid transparent;
    cursor: pointer; transition: transform .16s, box-shadow .16s, background .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(--walnut); color: #fff; }
.sp-btn.walnut:hover { background: var(--walnut-2); color: #fff; box-shadow: 0 10px 22px rgba(122, 90, 62, .28); }
.sp-btn.ink { background: var(--ink); color: #fff; }
.sp-btn.ink:hover { background: var(--ink-2); color: #fff; }
.sp-btn.oak { background: var(--oak); color: var(--ink); }
.sp-btn.oak:hover { background: #bb9368; color: var(--ink); }
.sp-btn.line { border-color: var(--line-3); color: var(--muted-2); background: #fff; }
.sp-btn.line:hover { border-color: var(--oak); color: var(--ink); }
.sp-btn.danger { color: var(--red); background: #fff; border-color: #f0d6d1; }
.sp-btn.danger:hover { background: #fbeeeb; }
.sp-btn.sm { padding: 8px 13px; font-size: 13.5px; }
.sp-btn[disabled], .sp-btn.disabled { opacity: .55; pointer-events: none; }
.sp-btn.is-loading, .btn.is-loading { pointer-events: none; opacity: .75; }
.lc-spin, .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: 50%;
    border: 1px solid var(--line-3); color: var(--muted-2); background: #fff; cursor: pointer; position: relative; flex: none;
    transition: border-color .16s, color .16s;
}
.sp-icon:hover { border-color: var(--oak); color: var(--ink); }
.sp-icon i { font-size: 18px; }
.sp-icon .sp-dot {
    position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; border-radius: 999px; padding: 0 5px;
    background: #c0503c; color: #fff; font-size: 11px; line-height: 18px; text-align: center; border: 2px solid #fff;
}
.sp-icon .sp-dot:empty { display: none; }

/* ---------- ช่องกรอก ---------- */
.sp-field { display: block; }
.sp-field > span.lb { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.sp-input, .sp-field input, .sp-field select, .sp-field textarea {
    width: 100%; box-sizing: border-box; border: 1px solid var(--line-3); border-radius: 14px; padding: 12px 13px;
    font-size: 16px; font-family: var(--font); outline: none; background: #fff; color: var(--ink);
    transition: border-color .16s, box-shadow .16s;
}
.sp-input:focus, .sp-field input:focus, .sp-field select:focus, .sp-field textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(122, 90, 62, .1); }
.sp-field .locked { border: 1px solid var(--line); border-radius: 14px; background: #fafafa; padding: 12px 13px; font-size: 14.5px; color: var(--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(--muted); }
.sp-search input { border-radius: 999px; 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: 13.5px; cursor: pointer;
    border: 1px solid var(--line-3); background: #fff; color: var(--muted-2); user-select: none; transition: background .16s, color .16s, border-color .16s;
}
.sp-chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.sp-chip .n { opacity: .6; margin-left: 4px; font-size: 12px; }

/* ---------- การ์ด ---------- */
.sp-card { border: 1px solid var(--line-2); border-radius: 20px; background: #fff; padding: 14px; }
.sp-card.flush { padding: 0; overflow: hidden; }
.sp-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.sp-card-head b { font-size: 15px; font-weight: 500; }
.sp-card-title { font-size: 14.5px; font-weight: 500; }
.sp-link { font-size: 13px; color: var(--walnut); cursor: pointer; white-space: nowrap; }
.sp-muted-box { border: 1px solid var(--line-2); border-radius: 16px; background: #fff; padding: 13px; font-size: 13.5px; color: var(--muted-2); line-height: 1.6; }

.sp-badge-pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 3px 10px; font-size: 12px; white-space: nowrap; }
.st-badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 9px; font-size: 12px; white-space: nowrap; color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); }
.st-text { color: var(--c); }

/* ---------- รูป / สีตัวอย่าง ---------- */
.sp-thumb {
    display: block; width: 42px; height: 42px; border-radius: 13px; flex: none; object-fit: cover; background: #f1eee9;
    border: 1px solid rgba(36, 31, 27, .05);
}
.sp-thumb.sm { width: 28px; height: 28px; border-radius: 9px; }
.sp-thumb.md { width: 34px; height: 34px; border-radius: 11px; }
.sp-thumb.lg { width: 56px; height: 56px; border-radius: 16px; }
.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);
}

/* ============================================================
   หน้าเข้าสู่ระบบ
   ============================================================ */
.lg-wrap { min-height: 100vh; display: flex; flex-wrap: wrap; background: #fff; }
.lg-brand {
    flex: 1; min-width: 300px; box-sizing: border-box; position: relative; overflow: hidden; order: 2;
    background-color: var(--ink);
    background-image: radial-gradient(120% 80% at 100% 0%, rgba(201, 163, 122, .26), rgba(36, 31, 27, 0) 62%),
        repeating-linear-gradient(93deg, rgba(255, 255, 255, .045) 0 3px, rgba(0, 0, 0, .07) 3px 9px, rgba(0, 0, 0, .02) 9px 17px);
    padding: 22px 20px 26px; display: flex; flex-direction: column; color: #fff;
}
.lg-form { flex: 1.15; min-width: 320px; box-sizing: border-box; order: 1; padding: 24px 18px 30px; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.lg-form-in { width: 100%; max-width: 380px; }

.lg-mesh { position: absolute; inset: 0; overflow: hidden; pointer-events: none; opacity: .72; -webkit-mask-image: radial-gradient(120% 90% at 20% 10%, #000 45%, transparent 100%); mask-image: radial-gradient(120% 90% at 20% 10%, #000 45%, transparent 100%); }
.lg-mesh span { position: absolute; inset: -25%; will-change: transform; }
.lg-mesh .m1 { background: radial-gradient(42% 42% at 26% 24%, #7a5a3ecc 0%, transparent 68%); animation: meshA 17s ease-in-out infinite; }
.lg-mesh .m2 { background: radial-gradient(38% 38% at 74% 34%, #c9a37aa8 0%, transparent 66%); animation: meshB 21s ease-in-out 1.5s infinite; }
.lg-mesh .m3 { background: radial-gradient(34% 34% at 52% 82%, #e8b85680 0%, transparent 64%); animation: meshC 25s ease-in-out .8s infinite; }
.lg-mesh .wire { inset: 0; background-image: linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px); background-size: 34px 34px; animation: none; }
@keyframes meshA { 0% { transform: translate3d(-6%, -4%, 0) scale(1.1); } 50% { transform: translate3d(7%, 5%, 0) scale(1.24); } 100% { transform: translate3d(-6%, -4%, 0) scale(1.1); } }
@keyframes meshB { 0% { transform: translate3d(8%, 6%, 0) scale(1.18); } 50% { transform: translate3d(-7%, -6%, 0) scale(1.06); } 100% { transform: translate3d(8%, 6%, 0) scale(1.18); } }
@keyframes meshC { 0% { transform: translate3d(0, 8%, 0) scale(1.05); } 50% { transform: translate3d(-9%, -3%, 0) scale(1.2); } 100% { transform: translate3d(0, 8%, 0) scale(1.05); } }

.lg-brand > *:not(.lg-mesh) { position: relative; z-index: 1; }
.lg-logo { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; }
.lg-logo .mk { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--oak); color: var(--ink); font-size: 19px; font-weight: 600; }
.lg-logo img { width: 38px; height: 38px; border-radius: 12px; object-fit: contain; background: #fff; padding: 3px; }
.lg-logo b { font-size: 17px; font-weight: 500; }
.lg-title { font-size: 21px; font-weight: 500; line-height: 1.5; max-width: 380px; }
.lg-desc { color: rgba(255, 255, 255, .55); font-size: 14.5px; line-height: 1.8; margin-top: 14px; max-width: 360px; }
.lg-feats { margin-top: 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 420px; }
.lg-feat { border: 1px solid rgba(255, 255, 255, .14); border-radius: 16px; padding: 12px; background: rgba(255, 255, 255, .04); }
.lg-feat i { font-size: 19px; }
.lg-feat b { display: block; font-size: 14px; font-weight: 400; margin-top: 7px; }
.lg-feat span { display: block; color: rgba(255, 255, 255, .5); font-size: 12.5px; margin-top: 2px; }
.lg-stats { margin-top: 22px; display: flex; gap: 26px; flex-wrap: wrap; }
.lg-stats b { display: block; font-size: 23px; font-weight: 600; }
.lg-stats span { display: block; color: rgba(255, 255, 255, .5); font-size: 12.5px; }
.lg-glass {
    margin-top: 22px; max-width: 440px; position: relative; overflow: hidden; border-radius: 26px; border: 1px solid rgba(255, 255, 255, .13);
    background: rgba(255, 255, 255, .07); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 18px 44px rgba(0, 0, 0, .28);
    padding: 18px;
}
.lg-glass .gh { display: flex; align-items: center; gap: 12px; }
.lg-glass .gi { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .15); font-size: 22px; color: var(--amber); }
.lg-glass .gv { font-size: 28px; font-weight: 600; line-height: 1.1; }
.lg-glass .gl { font-size: 12.5px; color: rgba(255, 255, 255, .55); }
.lg-glass .gbar { margin-top: 16px; }
.lg-glass .gbar .row1 { display: flex; justify-content: space-between; font-size: 12.5px; color: rgba(255, 255, 255, .6); margin-bottom: 6px; }
.lg-glass .gbar .track { height: 7px; border-radius: 999px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.lg-glass .gbar .track span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #e8b856, #c9a37a); }
.lg-glass .gmini { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 16px; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 14px; text-align: center; }
.lg-glass .gmini div + div { border-left: 1px solid rgba(255, 255, 255, .1); }
.lg-glass .gmini b { display: block; font-size: 19px; font-weight: 600; }
.lg-glass .gmini span { font-size: 11.5px; color: rgba(255, 255, 255, .5); }
.lg-pills { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 14px; }
.lg-pills span { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 10px; font-size: 12px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .8); }
.lg-live { width: 8px; height: 8px; border-radius: 50%; background: #6fc79a; position: relative; }
.lg-live:after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: #6fc79a; animation: ping 1.6s cubic-bezier(0, 0, .2, 1) infinite; }
@keyframes ping { 75%, 100% { transform: scale(2.2); opacity: 0; } }
.lg-marquee { margin-top: 14px; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.lg-marquee .track { display: flex; gap: 16px; width: max-content; animation: marquee 26s linear infinite; }
.lg-marquee .track span { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: rgba(255, 255, 255, .7); white-space: nowrap; }
.lg-marquee .track i { width: 14px; height: 14px; border-radius: 5px; display: inline-block; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.lg-steps { margin-top: auto; padding-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.lg-step { flex: 1; min-width: 230px; display: flex; align-items: flex-start; gap: 10px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .07); backdrop-filter: blur(10px); border-radius: 22px; padding: 14px; }
.lg-step .av { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px; font-size: 17px; flex: none; }
.lg-step b { display: block; font-size: 13.5px; font-weight: 500; }
.lg-step small { display: block; color: rgba(255, 255, 255, .5); font-size: 12.5px; }
.lg-step p { color: rgba(255, 255, 255, .8); font-size: 12.5px; margin: 5px 0 0; line-height: 1.55; }
.lg-foot { position: relative; margin-top: auto; padding-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lg-foot span { color: rgba(255, 255, 255, .35); font-size: 13px; }
.lg-seal { width: 96px; height: 96px; position: relative; flex: none; }
.lg-seal svg { width: 100%; height: 100%; animation: spin 18s linear infinite; }
.lg-seal .core { position: absolute; inset: 26px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(from 0deg, #e8b856, #c9a37a, #7a5a3e, #e8b856); color: var(--ink); font-size: 20px; box-shadow: 0 0 0 4px rgba(36, 31, 27, .6); }
.lg-wide-only { display: none; }

.lg-tabs { display: flex; gap: 5px; background: #f1f1f3; border-radius: 999px; padding: 4px; margin-bottom: 22px; }
.lg-tabs button { flex: 1; text-align: center; border-radius: 999px; padding: 9px; font-size: 14.5px; cursor: pointer; border: 0; background: transparent; color: var(--muted-2); transition: background .18s, color .18s; }
.lg-tabs button.on { background: var(--ink); color: #fff; }
.lg-h { font-size: 21px; font-weight: 600; }
.lg-hint { font-size: 14px; color: var(--muted); margin: 4px 0 18px; }
.lg-stack { display: flex; flex-direction: column; gap: 13px; }
.lg-code { border-color: var(--ink) !important; }

.pin-wrap { position: relative; }
.pin-cells { display: flex; gap: 7px; }
.pin-cells span { flex: 1; display: grid; place-items: center; height: 46px; border: 1px solid var(--line-3); border-radius: 12px; font-size: 20px; color: var(--ink); transition: border-color .15s, transform .15s; background: #fff; }
.pin-cells span.cur { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(122, 90, 62, .1); }
.pin-cells span.fill { transform: scale(1.02); }
.pin-cells.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.pin-wrap input.pin-input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; font-size: 16px; color: transparent; caret-color: transparent; cursor: pointer; -webkit-text-security: disc; }
.pin-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pin-keys button { display: grid; place-items: center; height: 46px; border: 1px solid var(--line-3); border-radius: 14px; font-size: 18px; cursor: pointer; color: var(--ink); background: #fff; transition: background .12s, border-color .12s; }
.pin-keys button:hover { border-color: var(--oak); }
.pin-keys button:active { background: #f6f1ea; }
.pin-keys button.fn { color: var(--muted); font-size: 15px; }
.lg-pwd { display: flex; align-items: center; border: 1px solid var(--line-3); border-radius: 14px; padding: 0 13px; background: #fff; }
.lg-pwd:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(122, 90, 62, .1); }
.lg-pwd input { flex: 1; min-width: 0; border: 0 !important; box-shadow: none !important; padding: 13px 0 !important; }
.lg-eye { display: grid; place-items: center; width: 28px; height: 28px; color: var(--muted); cursor: pointer; flex: none; border: 0; background: none; }
.lg-check { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--muted-2); cursor: pointer; user-select: none; }
.lg-check input { display: none; }
.lg-check .bx { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--ink); color: #fff; transition: background .15s; }
.lg-check input:checked + .bx { background: var(--ink); }
.lg-check .bx i { font-size: 15px; opacity: 0; }
.lg-check input:checked + .bx i { opacity: 1; }
.lg-note { margin-top: 20px; border-top: 1px solid #ebebee; padding-top: 14px; font-size: 13.5px; color: var(--muted); line-height: 1.7; }
.lg-alert { background: #fbeeeb; color: #9b3f33; border-radius: 14px; padding: 10px 13px; font-size: 13.5px; display: flex; gap: 8px; align-items: flex-start; margin-bottom: 14px; }

@media (min-width: 1100px) {
    .lg-wrap { max-height: none; }
    .lg-brand { order: 0; padding: 36px 32px; min-height: 100vh; }
    .lg-form { order: 0; padding: 36px 30px; }
    .lg-title { font-size: 27px; }
    .lg-wide-only { display: block; }
    .lg-wrap { height: 100vh; overflow: hidden; }
    .lg-brand { overflow-y: auto; }
    .lg-form { overflow-y: auto; }
}
@media (max-width: 1099.98px) {
    .lg-feats, .lg-stats { display: none; }
}
@media (min-width: 1100px) and (max-height: 859px) {
    .lg-feats, .lg-stats { display: none; }
}

/* ============================================================
   พอร์ทัลเซลล์
   ============================================================ */
.sp-wrap { width: 100%; box-sizing: border-box; max-width: var(--wrap); margin: 0 auto; }

/* เมนูบน (จอกว้าง) */
.sp-topnav { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); display: none; }
.sp-topnav .sp-wrap { padding: 12px 18px; display: flex; align-items: center; gap: 14px; }
.sp-brand { display: flex; align-items: center; gap: 9px; flex: none; color: var(--ink); }
.sp-brand .mk { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--walnut); color: #fff; font-size: 16.5px; font-weight: 600; }
.sp-brand img { width: 32px; height: 32px; border-radius: 10px; object-fit: contain; }
.sp-brand b { font-size: 15px; font-weight: 500; white-space: nowrap; }
.sp-pills { flex: 1; min-width: 0; display: flex; gap: 4px; background: var(--soft); border-radius: 999px; padding: 4px; overflow-x: auto; scrollbar-width: none; }
.sp-pills::-webkit-scrollbar { display: none; }
.sp-pill { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-size: 14px; white-space: nowrap; color: var(--muted-2); transition: background .16s, color .16s; }
.sp-pill:hover { color: var(--ink); }
.sp-pill.on { background: var(--ink); color: #fff; box-shadow: 0 4px 12px rgba(36, 31, 27, .18); }
.sp-pill .bd { background: var(--oak); color: var(--ink); border-radius: 999px; padding: 0 6px; font-size: 11.5px; }
.sp-pill .bd:empty { display: none; }
.sp-cart-pill { flex: none; display: flex; align-items: center; gap: 7px; background: #fff; color: var(--ink); border: 1px solid var(--line-3); border-radius: 999px; padding: 8px 14px; font-size: 14px; cursor: pointer; white-space: nowrap; transition: border-color .16s, transform .16s; }
.sp-cart-pill:hover { border-color: var(--oak); transform: translateY(-1px); }
.sp-cart-pill .bd { background: #c0503c; color: #fff; border-radius: 999px; min-width: 20px; padding: 0 6px; font-size: 12px; line-height: 20px; text-align: center; }
.sp-cart-pill .bd:empty { display: none; }
.sp-scan-pill { flex: none; display: flex; align-items: center; gap: 8px; background: var(--ink); color: #fff; border-radius: 999px; padding: 9px 15px; font-size: 14px; cursor: pointer; white-space: nowrap; border: 0; transition: transform .16s; }
.sp-scan-pill:hover { transform: translateY(-1px); color: #fff; }
.sp-mechip { flex: none; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line-3); border-radius: 999px; padding: 4px 11px 4px 4px; color: var(--ink); }
.sp-mechip:hover { border-color: var(--oak); color: var(--ink); }
.sp-mechip .av { width: 28px; height: 28px; border-radius: 50%; background: var(--oak); object-fit: cover; display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.sp-mechip span { font-size: 13px; white-space: nowrap; }

/* หัวหน้า */
.sp-sub { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 25; }
.sp-sub .sp-wrap { padding: 14px 18px; display: flex; align-items: center; gap: 10px; }
.sp-sub .kick { font-size: 12.5px; color: var(--muted); }
.sp-sub .ttl { font-size: 19px; font-weight: 600; line-height: 1.3; }

.sp-content { padding: 16px 18px 120px; display: flex; flex-direction: column; gap: 14px; }

/* แท็บล่าง (จอแคบ) */
.sp-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(255, 255, 255, .95); backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.sp-tabbar .sp-wrap { display: flex; height: 70px; align-items: stretch; position: relative; }
.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(--muted); font-size: 12px; cursor: pointer; padding: 4px 0 0; }
.sp-tab .ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; transition: background .2s, color .2s, transform .2s; }
.sp-tab .ic i { font-size: 19px; }
.sp-tab.on { color: var(--ink); font-weight: 500; }
.sp-tab.on .ic { background: var(--tc, var(--walnut)); color: #fff; box-shadow: 0 8px 18px color-mix(in srgb, var(--tc, #7a5a3e) 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: #c0503c; color: #fff; border-radius: 999px; padding: 0 5px; font-size: 11px; line-height: 18px; }
.sp-tab .bd:empty { display: none; }
.sp-tab.scan .ic { width: 50px; height: 50px; border-radius: 17px; background: var(--ink); color: #fff; margin-top: -22px; box-shadow: 0 10px 22px rgba(36, 31, 27, .28); border: 4px solid #fff; }
.sp-tab.scan .ic i { font-size: 22px; }
.sp-tab.scan.on .ic { animation: none; }

/* แถบตะกร้า */
.sp-cartbar { position: fixed; left: 0; right: 0; bottom: calc(84px + 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(--ink); border-radius: 20px; padding: 12px 14px; pointer-events: auto; box-shadow: 0 8px 24px rgba(36, 31, 27, .22); animation: riseIn .2s ease-out; }
.sp-cartbar .tx { flex: 1; min-width: 0; color: #fff; font-size: 13.5px; line-height: 1.45; }
.sp-cartbar .tx span { color: rgba(255, 255, 255, .6); }
.sp-cartbar .thumbs { display: flex; flex: none; }
.sp-cartbar .thumbs > * { margin-left: -8px; border: 2px solid var(--ink); }
.sp-cartbar[hidden] { display: none; }

@media (min-width: 1080px) {
    .sp-topnav { display: block; }
    .sp-sub { top: 61px; }
    .sp-tabbar { display: none; }
    .sp-cartbar { bottom: 18px; }
    .sp-content { padding-bottom: 60px; }
    .sp-narrow-only { display: none !important; }
}
@media (max-width: 1079.98px) {
    .sp-wide-only { display: none !important; }
}

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

.sp-hero { background: linear-gradient(135deg, #241f1b 0%, #3b3129 55%, #5b4634 100%); border-radius: 22px; padding: 18px; color: #fff; position: relative; overflow: hidden; }
.sp-hero:before { content: ''; position: absolute; right: -46px; top: -46px; width: 150px; height: 150px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, rgba(201, 163, 122, .34), rgba(201, 163, 122, 0) 70%); }
.sp-hero > * { position: relative; }
.sp-hero .k { display: flex; align-items: center; gap: 7px; font-size: 13px; color: rgba(255, 255, 255, .6); }
.sp-hero .v { display: flex; align-items: baseline; gap: 7px; margin: 4px 0 10px; }
.sp-hero .v b { font-size: 34px; font-weight: 600; line-height: 1; }
.sp-hero .v span { font-size: 14px; color: rgba(255, 255, 255, .6); 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(--oak); }
.sp-hero .tags { display: flex; gap: 8px; flex-wrap: wrap; }
.sp-hero .tags span { background: rgba(255, 255, 255, .1); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; white-space: nowrap; }

.sp-bento { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.sp-bento > div { box-sizing: border-box; border-radius: 24px; border: 1px solid var(--line-2); background: #fff; padding: 18px; min-width: 0; overflow: hidden; }
.sp-bento .b-primary { background: var(--ink); color: #fff; border-color: var(--ink); position: relative; min-height: 180px; display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; }
.sp-bento .b-primary:before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .04) 0 2px, transparent 2px 12px); }
.sp-bento .b-primary > * { position: relative; }
.sp-bento .b-primary .tag { display: inline-flex; align-self: flex-start; background: rgba(255, 255, 255, .12); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; }
.sp-bento .b-primary .val { font-size: clamp(26px, 4vw, 44px); font-weight: 600; line-height: 1.1; margin-top: 18px; word-break: break-word; }
.sp-bento .b-primary .note { font-size: 13px; color: rgba(255, 255, 255, .6); margin-top: 8px; }
.sp-bento .b-primary .img { position: absolute; right: 14px; top: 14px; width: 70px; height: 70px; border-radius: 18px; object-fit: cover; border: 2px solid rgba(255, 255, 255, .2); }
.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, #c9a37a, #7a5a3e); }
.sp-bento .lbl { font-size: 12.5px; color: var(--muted); }
.sp-bento .big { font-size: 22px; font-weight: 600; margin-top: 4px; }
.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: 14px; background: #e8f6ee; color: var(--green); font-size: 20px; flex: none; }
@media (min-width: 1080px) {
    .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: 1079.98px) {
    .sp-bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sp-bento .b-primary { grid-column: span 2; }
}

.sp-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.sp-stat { flex: 1; min-width: 118px; border: 1px solid var(--line-2); border-radius: 16px; background: #fff; padding: 11px 12px; cursor: pointer; transition: border-color .16s, transform .16s; color: var(--ink); }
.sp-stat:hover { border-color: var(--oak); color: var(--ink); transform: translateY(-2px); }
.sp-stat.green { border-color: #dfe8e1; background: #f7faf8; }
.sp-stat .k { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.sp-stat .v { display: flex; align-items: baseline; gap: 6px; }
.sp-stat .v b { font-size: 21px; font-weight: 600; }
.sp-stat .v span { font-size: 12px; color: var(--muted); }
.sp-stat .n { font-size: 12px; color: var(--muted); }

.sp-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.sp-action { flex: 1; min-width: 150px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-3); border-radius: 16px; padding: 12px; cursor: pointer; color: var(--ink); background: #fff; transition: border-color .16s, transform .16s, box-shadow .16s; text-align: left; }
.sp-action:hover { border-color: var(--oak); transform: translateY(-2px); color: var(--ink); }
.sp-action .ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--soft); color: var(--walnut); flex: none; }
.sp-action .ic i { font-size: 19px; }
.sp-action b { display: block; font-size: 14px; font-weight: 400; }
.sp-action span.s { display: block; font-size: 12px; color: var(--muted); }
.sp-action.primary { background: var(--walnut); border-color: var(--walnut); color: #fff; }
.sp-action.primary:hover { box-shadow: 0 10px 22px rgba(122, 90, 62, .28); color: #fff; }
.sp-action.primary .ic { background: rgba(255, 255, 255, .16); color: #fff; }
.sp-action.primary span.s { color: rgba(255, 255, 255, .65); }

.sp-row { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-bottom: 1px solid #f1f1f3; cursor: pointer; transition: background .16s; color: var(--ink); }
.sp-row:last-child { border-bottom: 0; }
.sp-row:hover { background: #fcfbfa; color: var(--ink); }
.sp-row .ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; flex: none; }
.sp-row .ic i { font-size: 17px; }
.sp-row .t b { display: block; font-size: 14px; font-weight: 400; }
.sp-row .t span { display: block; font-size: 12.5px; color: var(--muted); }
.sp-row .chev { color: #d6ccc2; font-size: 14px; }

.sp-mini { display: flex; align-items: center; gap: 9px; }
.sp-mini + .sp-mini { margin-top: 9px; }
.sp-mini .nt { display: block; font-size: 11.5px; color: #a8792c; }
.sp-give-btn { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; transition: border-color .16s, background .16s; }
.sp-give-btn:hover { border-color: var(--oak); background: #faf6f1; }
.sp-give-btn i { font-size: 14px; }
.sp-pick { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; cursor: pointer; transition: border-color .16s, background .16s; }
.sp-pick + .sp-pick { margin-top: 8px; }
.sp-pick:hover { border-color: var(--oak); }
.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: 11px; color: #c4bcb4; margin-top: 3px; }
.sp-legend { display: flex; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--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: #c4bcb4; font-size: 13.5px; padding: 16px 8px; }
.sp-empty i { display: block; font-size: 30px; margin-bottom: 4px; color: #ddd4ca; }

/* ---------- แคตตาล็อก ---------- */
.sp-cover-card { border: 1px solid var(--line-2); border-radius: 22px; background: #fff; padding: 13px 8px 16px; }
.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: 22px; overflow: hidden; box-shadow: 0 22px 44px rgba(36, 31, 27, .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: 11.5px; opacity: .8; }
.cf-card .cap b { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; }
.cf-card .low { position: absolute; top: 12px; left: 12px; background: #fdeeeb; color: #c0503c; border-radius: 999px; padding: 2px 9px; font-size: 11.5px; }
.cf-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 200; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .92); border: 1px solid var(--line); display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 16px rgba(36, 31, 27, .12); color: var(--ink); }
.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: 17px; font-weight: 600; margin: 0; }
.cf-info .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.cf-meta { display: flex; justify-content: center; gap: 0; margin: 12px auto; border: 1px solid var(--line); border-radius: 16px; background: #fcfbfa; max-width: 420px; }
.cf-meta > div { flex: 1; padding: 8px 6px; }
.cf-meta > div + div { border-left: 1px solid var(--line); }
.cf-meta small { display: block; font-size: 11.5px; color: var(--muted); }
.cf-meta b { display: block; font-size: 13.5px; font-weight: 500; }
.cf-dots { display: flex; justify-content: center; gap: 5px; margin-top: 12px; }
.cf-dots i { width: 7px; height: 7px; border-radius: 999px; background: #e2dcd5; transition: width .2s, background .2s; }
.cf-dots i.on { width: 22px; background: var(--ink); }
@media (max-width: 559.98px) {
    .cf { height: 290px; }
    .cf-nav { display: none; }
}

.sp-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; }
@media (min-width: 1080px) { .sp-grid { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); } }
@media (min-width: 640px) and (max-width: 1079.98px) { .sp-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.sp-prod { display: flex; align-items: center; gap: 11px; border: 1px solid var(--line-2); border-radius: 16px; padding: 11px; background: #fff; transition: border-color .16s, box-shadow .16s; }
.sp-prod:hover { border-color: var(--oak); box-shadow: 0 6px 18px rgba(36, 31, 27, .07); }
.sp-prod.in-cart { border-color: var(--oak); background: #fbf7f1; }
.sp-prod.closed { opacity: .6; }
.sp-prod .pic { width: 56px; height: 56px; border-radius: 14px; flex: none; object-fit: cover; cursor: zoom-in; background: #f1eee9; }
.sp-prod .info { flex: 1; min-width: 0; cursor: pointer; }
.sp-prod .info b { display: block; font-size: 14.5px; font-weight: 400; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sp-prod .info span { display: block; font-size: 12.5px; color: var(--muted); }
.sp-prod .info .stk { color: var(--c, var(--muted)); }
.sp-prod .info b.sku { font-weight: 600; font-size: 14px; letter-spacing: .01em; -webkit-line-clamp: 2; line-height: 1.3; overflow-wrap: anywhere; }
.sp-prod .info .nm { color: var(--muted-2); font-size: 13.5px; }
/* กล่อง "ขอ size พิเศษ" หน้าเบิกของ */
.sp-sizereq { display: flex; align-items: center; gap: 11px; border: 1px dashed var(--oak); background: #fbf7f1; border-radius: 16px; padding: 10px 12px; }
.sp-sizereq .ic { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: #f1e6d6; color: #a8792c; font-size: 17px; }
.sp-sizereq b { display: block; font-weight: 500; font-size: 14px; }
.sp-sizereq span > span { display: block; font-size: 12.5px; color: var(--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(--line-2); margin-top: 3px; padding-top: 8px; color: var(--muted); }
.sp-holdnote i { font-size: 13px; flex: none; }
.sp-holdnote input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 13px; padding: 2px 0; color: var(--ink); }
.sp-holdnote input:focus { outline: 0; }
.sp-holdnote input::placeholder { color: #c0b8b0; }

.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: 50%; border: 1px solid var(--line-3); color: #c4bcb4; background: #fff; cursor: pointer; padding: 0; transition: all .15s; }
.sp-step button.minus.on { border-color: var(--ink); color: var(--ink); }
.sp-step button.plus { background: var(--walnut); border-color: var(--walnut); color: #fff; }
.sp-step button.plus:disabled { background: #e6ddd0; border-color: #e6ddd0; }
.sp-step button i { font-size: 15.5px; }
.sp-step input { width: 38px; text-align: center; border: 0; font-size: 15px; font-family: var(--font); padding: 4px 0; background: transparent; -moz-appearance: textfield; outline: none; }
.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; }
.sp-step.big input { width: 60px; font-size: 20px; font-weight: 600; }

.sp-more { text-align: center; padding: 10px 0; }

/* ---------- รายการของฉัน ---------- */
.sp-doc { display: flex; align-items: center; gap: 11px; border: 1px solid var(--line-2); border-radius: 16px; padding: 12px; cursor: pointer; transition: border-color .16s, box-shadow .16s; background: #fff; }
.sp-doc:hover { border-color: var(--oak); box-shadow: 0 6px 18px rgba(36, 31, 27, .07); }
.sp-doc .ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; flex: none; }
.sp-doc .ic i { font-size: 17px; }
.sp-doc .t b { display: block; font-size: 14.5px; font-weight: 500; }
.sp-doc .t span { display: block; font-size: 12.5px; color: var(--muted); }
.sp-doc .r { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: none; }
.sp-doc .r .go { font-size: 12.5px; color: var(--walnut); }
.sp-doc .t .dots { display: flex; margin-top: 5px; }
.sp-doc .t .dots > * { display: block; margin-right: -6px; border: 2px solid #fff; }
.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: 8px; }
.sp-mode label { flex: 1; border: 1px solid var(--line-3); border-radius: 16px; padding: 11px 12px; cursor: pointer; display: flex; align-items: center; gap: 10px; transition: border-color .15s, background .15s; }
.sp-mode input { display: none; }
.sp-mode label .ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--soft); color: var(--walnut); flex: none; }
.sp-mode label b { display: block; font-size: 14px; font-weight: 500; color: var(--ink); }
.sp-mode label span span { display: block; font-size: 12px; color: var(--muted); }
.sp-mode input:checked + label { border-color: var(--ink); background: #faf8f5; box-shadow: 0 0 0 1px var(--ink) inset; }
.sp-mode input:checked + label .ic { background: var(--ink); color: #fff; }
.sp-attach { border: 1px dashed #d9cdbe; border-radius: 16px; background: #fff; padding: 13px; display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: #8d857d; cursor: pointer; }
.sp-attach img { width: 54px; height: 54px; border-radius: 12px; object-fit: cover; }

/* ---------- ข้อมูลส่วนตัว ---------- */
.sp-prof { display: flex; align-items: center; gap: 13px; border: 1px solid var(--line-2); border-radius: 20px; padding: 14px; }
.sp-prof .av { width: 64px; height: 64px; border-radius: 50%; background: #f1f1f3; border: 1px solid var(--line-3); object-fit: cover; flex: none; display: grid; place-items: center; font-size: 22px; color: var(--walnut); }
.sp-toggle { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line-2); border-radius: 14px; padding: 12px 13px; cursor: pointer; }
.sp-toggle input { display: none; }
.sp-toggle .sw { display: block; width: 40px; height: 22px; border-radius: 999px; background: #e0d7cb; 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: #fff; transition: left .18s; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.sp-toggle input:checked + .sw { background: var(--walnut); }
.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: 12.5px; background: #f1eee9; color: var(--walnut); margin: 0 5px 5px 0; }
.sp-perm.off { background: #f5f5f6; color: #c4bcb4; text-decoration: line-through; }

/* ---------- แผ่นล่าง (modal) ---------- */
.sp-sheet .modal-dialog { margin: 0 auto; max-width: 540px; }
.sp-sheet .modal-content { border: 0; border-radius: 24px; }
.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: 13px; color: var(--muted); }
.sp-sheet .sh-head .t { display: block; font-size: 19px; font-weight: 600; line-height: 1.3; }
.sp-close { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-3); cursor: pointer; background: #fff; flex: none; color: var(--ink); }
.sp-lines { border: 1px solid var(--line-2); border-radius: 16px; overflow: hidden; margin-bottom: 13px; }
.sp-line { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-bottom: 1px solid #f1f1f3; }
.sp-line:last-child { border-bottom: 0; }
.sp-line .t b { display: block; font-size: 14px; font-weight: 400; }
.sp-line .t span { display: block; font-size: 12.5px; color: var(--muted); }
.sp-line .q { font-size: 14px; color: var(--muted-2); white-space: nowrap; text-align: right; }
/* รายการในใบเบิก + ช่องหมายเหตุรายแผ่น (ให้ใคร / โปรเจ็คไหน) */
.sp-item { border-bottom: 1px solid #f1f1f3; }
.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(--muted); }
.sp-linenote i { font-size: 13px; flex: none; }
.sp-linenote input { flex: 1; min-width: 0; border: 0; border-bottom: 1px dashed var(--line-2); background: transparent; font-size: 13px; padding: 3px 0; color: var(--ink); }
.sp-linenote input:focus { outline: 0; border-bottom-color: var(--ink); }
.sp-linenote input::placeholder { color: #c0b8b0; }
.sp-linenote.size { margin-top: -5px; }
.sp-linenote.size.on, .sp-linenote.size.on input { color: #a8792c; font-weight: 500; }
/* กล่อง "ให้ลูกค้าแล้ว" ใน SweetAlert */
.sw-give { text-align: left; display: flex; flex-direction: column; gap: 12px; }
.sw-give .hd { display: flex; align-items: center; gap: 10px; background: #faf8f5; border-radius: 14px; padding: 10px 12px; }
.sw-give .hd b { display: block; font-size: 14.5px; font-weight: 500; }
.sw-give .hd > span > span { display: block; font-size: 12.5px; color: var(--muted); }
.sw-give .fl > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.sw-give .fl > span i { color: var(--red); font-style: normal; }
.sw-give .fl input { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 11px 13px; font-size: 14.5px; font-family: inherit; color: var(--ink); background: #fff; }
.sw-give .fl input:focus { outline: 0; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(122, 90, 62, .1); }
.sw-give .nt { font-size: 12.5px; color: var(--muted); }
.sp-qr { border: 1px solid var(--line-2); border-radius: 18px; padding: 15px; display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 13px; }
.sp-qr .box { background: #fff; border: 1px solid var(--line-2); border-radius: 14px; 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 13px; padding: 0; }
.sp-tl li { position: relative; padding: 0 0 12px 32px; font-size: 13.5px; }
.sp-tl li:before { content: ''; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px; background: #efe9e1; }
.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: #f1eeea; color: #b3aaa1; font-size: 12px; }
.sp-tl li.done .d { background: #e4efe7; color: var(--green-2); }
.sp-tl li.bad .d { background: #f7e3df; color: var(--red); }
.sp-tl small { display: block; font-size: 12px; color: var(--muted); }
.sp-note { background: #faf8f5; border-radius: 14px; padding: 10px 12px; font-size: 13px; color: var(--muted-2); margin-bottom: 13px; }
.sp-note.red { background: #fbeeeb; color: #9b3f33; }
.sp-pimg { width: 100%; aspect-ratio: 4/3; border-radius: 20px; object-fit: cover; background: #f1eee9; margin-bottom: 14px; cursor: zoom-in; }
.sp-pimg.swatch { cursor: default; }
@media (max-width: 575.98px) {
    .sp-sheet .modal-dialog { position: fixed; bottom: 0; left: 0; right: 0; margin: 0; max-width: none; transform: translateY(40px); transition: transform .25s ease-out; }
    .sp-sheet.show .modal-dialog { transform: none; }
    .sp-sheet .modal-content { border-radius: 24px 24px 0 0; max-height: 90vh; }
    .sp-sheet .modal-body { overflow-y: auto; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}
.modal-backdrop.show { opacity: .45; background: var(--ink); }

/* การแจ้งเตือน */
.sp-noti { position: fixed; top: 70px; right: 16px; width: min(360px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto; background: #fff; border: 1px solid var(--line-2); border-radius: 20px; box-shadow: 0 18px 44px rgba(36, 31, 27, .18); z-index: 60; 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: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.sp-noti .ni { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid #f4f2ef; cursor: pointer; }
.sp-noti .ni:hover { background: #fcfbfa; }
.sp-noti .ni.unread { background: #fdf8f1; }
.sp-noti .ni .ic { width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center; flex: none; }

/* ---------- Overlay / SweetAlert ---------- */
#lcOverlay { position: fixed; inset: 0; background: rgba(255, 255, 255, .7); 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 #e6ddd0; border-top-color: var(--walnut); border-radius: 50%; animation: spin .8s linear infinite; }
#lcOverlay span { font-size: 14px; color: var(--ink); background: #fff; padding: 6px 15px; border-radius: 999px; box-shadow: 0 6px 18px rgba(36, 31, 27, .1); }

.swal2-container { z-index: 3100 !important; }
.swal2-popup { border-radius: 22px !important; font-family: var(--font) !important; }
.swal2-title { font-size: 18px !important; color: var(--ink) !important; }
.swal2-html-container { font-size: 14px !important; color: var(--muted-2) !important; line-height: 1.6 !important; }
.swal2-styled { border-radius: 999px !important; padding: 11px 22px !important; font-size: 14.5px !important; font-weight: 400 !important; box-shadow: none !important; }
.swal2-styled.swal2-confirm { background: var(--walnut) !important; }
.swal2-styled.swal2-confirm.swal2-danger { background: var(--red) !important; }
.swal2-styled.swal2-cancel { background: #fff !important; color: var(--muted-2) !important; border: 1px solid var(--line-3) !important; }
.swal2-icon { transform: scale(.8); margin-top: 18px !important; }
.swal2-input, .swal2-textarea, .swal2-select { border-radius: 14px !important; font-size: 16px !important; }
.swal2-toast { border-radius: 18px !important; max-width: min(420px, 94vw); padding: 9px 16px !important; box-shadow: 0 8px 24px rgba(36, 31, 27, .14) !important; border: 1px solid #dfe8e1 !important; }
.swal2-toast .swal2-title { font-size: 14.5px !important; font-weight: 400 !important; margin: 0 6px !important; }
.swal2-toast .swal2-icon { transform: scale(.9); margin: 0 !important; }

/* ---------- สแกนเนอร์ (โครงเดียวกับหลังบ้าน) ---------- */
.scanner-ov { position: fixed; inset: 0; background: var(--ink); 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: 420px; display: flex; align-items: center; justify-content: space-between; color: #fff; font-size: 15.5px; margin-bottom: 14px; }
.scanner-ov .sc-close { width: 34px; height: 34px; 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: 420px; aspect-ratio: 1/1; border-radius: 24px; background: #38322c; 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: 34px; height: 34px; border: 3px solid var(--oak); z-index: 3; pointer-events: none; }
.scanner-ov .sc-corner.tl { top: 14px; left: 14px; border-right: 0; border-bottom: 0; border-radius: 14px 0 0 0; }
.scanner-ov .sc-corner.tr { top: 14px; right: 14px; border-left: 0; border-bottom: 0; border-radius: 0 14px 0 0; }
.scanner-ov .sc-corner.bl { bottom: 14px; left: 14px; border-right: 0; border-top: 0; border-radius: 0 0 0 14px; }
.scanner-ov .sc-corner.br { bottom: 14px; right: 14px; border-left: 0; border-top: 0; border-radius: 0 0 14px 0; }
.scanner-ov .sc-line { position: absolute; left: 20px; right: 20px; height: 2px; background: var(--oak); opacity: .8; z-index: 3; animation: scMove 2.2s ease-in-out infinite; pointer-events: none; }
@keyframes scMove { 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, .55); padding: 30px; z-index: 2; font-size: 14px; }
.scanner-ov .sc-body { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.scanner-ov .sc-manual { display: flex; gap: 8px; }
.scanner-ov .sc-manual input { flex: 1; min-width: 0; border-radius: 999px; border: 0; padding: 12px 16px; font-size: 16px; font-family: var(--font); }
.scanner-ov .sc-manual button { border-radius: 999px; border: 0; background: var(--oak); color: var(--ink); padding: 0 18px; }
.scanner-ov .sc-note { text-align: center; color: rgba(255, 255, 255, .5); font-size: 13px; }
.scanner-ov .sc-btn { display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; padding: 13px; font-size: 14.5px; border: 1px solid rgba(255, 255, 255, .35); color: #fff; background: transparent; cursor: pointer; }
.scanner-ov .sc-btn.solid { background: var(--oak); border-color: var(--oak); color: var(--ink); }
/* ---------- ค้นหาด้วยรหัส (ผลลัพธ์ระหว่างพิมพ์) ---------- */
.scanner-ov .sc-tabs { display: flex; gap: 6px; width: 100%; max-width: 420px; background: rgba(255, 255, 255, .08); border-radius: 999px; 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: 999px; padding: 9px; background: transparent; color: rgba(255, 255, 255, .7); font-size: 14px; font-family: var(--font); }
.scanner-ov .sc-tabs button.on { background: var(--oak); color: var(--ink); }
.scanner-ov.type-only .sc-body { margin-top: 2px; }
.scanner-ov .sc-manual input { box-shadow: 0 0 0 3px rgba(201, 163, 122, .35); }
.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: 12.5px; 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: 14.5px; 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: 12.5px; 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: #fff; color: var(--ink); border-radius: 16px; padding: 10px 10px 10px 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18); transition: transform .12s, box-shadow .12s; font-family: var(--font);
}
.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: #f3f1ee; }
.scanner-ov .sc-hit .pic { flex: none; }
.scanner-ov .sc-hit .pic .sp-thumb { width: 54px; height: 54px; border-radius: 13px; }
.scanner-ov .sc-hit .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.scanner-ov .sc-hit .cd { font-size: 15.5px; font-weight: 600; letter-spacing: .01em; line-height: 1.3; overflow-wrap: anywhere; }
.scanner-ov .sc-hit .nm { font-size: 13.5px; color: var(--muted-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: 11.5px; line-height: 1; padding: 4px 8px; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 1px #e6e0d9; color: var(--muted-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: #f1e8dd; color: #7a5a3e; font-weight: 500; }
.scanner-ov .sc-hit .mt .tg.out { background: #fbe4e0; color: #b5544a; }
.scanner-ov .sc-hit .mt .tg.off { background: #eeeeee; color: #8b8681; }
.scanner-ov .sc-hit .mt .tg.wait { background: #fdf1dc; color: #a8792c; }
.scanner-ov .sc-hit .ad {
    flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
    background: var(--oak); color: var(--ink); font-size: 18px;
}
.scanner-ov .sc-hit .ad b { font-size: 14px; font-weight: 600; }
.scanner-ov .sc-hit.dim .ad { background: transparent; color: #b3aaa1; }
.scanner-ov .sc-hit mark { background: #f6e3c4; color: inherit; padding: 0 1px; border-radius: 3px; }
.scanner-ov .sc-last { background: rgba(255, 255, 255, .08); border-radius: 16px; padding: 10px 12px; color: #fff; font-size: 14px; display: none; }
.scanner-ov .sc-last.show { display: block; animation: riseIn .2s ease-out; }
.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; }

/* ---------- ตัวช่วยจาก bootstrap ที่ปรับสี ---------- */
.form-check-input:checked { background-color: var(--walnut); border-color: var(--walnut); }
.form-control:focus, .form-select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(122, 90, 62, .1); }

/* ---------- ตารางรายการของฉัน (แบบรายงาน) ---------- */
.sp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sp-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
.sp-table th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--muted); padding: 10px 12px; background: #faf8f5; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.sp-table td { padding: 9px 12px; border-bottom: 1px solid #f1f1f3; vertical-align: top; }
.sp-table tr[data-doc] { cursor: pointer; }
.sp-table tr[data-doc]:hover td { background: #fcfaf7; }
.sp-table tr.first td { border-top: 1px solid var(--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: 11.5px; color: var(--muted); }
.sp-table td.no { white-space: nowrap; }
.sp-table td.no b { font-weight: 600; }
.sp-table td.it b { font-weight: 600; }
.sp-table td.it span { color: var(--muted-2); }
.sp-table td.it small.req { color: #a8792c; font-weight: 500; }
.sp-table td.pj { max-width: 220px; }
.sp-table .sp-badge-pill { white-space: nowrap; }

/* แจ้งเตือนข้อมูลส่วนตัวไม่ครบ */
.sp-profile-need { display: flex; align-items: center; gap: 11px; background: #fbeeeb; color: #9b3f33; border-radius: 16px; padding: 11px 14px; margin-bottom: 12px; }
.sp-profile-need:hover { color: #7e2f25; }
.sp-profile-need > i:first-child { font-size: 22px; }
.sp-profile-need b { display: block; font-weight: 500; }
.sp-profile-need span > span { display: block; font-size: 12.5px; opacity: .85; }


/* ---------- สลับ วัสดุตัวอย่าง / แคตตาล็อก ---------- */
.sp-seg { display: flex; gap: 4px; background: var(--soft); border-radius: 999px; padding: 4px; }
.sp-seg a, .sp-seg button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; border: 0; background: transparent; border-radius: 999px; padding: 9px 10px; font-size: 14px; color: var(--muted-2); white-space: nowrap; cursor: pointer; font-family: var(--font); transition: background .16s, color .16s; }
.sp-seg a:hover, .sp-seg button:hover { color: var(--ink); }
.sp-seg .on { background: #fff; color: var(--ink); font-weight: 500; box-shadow: 0 2px 10px rgba(36, 31, 27, .1); }
.sp-seg .n { background: var(--oak); color: var(--ink); border-radius: 999px; padding: 0 7px; font-size: 11.5px; line-height: 18px; }
.sp-seg .n:empty { display: none; }

/* ---------- การ์ดแคตตาล็อก (ปกแนวตั้ง) ---------- */
.sp-prod.cat .pic { width: 54px; height: 72px; border-radius: 10px; }
.sp-prod.cat .info .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-empty { display: grid !important; place-items: center; background: #f3ede5 !important; color: #b99b7b; 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: 11.5px; line-height: 1; padding: 4px 8px; border-radius: 999px; background: #fdf3e0; color: #a8792c; font-weight: 500; vertical-align: 1px; }
