/* =========================================================
   HITTONIC — หลังบ้านเว็บร้าน · admin.css
   ========================================================= */
:root {
  --black: #0b0b0c; --ink: #18181b; --ink-2: #2a2a2f; --bg: #f4f4f6; --line: #e6e6ea; --muted: #71717a;
  --red: #e10a2f; --red-2: #b8061f; --red-soft: #fdecef;
  --green: #15803d; --green-soft: #e7f6ec; --yellow: #a16207; --yellow-soft: #fff6df; --blue: #1d4ed8; --blue-soft: #e8efff; --gray-soft: #efeff2;
  --radius: 16px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.05);
  --font: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  --head: "Chakra Petch", "IBM Plex Sans Thai", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
body.no-scroll { overflow: hidden; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
a { color: var(--red); }
img { max-width: 100%; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i { width: 17px; height: 17px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button, a, input, select, textarea, [role=button] { touch-action: manipulation; }

input, select, textarea { font: inherit; color: var(--ink); background: #fff; width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 13px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(225,10,47,.12); }
label { display: block; font-size: 13.5px; font-weight: 600; margin: 14px 0 6px; color: var(--ink-2); }
.form > label:first-child, .form > div:first-child label { margin-top: 0; }
@media (max-width: 760px) { input, select, textarea { font-size: 16px; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: 14.5px; border: 0; border-radius: 12px; padding: 11px 18px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .08s, background .15s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-2); }
.btn-dark { background: var(--black); color: #fff; }
.btn-outline { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn-danger-soft { background: var(--red-soft); color: var(--red); }
.btn-line { background: #06c755; color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 13.5px; border-radius: 10px; }
.btn-lg { padding: 14px 20px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 0; background: rgba(255,255,255,.08); color: #fff; cursor: pointer; text-decoration: none; }
.icon-btn-light { background: var(--gray-soft); color: var(--ink-2); width: 34px; height: 34px; }

/* login */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(ellipse at 50% 0%, rgba(225,10,47,.25), transparent 60%), var(--black); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 22px; padding: 28px 24px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.6); }
.login-logo { width: 150px; height: auto; margin: -4px auto 14px; display: block; filter: invert(1); }
.login-card h1 { font-family: var(--head); font-size: 24px; text-align: center; }
.login-card > p { text-align: center; margin: 4px 0 8px; }
.login-card .btn { margin-top: 20px; }
.login-back { display: block; text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); text-decoration: none; }

/* topbar */
.topbar { position: sticky; top: 0; z-index: 40; height: 58px; background: var(--black); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; }
.tb-brand { display: flex; align-items: center; gap: 9px; font-family: var(--head); font-weight: 700; font-size: 18px; letter-spacing: 1px; }
.tb-brand img { width: 40px; height: auto; }
.tb-brand em { color: var(--red); font-style: normal; }
.tb-brand small { font-family: var(--font); font-size: 11.5px; font-weight: 600; background: var(--red); padding: 2px 8px; border-radius: 999px; letter-spacing: 0; }
.tb-right { display: flex; align-items: center; gap: 8px; }
.tb-name { font-size: 13px; color: #d4d4d8; max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* layout */
.app { display: grid; grid-template-columns: 1fr; min-height: calc(100vh - 58px); }
.side { display: none; }
.main { padding: 16px 14px calc(96px + var(--safe-b)); min-width: 0; max-width: 1100px; width: 100%; margin: 0 auto; }
@media (min-width: 1024px) {
  .app { grid-template-columns: 230px 1fr; }
  .side { display: flex; flex-direction: column; gap: 4px; background: #fff; border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 58px; height: calc(100vh - 58px); }
  .side button { border: 0; background: none; font: inherit; font-size: 14.5px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; cursor: pointer; position: relative; }
  .side button:hover { background: var(--gray-soft); color: var(--ink); }
  .side button.active { background: var(--black); color: #fff; }
  .side .badge { margin-left: auto; }
  .main { padding: 26px 30px 60px; }
  .bnav { display: none !important; }
}
.bnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; background: rgba(255,255,255,.97); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(7, 1fr); padding: 6px 2px calc(6px + var(--safe-b)); }
.bnav button { position: relative; border: 0; background: none; font: inherit; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: #8b8b94; font-size: 11px; font-weight: 600; cursor: pointer; white-space: nowrap; min-width: 0; }
.bnav button svg { width: 23px; height: 23px; }
.bnav button.active { color: var(--red); }
body.kb-open .bnav { display: none; }
.badge { font-style: normal; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; }
.badge-dot { position: absolute; top: 0; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 10.5px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--head); font-size: 25px; }
.page-head p { margin: 2px 0 0; font-size: 14px; }
@media (max-width: 520px) { .page-head > .btn { width: 100%; } }
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { font-size: 16px; }
.empty { text-align: center; color: var(--muted); padding: 30px 12px; background: #fff; border-radius: var(--radius); border: 1.5px dashed #d4d4d8; font-size: 14.5px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 520px) { .row-2 { grid-template-columns: 1fr; gap: 0; } .row-3 { grid-template-columns: 1fr 1fr; gap: 0 10px; } .row-3 > div:last-child { grid-column: 1 / -1; } }
.form-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
@media (max-width: 520px) { .form-foot .btn { width: 100%; } }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14.5px; cursor: pointer; margin: 14px 0 4px; }
.check input { width: 20px; height: 20px; accent-color: var(--red); flex: none; }
.check svg { color: #eab308; }
.search { margin-bottom: 10px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 13px center / 18px; padding-left: 40px; }
.seg { display: flex; gap: 4px; background: #e9e9ee; padding: 4px; border-radius: 12px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.seg button { flex: 1; border: 0; background: transparent; font: inherit; font-size: 14px; font-weight: 600; padding: 8px 10px; border-radius: 9px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.seg em { font-style: normal; background: var(--red); color: #fff; font-size: 11.5px; border-radius: 999px; padding: 0 6px; margin-left: 2px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-yellow { background: var(--yellow-soft); color: var(--yellow); }
.pill-gray { background: var(--gray-soft); color: #52525b; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.kpi { background: #fff; border-radius: 14px; padding: 12px; box-shadow: var(--shadow); border-top: 4px solid var(--red); }
.kpi b { display: block; font-family: var(--head); font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--muted); font-weight: 600; }
.k-warn { border-top-color: #eab308; }
.k-dark { background: var(--black); color: #fff; border-top-color: var(--black); }
.k-dark span { color: #a1a1aa; }
@media (max-width: 420px) { .kpi b { font-size: 19px; } }

/* order cards */
.olist, .llist { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .olist { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ocard { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 14px; cursor: pointer; border: 1.5px solid transparent; display: grid; gap: 8px; }
.ocard:hover { border-color: #e4e4e7; }
.ocard:focus-visible { outline: 2px solid var(--red); }
.ocard.is-done { opacity: .75; }
.o-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.o-no { font-family: var(--head); font-weight: 700; color: var(--red); flex: none; }
.o-title { flex: 1; min-width: 0; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.due svg { width: 14px; height: 14px; }
.due-soon { color: var(--yellow); }
.due-late { color: var(--red); }
.o-cust { font-size: 13.5px; color: var(--muted); }
.o-code { font-family: var(--head); font-weight: 600; color: var(--ink-2); background: var(--gray-soft); padding: 0 6px; border-radius: 6px; margin-left: 4px; }
.stepbar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.stepbar i { height: 6px; border-radius: 3px; background: #ececf0; }
.stepbar i.on { background: var(--red); }
.is-done .stepbar i.on { background: var(--green); }
.o-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.step-pill { font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--red-soft); color: var(--red); }
.step-pill.s5 { background: var(--green-soft); color: var(--green); }
.o-remain { font-size: 13px; font-weight: 600; color: var(--yellow); }
.o-paid { font-size: 13px; font-weight: 600; color: var(--green); }
.o-next { margin-left: auto; }

/* order sheet */
.os-head small { color: var(--muted); font-size: 13px; }
.os-head small b { font-family: var(--head); color: var(--ink); letter-spacing: .5px; }
.os-head h3 { font-size: 20px; margin: 2px 40px 6px 0; }
.os-cust { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-weight: 600; }
.chip-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--gray-soft); color: var(--ink); text-decoration: none; }
.chip-btn svg { width: 15px; height: 15px; }
.chip-line { background: #06c755; color: #fff; }
.step-pick { display: grid; gap: 6px; }
.step-pick button { display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 10px 12px; font: inherit; cursor: pointer; text-align: left; min-height: 54px; }
.sp-n { width: 30px; height: 30px; border-radius: 50%; background: var(--gray-soft); color: var(--muted); display: grid; place-items: center; font-weight: 700; font-family: var(--head); flex: none; }
.sp-n svg { width: 16px; height: 16px; stroke-width: 3; }
.sp-t b { display: block; font-size: 15px; }
.sp-t small { color: var(--muted); font-size: 12px; }
.step-pick button.done { border-color: #f6c3cc; }
.step-pick button.done .sp-n { background: var(--red); color: #fff; }
.step-pick button.now { border-color: var(--red); background: var(--red-soft); box-shadow: 0 0 0 1px var(--red) inset; }
.step-pick button.now .sp-n { background: #fff; color: var(--red); box-shadow: 0 0 0 2px var(--red); }
.msg-row { display: flex; gap: 8px; align-items: stretch; }
.msg-row textarea { flex: 1; }
.os-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.os-grid div { background: var(--gray-soft); border-radius: 12px; padding: 9px 11px; }
.os-grid small { display: block; color: var(--muted); font-size: 12px; }
.os-grid b { font-size: 15px; }
.os-grid .warn { background: var(--yellow-soft); } .os-grid .warn b { color: var(--yellow); }
.os-grid .ok { background: var(--green-soft); } .os-grid .ok b { color: var(--green); }
@media (max-width: 520px) { .os-grid { grid-template-columns: 1fr 1fr; } }
.os-box { background: var(--gray-soft); border-radius: 12px; padding: 10px 12px; margin-top: 10px; font-size: 14px; }
.os-box small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; margin-bottom: 2px; }
.os-note { background: var(--yellow-soft); }
.os-actions { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; margin: 16px 0 8px; }
@media (max-width: 420px) { .os-actions { grid-template-columns: 1fr 1fr; } .os-actions .btn-red { grid-column: 1 / -1; } }

/* share code */
.done-top { display: flex; align-items: center; gap: 8px; color: var(--green); font-size: 17px; margin-bottom: 8px; }
.done-top svg { width: 26px; height: 26px; stroke-width: 3; }
.code-box { background: var(--black); color: #fff; border-radius: 18px; padding: 18px; text-align: center; margin: 8px 0 12px; }
.code-box small { color: #a1a1aa; font-size: 12.5px; }
.code-box > b { display: block; font-family: var(--head); font-size: 38px; letter-spacing: 4px; color: #fff; }
.code-box span { display: block; color: #d4d4d8; font-size: 13.5px; margin-bottom: 10px; }
.code-box img { width: 168px; height: 168px; margin: 0 auto; border-radius: 10px; background: #fff; image-rendering: pixelated; }
.share-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* leads */
.lcard { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 14px; display: grid; gap: 8px; }
.l-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.l-top b { font-size: 16px; }
.l-top small { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.l-work { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink-2); }
.l-work svg { width: 16px; height: 16px; color: var(--red); }
.l-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.l-facts em { font-style: normal; font-size: 12.5px; background: var(--gray-soft); padding: 2px 9px; border-radius: 999px; }
.l-msg { font-size: 14px; background: #fafafa; border-left: 3px solid var(--red); padding: 8px 10px; border-radius: 8px; }
.l-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.l-actions .icon-btn-light { margin-left: auto; }
.menu-list { display: grid; gap: 6px; margin-top: 12px; }
.menu-list button { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 13px 14px; font: inherit; font-weight: 600; text-align: left; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.menu-list .danger { color: var(--red); background: var(--red-soft); border-color: transparent; }

/* works */
.wlist { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.wcard { background: #fff; border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; cursor: pointer; }
.wcard.is-draft { opacity: .7; }
.wimg { position: relative; aspect-ratio: 4 / 3; background: #1b1b20; display: grid; place-items: center; color: #55555f; }
.wimg img { width: 100%; height: 100%; object-fit: cover; }
.wimg span svg { width: 40px; height: 40px; }
.wstar { position: absolute; top: 8px; left: 8px; background: #eab308; color: #fff; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; }
.wstar svg { width: 16px; height: 16px; fill: #fff; }
.wbody { padding: 12px; display: grid; gap: 4px; }
.wbody b { font-size: 15px; }
.wbody small { color: var(--muted); font-size: 12.5px; }
.wbody .pill { justify-self: start; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 8px; }
.img-tile { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--gray-soft); border: 2px solid transparent; }
.img-tile.is-cover { border-color: #eab308; }
.img-tile img { width: 100%; height: 100%; object-fit: cover; }
.img-tile button { position: absolute; top: 4px; width: 30px; height: 30px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: rgba(0,0,0,.6); color: #fff; }
.img-tile button svg { width: 16px; height: 16px; }
.it-star { left: 4px; }
.is-cover .it-star { background: #eab308; }
.is-cover .it-star svg { fill: #fff; }
.it-del { right: 4px; }
.it-cap { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(234,179,8,.92); color: #fff; font-size: 11.5px; font-weight: 700; text-align: center; padding: 2px 0; }
.file-pick { display: flex !important; align-items: center; justify-content: center; gap: 10px; border: 2px dashed #cfcfd6; border-radius: 14px; padding: 16px; cursor: pointer; font-weight: 600; color: var(--ink-2); margin: 0 !important; background: #fafafa; text-align: center; }
.file-pick svg { color: var(--red); width: 24px; height: 24px; }
.tick-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.tick { margin: 0 !important; font-weight: 500 !important; cursor: pointer; }
.tick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tick span { display: inline-block; border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; background: #fff; }
.tick input:checked + span { background: var(--black); border-color: var(--black); color: #fff; }
.tick input:focus-visible + span { outline: 2px solid var(--red); }
.toggles { display: grid; gap: 0; margin-top: 6px; }

/* settings */
.site-link { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.site-link img { width: 132px; height: 132px; border-radius: 12px; border: 1px solid var(--line); image-rendering: pixelated; background: #fff; }
.site-link b { font-size: 15px; word-break: break-all; }
.site-link > div { flex: 1; min-width: 200px; }
.staff-list { display: grid; gap: 6px; }
.staff { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); margin: 0; cursor: pointer; font-weight: 500; }
.staff:last-child { border-bottom: 0; }
.av { width: 38px; height: 38px; border-radius: 50%; background: var(--black); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.st-mid { flex: 1; min-width: 0; }
.st-mid b { display: block; }
.st-mid small { color: var(--muted); }
.switch { appearance: none; -webkit-appearance: none; width: 48px !important; height: 28px; padding: 0 !important; border-radius: 999px; background: #d4d4d8; border: 0 !important; position: relative; cursor: pointer; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(11,11,12,.55); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal-box { position: relative; background: #fff; width: 100%; max-width: 520px; max-height: 94vh; max-height: 94dvh; overflow-y: auto; overscroll-behavior: contain; border-radius: 22px 22px 0 0; padding: 20px 18px calc(20px + var(--safe-b)); animation: up .2s ease-out; }
.modal-wide { max-width: 720px; }
.modal-box h3 { font-size: 19px; margin-bottom: 4px; }
.modal-actions { display: flex; gap: 8px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
.modal-actions .btn-danger-soft { flex: 0 0 auto; }
.mclose { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--gray-soft); display: grid; place-items: center; cursor: pointer; color: var(--ink); z-index: 2; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@media (min-width: 640px) { .modal { align-items: center; padding: 16px; } .modal-box { border-radius: 20px; } }

/* toast / loading */
.toast { position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); transform: translate(-50%, 12px); width: max-content; max-width: calc(100vw - 32px); background: var(--black); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; z-index: 300; opacity: 0; pointer-events: none; transition: all .22s; box-shadow: 0 10px 30px rgba(0,0,0,.2); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
@media (min-width: 1024px) { .toast { bottom: 24px; } }
.loading { position: fixed; inset: 0; background: rgba(255,255,255,.55); display: grid; place-items: center; z-index: 250; }
.spinner { width: 38px; height: 38px; border: 4px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.topbar { gap: 8px; min-width: 0; }
.tb-brand { min-width: 0; flex: none; }
.tb-right { min-width: 0; }
.tb-name { min-width: 0; }
@media (max-width: 480px) { .tb-name { display: none; } }

/* =========================================================
   ร้านค้า · สินค้า · ออเดอร์เว็บ · ยอดขาย
   ========================================================= */
.tb-pos { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border-radius: 10px; background: var(--red); color: #fff; text-decoration: none; font-weight: 700; font-size: 14px; }
.tb-pos svg { width: 18px; height: 18px; }
.side-links { margin-top: auto; display: grid; gap: 6px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; color: var(--ink-2) !important; text-decoration: none; font-weight: 600; font-size: 14px; border: 1.5px solid var(--line); }
.side-link:hover { background: var(--gray-soft); }
.side-pos { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: var(--red); color: #fff !important; text-decoration: none; font-weight: 700; font-size: 14.5px; }
.badge-warn { background: #eab308; }
.head-btns { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 520px) { .head-btns { width: 100%; } .head-btns .btn { flex: 1; padding-left: 10px; padding-right: 10px; } }
.kpis-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { .kpis-4 { grid-template-columns: 1fr 1fr; } }
.k-gray { border-top-color: #a1a1aa; }
.k-green { border-top-color: var(--green); }
.k-green b { color: var(--green); }
.seg em { font-style: normal; }
.seg .em-gray { background: #a1a1aa; }
.p-tools { display: grid; grid-template-columns: 1fr 220px; gap: 8px; }
@media (max-width: 640px) { .p-tools { grid-template-columns: 1fr; gap: 0; } .p-tools select { margin-bottom: 10px; } }
.p-tools select { height: 46px; }

.plist { display: grid; gap: 6px; }
.prow { position: relative; display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 8px 12px 8px 8px; cursor: pointer; border: 1.5px solid transparent; }
.prow:hover { border-color: #e4e4e7; }
.prow:has(.pcam) { padding-right: 58px; }
.pimg { width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; }
.pimg img { width: 100%; height: 100%; object-fit: contain; }
.pph { width: 100%; height: 100%; display: grid; place-items: center; color: #fff; font-family: var(--head); font-weight: 700; font-size: 15px; }
.pmid { min-width: 0; }
.pmid b { display: block; font-size: 14.5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pmid small { color: var(--muted); font-size: 12.5px; }
.pmid .hid { font-style: normal; color: var(--yellow); font-weight: 600; }
.pright { display: grid; justify-items: end; gap: 4px; text-align: right; }
.pright b { font-family: var(--head); font-size: 16px; white-space: nowrap; }
.stk { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--gray-soft); color: #52525b; white-space: nowrap; }
.stk.low { background: var(--yellow-soft); color: var(--yellow); }
.stk.out { background: var(--red-soft); color: var(--red); }
.plink { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px; border-radius: 999px; border: 1px solid #e4e4e7; background: #fff; color: #3f3f46; font: 600 12px var(--head, inherit); cursor: pointer; }
.plink svg { width: 13px; height: 13px; }
.plink:hover { border-color: var(--red); color: var(--red); }
.pcam { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 12px; border: 1.5px dashed #d4d4d8; background: #fafafa; color: var(--red); display: grid; place-items: center; cursor: pointer; }

.ph-edit { display: flex; gap: 14px; align-items: center; }
.ph-prev { width: 110px; height: 110px; border-radius: 14px; border: 1.5px dashed #d4d4d8; background: #fafafa; overflow: hidden; display: grid; place-items: center; flex: none; }
.ph-prev img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.ph-prev span { display: grid; justify-items: center; gap: 4px; color: var(--muted); font-size: 12px; text-align: center; }
.ph-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ph-btns label.btn { margin: 0; }
.ph-btns small { flex-basis: 100%; }
.stock-now { display: flex; align-items: center; gap: 10px; height: 46px; }
.stock-now b { font-family: var(--head); font-size: 24px; }
.big-num { font-family: var(--head); font-size: 26px; text-align: right; }

.imp-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.imp-sum div { background: var(--gray-soft); border-radius: 12px; padding: 10px; text-align: center; }
.imp-sum b { display: block; font-family: var(--head); font-size: 24px; }
.imp-sum small { color: var(--muted); font-size: 12px; }
.imp-prev { display: grid; gap: 4px; background: #fafafa; border-radius: 12px; padding: 10px 12px; font-size: 13.5px; }
.imp-prev div { display: flex; flex-direction: column; border-bottom: 1px dashed var(--line); padding-bottom: 4px; }
.imp-prev small { color: var(--muted); font-size: 12px; }

/* ออเดอร์เว็บ */
.wolist { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .wolist { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.wocard { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 14px; display: grid; gap: 8px; border-left: 5px solid var(--red); }
.wocard.st-confirmed { border-left-color: #eab308; }
.wocard.st-paid { border-left-color: var(--blue); }
.wocard.st-done { border-left-color: var(--green); opacity: .85; }
.wocard.st-cancelled { border-left-color: #a1a1aa; opacity: .7; }
.pill-blue { background: var(--blue-soft); color: var(--blue); }
.wo-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wo-top small { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.wo-cust { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wo-cust b { font-size: 15.5px; margin-right: 2px; }
.wo-addr { font-size: 13.5px; background: var(--gray-soft); border-radius: 10px; padding: 8px 10px; }
.wo-items { display: grid; gap: 2px; font-size: 14px; }
.wo-items div { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; border-bottom: 1px dashed var(--line); padding: 3px 0; }
.wo-items em { font-style: normal; color: var(--muted); }
.wo-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wo-total { font-family: var(--head); font-size: 22px; }
.wo-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.cf-head, .cf-line { display: grid; grid-template-columns: 1fr 80px 100px; gap: 8px; align-items: center; }
.cf-head { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 10px; }
.cf-line { padding: 8px 0; border-bottom: 1px solid var(--line); }
.cf-line b { display: block; font-size: 14px; }
.cf-line small { color: var(--muted); font-size: 12px; }
.cf-line small em { color: var(--red); font-style: normal; font-weight: 700; }
.cf-line.miss { opacity: .6; }
.cf-line input { padding: 8px; text-align: right; }
.cf-sum { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-weight: 600; }
.cf-sum b { font-family: var(--head); font-size: 24px; }
.pay-big { text-align: center; margin: 8px 0 12px; }
.pay-big small { color: var(--muted); }
.pay-big b { display: block; font-family: var(--head); font-size: 40px; }

/* ยอดขาย */
.date-row { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; }
.date-row input { max-width: 180px; }
.date-row span { color: var(--muted); font-size: 14px; }
.pay-split { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.pay-split div { background: #fff; border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); }
.pay-split small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.pay-split b { font-family: var(--head); font-size: 17px; }
@media (max-width: 640px) { .pay-split { grid-template-columns: 1fr 1fr; } }
.day-bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding-top: 16px; overflow-x: auto; }
.day-bar { flex: 1; min-width: 22px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; position: relative; }
.day-bar i { width: 100%; max-width: 34px; background: var(--red); border-radius: 6px 6px 2px 2px; }
.day-bar small { font-size: 11px; color: var(--muted); }
.day-bar em { position: absolute; top: -2px; font-style: normal; font-size: 10px; color: var(--ink-2); font-weight: 600; }
.top-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; }
.tr-n { font-family: var(--head); font-weight: 700; color: var(--red); }
.tr-mid b { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-mid i { display: block; height: 6px; border-radius: 3px; background: var(--red); opacity: .8; margin-top: 4px; }
.tr-v { text-align: right; font-weight: 700; font-size: 14px; }
.tr-v small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.bill-rows { display: grid; }
.bill-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.bill-row:last-child { border-bottom: 0; }
.bill-row > div { min-width: 0; }
.bill-row b { font-family: var(--head); }
.bill-row small { display: block; color: var(--muted); font-size: 12.5px; }
.bill-row .bill-items { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bill-row > span { display: flex; align-items: center; gap: 6px; flex: none; font-size: 16px; }
.bill-row.void { opacity: .55; }
.bill-row.void > span b { text-decoration: line-through; }
.rc-wrap { background: #e9e9ee; border-radius: 14px; padding: 14px; max-height: 60vh; overflow-y: auto; margin-top: 8px; }
.rc-wrap canvas { display: block; width: 100%; max-width: 300px; margin: 0 auto; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.moves { display: grid; gap: 8px; margin-top: 10px; }
.mv { background: var(--gray-soft); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; }
.mv-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mv-top small { margin-left: auto; color: var(--muted); font-size: 12px; }
.mv-items { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; }
.mv-items .neg b { color: var(--red); }
.mv-items .pos b { color: var(--green); }
@media (max-width: 480px) { .tb-pos span { display: none; } .tb-pos { padding: 0 10px; } }

@media (max-width: 480px) { .tb-right { gap: 5px; } .tb-right .icon-btn { width: 34px; } }

/* =========================================================
   หน้าการเงิน (finance.html)
   ========================================================= */
body.fin { background: var(--bg); }
.fin-main { max-width: 1180px; padding-bottom: 60px; }
.deny-ic { width: 64px; height: 64px; border-radius: 50%; background: var(--black); color: #fff; display: grid; place-items: center; margin: 0 auto 12px; }
.deny-ic svg { width: 30px; height: 30px; }
.login-card.center { text-align: center; }
.login-card.center .btn { margin-top: 16px; }
.pin-card { text-align: center; max-width: 360px; }
.pin-card h1 { font-family: var(--head); font-size: 24px; }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 18px 0 20px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #c4c4cc; transition: all .12s; }
.pin-dots i.on { background: var(--red); border-color: var(--red); transform: scale(1.1); }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pin-pad button { height: 64px; border-radius: 16px; border: 0; background: var(--gray-soft); font-family: var(--head); font-size: 26px; font-weight: 700; color: var(--ink); cursor: pointer; }
.pin-pad button:active { background: #dcdce2; transform: scale(.96); }
.pin-pad .pk-sm { font-family: var(--font); font-size: 13.5px; font-weight: 600; color: var(--muted); background: transparent; }
.kpi.k-neg b { color: var(--red); }
.fin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .fin-grid { grid-template-columns: 1fr; gap: 0; } }
.bar-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; }
.bar-row i { display: block; height: 10px; border-radius: 5px; background: var(--black); }
.bar-row.bar-out i { background: #eab308; }
.bar-row b { font-family: var(--head); min-width: 90px; text-align: right; }
@media (max-width: 520px) { .bar-row { grid-template-columns: 1fr auto; } .bar-row i { grid-column: 1 / -1; grid-row: 2; } }
.pay-3 { grid-template-columns: repeat(3, 1fr) !important; margin: 12px 0 0; }
.pay-3 div { box-shadow: none; background: var(--gray-soft); }
.month-card { background: var(--black); color: #fff; }
.month-card .card-head h2 { color: #fff; }
.mc-flow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mc-flow > div { background: rgba(255,255,255,.07); border-radius: 12px; padding: 10px 14px; min-width: 130px; flex: 1; }
.mc-flow small { display: block; color: #a1a1aa; font-size: 12px; }
.mc-flow b { font-family: var(--head); font-size: 20px; }
.mc-flow em { font-style: normal; color: #71717a; font-size: 20px; font-weight: 700; }
.mc-flow .mc-total { background: var(--red); }
.mc-flow .mc-total small { color: #ffd0d8; }
.mc-foot { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 10px; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid #2a2a31; }
.mc-foot small { display: block; color: #a1a1aa; font-size: 12px; }
.mc-foot b { font-family: var(--head); font-size: 19px; }
@media (max-width: 720px) { .mc-foot { grid-template-columns: 1fr 1fr; } .mc-foot .btn { grid-column: 1 / -1; } .mc-flow em { display: none; } }
.pos { color: var(--green); } .neg { color: var(--red); }
.month-card .pos { color: #86efac; } .month-card .neg { color: #ff8fa3; }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: right; color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 6px 8px; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
.tbl td { text-align: right; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; }
.shift-list, .ledger-list { display: grid; }
.shift-row, .ld-row { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.shift-row:last-child, .ld-row:last-child { border-bottom: 0; }
.shift-row > div:first-child, .ld-mid { flex: 1; min-width: 0; }
.shift-row b, .ld-mid b { display: block; font-size: 14.5px; }
.shift-row small, .ld-mid small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.sr-right { display: grid; justify-items: end; gap: 3px; text-align: right; }
.sr-right small { color: var(--muted); font-size: 12px; }
.seg-sm { margin: 0; flex: none; }
.seg-sm button { padding: 6px 10px; font-size: 13px; flex: none; }
.card-head:has(.seg-sm) { flex-wrap: wrap; }
.ld-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.ld-ic.in { background: var(--green-soft); color: var(--green); }
.ld-ic.out { background: var(--yellow-soft); color: var(--yellow); }
.ld-amt { font-family: var(--head); font-size: 16px; white-space: nowrap; }
.ld-amt.in { color: var(--green); } .ld-amt.out { color: var(--ink); }
.ld-row.void { opacity: .45; } .ld-row.void .ld-amt { text-decoration: line-through; }
.mh-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.mh-row:last-child { border-bottom: 0; }
.mh-row b { font-size: 15px; }
.mh-row small { display: block; color: var(--muted); font-size: 12.5px; }
.mh-row .mh-top { color: var(--ink-2); }
.mh-right { text-align: right; flex: none; }
.mh-right b { font-family: var(--head); font-size: 19px; display: block; }
.mh-right small.pos { color: var(--green); } .mh-right small.neg { color: var(--red); }
.cm-sum { display: grid; gap: 6px; margin: 10px 0 4px; }
.cm-sum div { display: flex; justify-content: space-between; padding: 9px 12px; background: var(--gray-soft); border-radius: 10px; }
.cm-sum b { font-family: var(--head); }
.cm-sum .hl { background: var(--green-soft); color: var(--green); }
.chip-pick { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 13px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.chip-pick.on { background: var(--black); color: #fff; border-color: var(--black); }
.bill-img { width: 100%; max-height: 300px; object-fit: contain; border-radius: 12px; background: var(--gray-soft); margin-bottom: 8px; }
.date-row .btn { margin-left: auto; }
.bill-scroll { max-height: 520px; overflow-y: auto; }

/* ชุดเซ็ต · สินค้าแนะนำ */
.tag-kit, .tag-feat { display: inline-flex; align-items: center; gap: 3px; font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-right: 6px; vertical-align: 2px; }
.tag-kit { background: rgba(234,179,8,.15); color: #fcd34d; }
.tag-feat { background: var(--red-soft, rgba(225,10,47,.14)); color: #ff8fa3; }
.tag-feat svg { width: 11px; height: 11px; }
.pright s { font-weight: 500; font-size: 12px; }
.kit-items { display: grid; gap: 6px; }
.kit-row { display: grid; grid-template-columns: 44px 1fr 70px 36px; gap: 10px; align-items: center; padding: 6px; border: 1px solid var(--line, #26262b); border-radius: 12px; }
.kit-row .pimg { width: 44px; height: 44px; }
.kit-row input { text-align: center; padding: 8px 4px; }
.kit-add { margin-top: 8px; }
.kit-sum { margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.kit-sum b { color: inherit; } .kit-sum b.ok { color: #16a34a; }

/* =========================================================
   ใบเสนอราคา · ใบเสร็จรับเงิน
   ========================================================= */
@media (max-width: 400px) { .bnav button { font-size: 10px; } .bnav button svg { width: 22px; height: 22px; } }
.dlist { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .dlist { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dlist > .btn, .dlist > .empty { grid-column: 1 / -1; } }
.dcard { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 13px 14px; cursor: pointer; border: 1.5px solid transparent; display: grid; gap: 6px; min-width: 0; }
.dcard:hover { border-color: #e4e4e7; }
.dcard:focus-visible { outline: 2px solid var(--red); }
.dc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dc-top .pill svg { width: 13px; height: 13px; stroke-width: 3; }
.dc-no { font-family: var(--head); font-size: 15.5px; letter-spacing: .3px; }
.dc-top small { margin-left: auto; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.dc-cust { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; color: var(--muted); font-size: 13px; }
.dc-foot b { font-family: var(--head); color: var(--ink); font-size: 18px; white-space: nowrap; }
.dcard.is-void { opacity: .6; }
.dcard.is-void .dc-foot b { text-decoration: line-through; }
.dk-meta { color: var(--muted); font-size: 14px; }
.dk-meta b { color: var(--ink); font-family: var(--head); font-size: 16px; }
.dk-share { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 4px; }
.dk-share .btn { white-space: normal; text-align: center; line-height: 1.25; }
.dk-share .dk-wide { grid-column: 1 / -1; }
.dk-done > b { font-size: 30px; letter-spacing: 2px; }

/* ฟอร์มเอกสาร */
.dk-sec { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 4px; }
.dk-sec:first-child { border-top: 0; margin-top: 6px; padding-top: 0; }
.dk-sec h4 { margin: 10px 0 0; font-family: var(--head); font-size: 15px; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; }
.dk-sec h4::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--red); }
.dk-items { display: grid; gap: 8px; margin-top: 10px; }
.dk-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) 34px; gap: 8px; align-items: start; padding: 10px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; }
.dk-n { font-family: var(--head); font-weight: 700; color: var(--muted); text-align: center; padding-top: 11px; }
.dk-row textarea.dk-name { resize: none; overflow: hidden; min-height: 44px; line-height: 1.4; }
.dk-del { width: 34px; height: 34px; margin-top: 5px; border: 0; border-radius: 10px; background: var(--gray-soft); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.dk-del:hover { background: var(--red-soft); color: var(--red); }
.dk-del svg { width: 17px; height: 17px; }
.dk-nums { grid-column: 2 / 4; display: grid; grid-template-columns: 82px 96px minmax(0, 1fr) minmax(90px, auto); gap: 8px; align-items: end; }
.dk-nums label { margin: 0; font-size: 11.5px; font-weight: 600; color: var(--muted); display: grid; gap: 3px; }
.dk-nums input { padding: 8px 10px; }
.dk-nums input[type=number] { text-align: right; font-variant-numeric: tabular-nums; }
.dk-lt { text-align: right; padding-bottom: 8px; }
.dk-lt small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.dk-lt b { font-family: var(--head); font-size: 16px; white-space: nowrap; }
@media (max-width: 560px) {
  .dk-nums { grid-template-columns: 1fr 1fr 1.25fr; }
  .dk-lt { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; padding: 4px 2px 0; border-top: 1px dashed var(--line); }
}
.dk-find { margin-top: 10px; position: relative; }
.dk-find input { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 13px center / 18px; padding-left: 40px; }
.dk-res { margin-top: 6px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; max-height: 330px; overflow-y: auto; box-shadow: var(--shadow); }
.dk-res button { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: #fff; padding: 7px 10px; font: inherit; text-align: left; cursor: pointer; }
.dk-res button:last-child { border-bottom: 0; }
.dk-res button:hover { background: var(--gray-soft); }
.dk-res .pimg { width: 42px; height: 42px; }
.r-mid { min-width: 0; }
.r-mid b { display: block; font-size: 14px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-mid small { color: var(--muted); font-size: 12px; }
.r-price { font-family: var(--head); font-weight: 700; white-space: nowrap; }
.dk-find + .btn { margin-top: 8px; white-space: normal; }
.dk-sum { margin-top: 12px; background: var(--black); color: #fff; border-radius: 16px; padding: 12px 16px; display: grid; gap: 6px; }
.ds-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; color: #d4d4d8; }
.ds-row b { font-family: var(--head); color: #fff; font-size: 16px; font-variant-numeric: tabular-nums; }
.ds-row label { margin: 0; color: #d4d4d8; font-weight: 500; font-size: 14px; }
.ds-row input { width: 130px; padding: 7px 10px; text-align: right; border-color: #3f3f46; }
.ds-grand { border-top: 1px solid #3f3f46; padding-top: 8px; color: #fff; font-weight: 700; }
.ds-grand b { font-size: 24px; color: #fff; }
.dk-sum small { color: #a1a1aa; font-size: 12.5px; text-align: right; }

/* ตั้งค่าลายเซ็น */
.sig-edit { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.sig-prev { width: 230px; height: 96px; border: 1.5px dashed #d4d4d8; border-radius: 14px; display: grid; place-items: center; overflow: hidden; flex: none;
  background: repeating-conic-gradient(#f1f1f4 0 25%, #fff 0 50%) 0 0 / 14px 14px; }
.sig-prev img { max-width: 92%; max-height: 84px; display: block; }
.sig-prev span { display: grid; justify-items: center; gap: 4px; color: var(--muted); font-size: 12.5px; }
#card-docs .card-head { flex-wrap: wrap; }

/* =========================================================
   คิวงาน: ลูกค้าแจ้ง · QR มัดจำ · ปุ่มลัด
   ========================================================= */
.msg-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--yellow-soft); border: 1.5px solid #f5d98a; color: #713f12; border-radius: 14px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }
.msg-strip svg { width: 18px; height: 18px; color: var(--yellow); }
.msg-strip button { border: 0; background: #fff; border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--ink); box-shadow: var(--shadow); }
.o-msg { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: #713f12; background: var(--yellow-soft); padding: 2px 8px; border-radius: 999px; }
.o-msg svg { width: 13px; height: 13px; }
.cmsg { background: var(--yellow-soft); border-radius: 14px; padding: 10px 12px; margin: 12px 0 4px; }
.cmsg > b { display: flex; align-items: center; gap: 6px; color: #713f12; font-size: 14px; margin-bottom: 6px; }
.cmsg > b svg { width: 17px; height: 17px; }
.cmsg-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: #fff; border-radius: 10px; padding: 8px 10px; margin-top: 6px; }
.cmsg-row em { font-style: normal; font-weight: 700; font-size: 14px; display: block; }
.cmsg-row p { margin: 2px 0; font-size: 14px; }
.cmsg-row small { color: var(--muted); font-size: 12px; }
.os-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 2px; }
.os-quick .btn { white-space: normal; line-height: 1.25; }
.o-qrbox { display: flex; gap: 14px; align-items: center; background: var(--black); color: #fff; border-radius: 14px; padding: 12px; margin-top: -4px; }
.o-qrbox img { width: 150px; height: 150px; background: #fff; border-radius: 10px; padding: 6px; image-rendering: pixelated; flex: none; }
.o-qrbox b { display: block; font-family: var(--head); font-size: 26px; }
.o-qrbox small { color: #d4d4d8; font-size: 13px; }

/* QR รับเงิน */
.pq-prev img { object-fit: contain; width: 100%; height: 100%; max-height: none; }
.pq-prev { height: 120px; width: 120px; }
.pq-amt { display: flex; align-items: center; gap: 6px; border: 2px solid var(--ink); border-radius: 14px; padding: 2px 14px; margin: 10px 0 8px; }
.pq-amt span { font-family: var(--head); font-size: 30px; font-weight: 700; }
.pq-amt input { border: 0; box-shadow: none !important; font-family: var(--head); font-size: 32px; font-weight: 700; padding: 8px 0; }
.pq-card { background: var(--black); color: #fff; border-radius: 18px; padding: 16px; text-align: center; margin: 12px 0; }
.pq-top { font-weight: 700; font-size: 16px; margin-bottom: 10px; }
.pq-card img { width: 230px; height: 230px; background: #fff; border-radius: 12px; padding: 8px; image-rendering: pixelated; display: block; margin: 0 auto; object-fit: contain; }
.pq-card.pq-static img { image-rendering: auto; }
.pq-card b { display: block; font-family: var(--head); font-size: 34px; margin-top: 8px; }
.pq-card small { color: #a1a1aa; }

/* แท็บย่อย เอกสาร / ข้อมูลโปรเจกต์ */
.subtabs { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.subtabs button { flex: none; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.subtabs button.on { background: var(--black); border-color: var(--black); color: #fff; }
.pjcard .dc-cust { font-size: 17px; }
.pj-acts { display: inline-flex; gap: 6px; }
.dc-top .pill svg { width: 13px; height: 13px; }

/* =========================================================
   ตัวแก้ไขข้อมูลโปรเจกต์ (เต็มจอ)
   ========================================================= */
.pj-ed { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: flex; flex-direction: column; }
.pj-top { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--black); color: #fff; }
.pj-top b { flex: 1; min-width: 0; font-family: var(--head); font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-views { margin: 0; background: #26262b; flex: none; }
.pj-views button { color: #a1a1aa; padding: 6px 14px; }
.pj-views button.on { background: #fff; color: var(--ink); }
.pj-cols { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.pj-form { overflow-y: auto; padding: 14px 14px 80px; max-width: 760px; width: 100%; margin: 0 auto; }
.pj-prev { overflow-y: auto; background: #18181b; padding: 12px; display: none; }
.pj-ed[data-view="prev"] .pj-form { display: none; }
.pj-ed[data-view="prev"] .pj-prev { display: block; }
@media (min-width: 1024px) {
  .pj-views { display: none; }
  .pj-cols { grid-template-columns: minmax(0, 1fr) 440px; }
  .pj-form { max-width: none; padding: 18px 24px 80px; }
  .pj-prev, .pj-ed[data-view="prev"] .pj-prev { display: block; }
  .pj-ed[data-view="prev"] .pj-form { display: block; }
}
@media (max-width: 520px) { .pj-top .btn-red { padding: 9px 12px; font-size: 13.5px; } .pj-top b { display: none; } }
.pj-prev-h { color: #a1a1aa; font-size: 13px; margin: 0 2px 10px; }
.pj-prev-h small { color: #71717a; }
.pj-slides { display: grid; gap: 12px; max-width: 440px; margin: 0 auto; }
.pj-cell { position: relative; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.pj-cell .ps-slide { position: absolute; top: 0; left: 0; transform-origin: top left; }
.pj-work { position: fixed; left: -12000px; top: 0; width: 800px; pointer-events: none; }
.pj-card, .pj-sec { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.pj-big { font-size: 20px !important; font-weight: 600; }
.pj-secs { display: grid; gap: 0; }
.pj-sh { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.pj-kind { width: 34px; height: 34px; border-radius: 10px; background: var(--red); color: #fff; display: grid; place-items: center; flex: none; }
.pj-kind svg { width: 18px; height: 18px; }
.pj-st { font-weight: 700; font-size: 16px !important; padding: 8px 10px !important; }
.pj-ib { width: 34px; height: 34px; flex: none; border: 0; border-radius: 9px; background: var(--gray-soft); color: var(--ink-2); cursor: pointer; display: grid; place-items: center; font-size: 11px; }
.pj-ib:disabled { opacity: .35; cursor: default; }
.pj-ib svg { width: 16px; height: 16px; }
.pj-x:hover { background: var(--red-soft); color: var(--red); }
.pj-sec textarea { resize: none; overflow: hidden; line-height: 1.55; }
.pj-sec > small { display: block; margin-top: 4px; font-size: 12.5px; }
.pj-rows { display: grid; gap: 8px; margin-bottom: 8px; }
.pj-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) 34px; gap: 6px 8px; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; padding: 8px; }
.pj-rn { font-family: var(--head); font-weight: 700; color: var(--red); text-align: center; }
.pj-n { font-weight: 600; }
.pj-rgrid { grid-column: 2 / 4; display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 8px; }
.pj-rgrid label { margin: 0; font-size: 11.5px; color: var(--muted); display: grid; gap: 3px; }
.pj-rgrid input { padding: 8px 10px; }
.pj-use { grid-column: 2 / 4; background: #fafafa; font-size: 14px; padding: 8px 10px; }
.pj-opts { display: flex; flex-wrap: wrap; gap: 0 18px; }
.pj-opts .check { margin: 10px 0 2px; font-size: 14px; }
.pj-sec .seg-sm { margin-bottom: 8px; }
.pj-add { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; background: #fff; border: 2px dashed #d4d4d8; border-radius: 16px; padding: 12px; }
.pj-add span { font-weight: 700; font-size: 14px; margin-right: 4px; }

.pq-view { margin: 12px auto; max-width: 340px; }
.pq-view img { width: 100%; aspect-ratio: 4 / 5; display: block; border-radius: 14px; background: #0b0b0c; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.o-qrbox .btn { margin-top: 8px; }

.pq-amt.is-sum { border-style: dashed; background: var(--gray-soft); }
.pq-items { display: grid; gap: 6px; }
.pq-it { display: grid; grid-template-columns: minmax(0, 1fr) 120px 36px; gap: 6px; }
.pq-it input { padding: 9px 10px; }
.pq-it input[data-f=a] { text-align: right; }
.pq-it button { border: 0; border-radius: 10px; background: var(--gray-soft); color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.pq-adds { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 2px; font-size: 13.5px; font-weight: 600; }
.pq-adds > span { flex-basis: 100%; }
.pq-adds button { border: 1.5px dashed #cfcfd6; background: #fff; border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink-2); }

.side .side-qr { color: var(--red) !important; background: var(--red-soft) !important; margin: 2px 0 6px; }
.side .side-qr:hover { background: #fbd5dc !important; }
.tb-qr { background: var(--red) !important; }
@media (min-width: 1024px) { .tb-qr { display: none !important; } }

/* ใบปะหน้าพัสดุ */
.shlist { display: grid; gap: 8px; }
.shcard { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px; display: grid; gap: 4px; }
.sh-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sh-top b { font-size: 15.5px; }
.sh-top small { margin-left: auto; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.sh-addr { font-size: 14px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sh-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.sh-acts { display: flex; gap: 6px; align-items: center; }
.sh-grid { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 16px; align-items: start; }
.sh-prev { position: sticky; top: 0; }
.sh-prev img { width: 100%; aspect-ratio: 2 / 3; display: block; border-radius: 8px; box-shadow: 0 4px 18px rgba(0,0,0,.18); border: 1px solid var(--line); background: #fff; }
@media (max-width: 640px) { .sh-grid { grid-template-columns: minmax(0, 1fr); } .sh-prev { position: static; max-width: 260px; margin: 0 auto; order: -1; } }
.sh-sec { margin-top: 12px; font-size: 14px; }
.seg-wrap { flex-wrap: wrap; }
.seg-wrap button { flex: 0 0 auto; }
.sh-from { margin-top: 12px; background: var(--gray-soft); border-radius: 12px; padding: 10px 12px; }
.sh-from summary { cursor: pointer; font-size: 14px; }
.sh-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; position: sticky; bottom: 0; z-index: 3; background: #fff; padding: 10px 0; box-shadow: 0 -8px 12px -8px rgba(0,0,0,.12); }
.sh-btns .btn { white-space: normal; text-align: center; line-height: 1.25; }
.modal-box:has(.sh-grid) { max-width: 820px; }
@media (max-width: 480px) {
  .topbar { padding: 0 10px; }
  .tb-right { gap: 4px; }
  .tb-right .icon-btn { width: 34px; height: 34px; }
  .tb-right a.icon-btn[href="./"], .tb-brand small { display: none; }
  .tb-pos { height: 34px; }
}

.shcard { cursor: pointer; border: 1.5px solid transparent; }
.shcard:hover { border-color: #e4e4e7; }
.sh-recgrid { margin-top: 10px; }
.sc-box { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 3 / 4; max-height: 60vh; margin: 8px auto; width: 100%; }
.sc-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sc-box i { position: absolute; inset: 22%; border: 3px solid rgba(255,255,255,.9); border-radius: 14px; box-shadow: 0 0 0 2000px rgba(0,0,0,.35); }
.sh-job { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.sh-job svg { width: 16px; height: 16px; color: var(--red); }

/* รูปเต็มจอ (iPhone: กดค้างเพื่อบันทึกลงรูปภาพ) */
.img-ov { position: fixed; inset: 0; z-index: 200; background: rgba(11,11,12,.92); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.img-ov-in { width: 100%; max-width: 420px; text-align: center; color: #fff; }
.img-ov-in p { margin: 0 0 10px; font-size: 15px; }
.img-ov-in img { width: 100%; border-radius: 12px; display: block; margin-bottom: 12px; -webkit-touch-callout: default; user-select: auto; }
.btn-light { background: #fff; color: var(--ink); }

/* =========================================================
   v14: งานด่วน · งานเงียบ · แชทลูกค้า · ข้อความสำเร็จรูป · ผู้ช่วย Claude
   ========================================================= */
.side .side-act { color: var(--ink-2) !important; background: var(--gray-soft) !important; margin: -2px 0 6px; }
.side .side-act:hover { background: #e4e4e9 !important; }
.rush { flex: none; display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 800; color: #fff; background: linear-gradient(90deg, #ff3b30, var(--red)); padding: 2px 8px; border-radius: 999px; letter-spacing: .3px; }
.ocard.is-rush { border-color: #fbc1cb; box-shadow: 0 0 0 1px #fbc1cb, var(--shadow); }
.o-stale { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: #92400e; background: #fef3c7; padding: 2px 8px; border-radius: 999px; }
.o-stale svg { width: 13px; height: 13px; }
.stale-strip { background: #fff7e0; }
.stale-strip > span { display: grid; line-height: 1.3; }
.stale-strip small { font-size: 12px; color: #92400e; font-weight: 500; }
.stale-box { display: flex; align-items: center; gap: 10px; background: #fff7e0; border: 1.5px solid #f5d98a; border-radius: 14px; padding: 10px 12px; margin: 12px 0 2px; }
.stale-box > svg { width: 22px; height: 22px; color: var(--yellow); flex: none; }
.stale-box > div { flex: 1; min-width: 0; }
.stale-box b { display: block; color: #713f12; font-size: 14px; }
.stale-box small { color: #92400e; font-size: 12.5px; }
.o-sec { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; color: var(--ink-2); margin: 6px 2px -2px; grid-column: 1 / -1; }
.o-sec svg { width: 17px; height: 17px; }
.o-sec em { font-style: normal; background: var(--ink-2); color: #fff; font-size: 11.5px; border-radius: 999px; padding: 0 7px; }
.o-sec-red { color: var(--red); }
.o-sec-red em { background: var(--red); }
.due-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.due-chips button { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.due-chips button:active { background: var(--black); color: #fff; }
.subtabs .badge { min-width: 18px; height: 18px; font-size: 10.5px; margin-left: 4px; vertical-align: 1px; }

/* แชทลูกค้า */
.src { flex: none; display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--gray-soft); color: #3f3f46; }
.src-web { background: var(--black); color: #fff; }
.src-fb { background: #e7efff; color: #1d4ed8; }
.src-line { background: #e3f8eb; color: #06994a; }
.src-phone { background: #f3e8ff; color: #7e22ce; }
.src-shop { background: var(--red-soft); color: var(--red); }
.ch-age { flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ch-age svg { width: 13px; height: 13px; }
.ch-topic { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.ch-last { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-last em { font-style: normal; font-weight: 600; }
.chcard.age-mid { border-color: #f5d98a; }
.chcard.age-mid .ch-age { color: var(--yellow); }
.chcard.age-hot { border-color: #fbc1cb; background: #fffafb; }
.chcard.age-hot .ch-age { color: var(--red); font-weight: 800; }
.chcard.age-follow .ch-age { color: var(--yellow); }
.notif-ask { display: flex; align-items: center; gap: 10px; background: #fff; border: 1.5px dashed #d4d4d8; border-radius: 14px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; font-weight: 600; }
.notif-ask > svg { width: 22px; height: 22px; color: var(--red); flex: none; }
.notif-ask span { flex: 1; display: grid; }
.notif-ask small { color: var(--muted); font-weight: 500; font-size: 12px; }
.ch-msgs { background: #f4f4f6; border-radius: 14px; padding: 12px; margin: 12px 0 4px; max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.bub { max-width: 82%; padding: 8px 12px; border-radius: 16px; font-size: 14.5px; }
.bub p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.bub small { display: block; font-size: 11px; opacity: .7; margin-top: 2px; }
.bub-c { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.bub-s { align-self: flex-end; background: var(--black); color: #fff; border-bottom-right-radius: 4px; }
.rp-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 8px; }
.rp-chips button { flex: none; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.rp-list { display: grid; gap: 6px; margin-top: 10px; }
.rp-item { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 12px; font: inherit; text-align: left; cursor: pointer; display: grid; gap: 2px; }
.rp-item:hover { border-color: #cfcfd6; }
.rp-item b { font-size: 14.5px; }
.rp-item small { color: var(--muted); font-size: 12.5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rp-miss { color: var(--yellow); font-size: 13px; font-weight: 600; margin: 6px 0 0; }
.rm-list { display: grid; gap: 10px; margin: 10px 0; }
.rm-item { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px; display: grid; gap: 6px; }
.rm-top { display: flex; gap: 6px; align-items: center; }
.rm-top input { flex: 1; font-weight: 600; }

/* ผู้ช่วย Claude */
.ai-steps { margin: 6px 0 4px; padding-left: 20px; font-size: 13.5px; color: var(--ink-2); display: grid; gap: 2px; }
.ai-prev { margin-top: 10px; font-size: 13px; }
.ai-prev summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.ai-prev pre { white-space: pre-wrap; word-break: break-word; background: var(--gray-soft); border-radius: 10px; padding: 10px; max-height: 240px; overflow: auto; font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; margin: 6px 0 0; }
.pj-ai { margin-top: 12px; }
.os-quick .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
.set-box { margin-top: 16px; padding: 12px 14px 14px; border-radius: 14px; background: var(--gray-soft); }
.set-box > b { display: block; font-size: 14.5px; }
.set-box select, .set-box input { background: #fff; }
/* ตัวเลือกสินค้า */
.opt-box { margin-top: 14px; border: 1.5px dashed #d4d4d8; border-radius: 14px; padding: 12px; display: grid; gap: 8px; }
.opt-head b { display: block; font-size: 14.5px; }
.opt-head small { color: var(--muted); font-size: 12.5px; }
.opt-box > .btn { justify-self: start; }
.opt-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, .9fr) minmax(0, 1.1fr) minmax(0, .8fr) 34px; gap: 6px; align-items: center; }
.opt-row.no-stk, .opt-th.no-stk { grid-template-columns: minmax(0, 1.6fr) minmax(0, .9fr) minmax(0, 1.1fr) 34px; }
.opt-row .oc { margin: 0 !important; display: block; min-width: 0; }
.opt-row .oc span { display: none; }
.opt-row input { padding: 8px 9px; font-size: 14px; min-width: 0; width: 100%; }
.opt-th { font-size: 12px; font-weight: 600; color: var(--muted); }
.opt-sum { margin: 0; }
@media (max-width: 560px) {
  .opt-th { display: none; }
  .opt-row, .opt-row.no-stk { grid-template-columns: repeat(3, minmax(0, 1fr)) 34px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .opt-row .oc-n { grid-column: 1 / 4; }
  .opt-row .icon-btn { grid-column: 4; grid-row: 1; align-self: end; }
  .opt-row .oc span { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
}
.tag-opt { font-style: normal; font-size: 11px; font-weight: 700; color: #1d4ed8; background: var(--blue-soft); padding: 1px 7px; border-radius: 999px; margin-right: 5px; vertical-align: 1px; }
.opt-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.opt-pick button { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 7px 12px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; display: grid; text-align: left; line-height: 1.25; }
.opt-pick button small { font-weight: 500; font-size: 11.5px; color: var(--muted); }
.opt-pick button.on { border-color: var(--red); background: var(--red-soft); box-shadow: 0 0 0 1px var(--red) inset; }
/* ออเดอร์เว็บ: ค่าส่ง + ตรวจสลิป */
.cf-ship { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; font-weight: 600; font-size: 14px; }
.cf-ship small { color: var(--muted); font-weight: 500; }
.cf-ship input { width: 120px; text-align: right; }
.wo-wait { font-size: 13px; color: var(--yellow); background: var(--yellow-soft); border-radius: 10px; padding: 6px 10px; font-weight: 600; }
.wo-items .warn { color: var(--red); font-weight: 600; }
.wo-items small { color: var(--muted); font-weight: 500; }
.slip-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 14px; margin-top: 10px; align-items: start; }
.slip-img { background: var(--gray-soft); border-radius: 14px; min-height: 200px; overflow: hidden; display: grid; place-items: center; }
.slip-img img { width: 100%; max-height: 62vh; object-fit: contain; display: block; }
.slip-side .pay-big { margin-top: 0; }
.slip-tip { background: var(--blue-soft); color: var(--blue); border-radius: 10px; padding: 8px 10px; margin: 0 0 10px; }
.warn-box { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 8px 10px; margin-top: 10px; font-size: 13.5px; font-weight: 600; }
@media (max-width: 620px) { .slip-wrap { grid-template-columns: 1fr; } .slip-img img { max-height: 50vh; } }
.modal-box.nudge { animation: nudge .35s ease; }
@keyframes nudge { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }

/* ---------- v16: โปรโมชัน · หน้าเว็บ ---------- */
.pm-list { display: grid; gap: 8px; }
.pm-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; }
.pm-row:hover { border-color: var(--red); }
.pm-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); font-family: var(--head); font-weight: 700; font-size: 20px; flex: none; }
.pm-ic.is-flash { background: var(--red); color: #fde047; }
.pm-ic svg { width: 22px; height: 22px; fill: currentColor; }
.pm-info { flex: 1; min-width: 0; }
.pm-info b { display: block; font-size: 15px; }
.pm-info small { display: block; color: var(--muted); font-size: 12.5px; }
.pm-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.pm-code { font-family: var(--head); font-weight: 700; letter-spacing: 1px; padding: 6px 10px; border-radius: 10px; border: 2px dashed var(--red); color: var(--red); background: var(--red-soft); flex: none; }
.bn-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; }
.bn-row.is-off { opacity: .55; }
.bn-prev { position: relative; width: 150px; aspect-ratio: 16 / 7; border-radius: 10px; overflow: hidden; flex: none; padding: 8px 10px; display: flex; flex-direction: column; justify-content: center; gap: 2px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, rgba(225,10,47,.6), transparent 55%), linear-gradient(120deg, #1a0a0e, #0e0e12 60%, #18060a); background-size: cover; background-position: center; }
.bn-prev[style*="url"]::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.75), transparent 75%); }
.bn-prev > * { position: relative; }
.bn-prev span:empty { display: none; }
.bn-prev span { align-self: flex-start; background: #fff; color: var(--red); font-size: 8px; font-weight: 800; padding: 1px 5px; border-radius: 4px; letter-spacing: 1px; }
.bn-prev b { font-size: 11px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bn-prev small { font-size: 9px; opacity: .85; }
.bn-prev em { font-style: normal; align-self: flex-start; background: var(--red); font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 6px; margin-top: 2px; }
.bn-prev-lg { width: 100%; padding: 18px 22px; gap: 4px; margin-bottom: 6px; }
.bn-prev-lg span { font-size: 11px; padding: 2px 8px; }
.bn-prev-lg b { font-size: 22px; }
.bn-prev-lg small { font-size: 13px; }
.bn-prev-lg em { font-size: 13px; padding: 6px 12px; border-radius: 9px; margin-top: 6px; }
.bn-info { flex: 1; min-width: 0; }
.bn-info b { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bn-info small { color: var(--muted); font-size: 12.5px; }
.bn-acts { display: flex; align-items: center; gap: 8px; flex: none; }
.bn-acts .icon-btn { width: 34px; height: 34px; font-size: 12px; }
@media (max-width: 560px) { .bn-row { flex-wrap: wrap; } .bn-prev { width: 120px; } .bn-acts { width: 100%; justify-content: flex-end; } }
.pm-upload { display: flex !important; flex-wrap: wrap; align-items: center; gap: 8px; border: 2px dashed var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; font-weight: 600; }
.pm-upload small { flex-basis: 100%; color: var(--muted); font-weight: 400; font-size: 12px; }
.pm-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.pm-quick .chip-btn svg { width: 14px; height: 14px; fill: #eab308; stroke: #eab308; }
.pm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pm-chips button { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.pm-chips button.on { background: var(--red); border-color: var(--red); color: #fff; }
.pm-items { max-height: 260px; overflow-y: auto; border: 1.5px solid var(--line); border-radius: 12px; margin: 8px 0 4px; }
.pm-items label { display: flex !important; align-items: center; gap: 10px; padding: 8px 12px; margin: 0 !important; border-bottom: 1px solid var(--line); font-weight: 500; cursor: pointer; }
.pm-items label:last-child { border-bottom: 0; }
.pm-items input { width: 18px !important; height: 18px; flex: none; accent-color: var(--red); }
.pm-items span { flex: 1; min-width: 0; }
.pm-items em { font-style: normal; color: var(--muted); font-size: 13px; }
#pr-ex { margin: 10px 0 0; }
.cr-form { display: flex; gap: 8px; }
.cr-form input { flex: 1; min-width: 0; }
.cr-out { margin-top: 8px; }
.cr-out .pill { white-space: normal; }
.wo-cut b { color: var(--green); }
.bn-acts .icon-btn { background: #f4f4f5; color: #18181b; border: 1.5px solid var(--line); border-radius: 10px; }
.bn-acts .icon-btn:disabled { opacity: .35; }

/* ---------- v17: คู่มือชุดโปรเจกต์ + QR ---------- */
.gd-list { display: grid; gap: 10px; }
@media (min-width: 1000px) { .gd-list { grid-template-columns: 1fr 1fr; } }
.gd-card { display: flex; gap: 12px; padding: 12px; border-radius: 16px; background: #fff; border: 1.5px solid var(--line); }
.gd-card.is-off { opacity: .6; }
.gd-cover { width: 92px; height: 92px; border-radius: 12px; overflow: hidden; flex: none; background: #0b0b0c; display: grid; place-items: center; cursor: pointer; }
.gd-cover img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.gd-cover span { color: #fff; font-family: var(--head); font-weight: 700; font-size: 14px; }
.gd-info { flex: 1; min-width: 0; display: grid; gap: 4px; }
.gd-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gd-top b { font-size: 16px; }
.gd-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.gd-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #f4f4f5; color: #a1a1aa; }
.gd-chip svg { width: 13px; height: 13px; }
.gd-chip.on { background: var(--red-soft); color: var(--red); }
.gd-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.gd-form .gd-sec { border: 1.5px solid var(--line); border-radius: 14px; padding: 4px 14px 12px; margin-bottom: 10px; background: #fff; }
.gd-sec > summary { cursor: pointer; font-weight: 700; font-size: 15.5px; padding: 10px 0 6px; display: flex; align-items: center; gap: 8px; list-style: none; }
.gd-sec > summary::-webkit-details-marker { display: none; }
.gd-sec > summary svg { color: var(--red); }
.gd-row2 { display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: start; }
.gd-coverpick { display: grid !important; place-items: center; text-align: center; width: 110px; height: 110px; margin-top: 8px !important; border: 2px dashed var(--line); border-radius: 14px; cursor: pointer; overflow: hidden; font-size: 13px; color: var(--muted); }
.gd-coverpick img { width: 100%; height: 100%; object-fit: cover; }
.gd-coverpick svg { width: 28px; height: 28px; }
.gd-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 8px 0; }
.gd-img { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: #f4f4f5; border: 1px solid var(--line); }
.gd-img img { width: 100%; height: 100%; object-fit: contain; }
.gd-img > span:empty { display: none; }
.gd-img > span { position: absolute; left: 4px; top: 4px; font-size: 11px; font-weight: 700; background: var(--red); color: #fff; padding: 1px 6px; border-radius: 6px; }
.gd-img button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 8px; border: 0; background: rgba(0,0,0,.7); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.gd-img button svg { width: 16px; height: 16px; }
.gd-img .gd-up { right: auto; left: 4px; top: auto; bottom: 4px; font-size: 11px; }
.gd-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.gd-btns label.btn { margin: 0 !important; }
.gd-files { display: grid; gap: 6px; }
.gd-file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fafafa; }
.gd-file > svg { width: 22px; height: 22px; color: var(--red); flex: none; }
.gd-file span { flex: 1; min-width: 0; }
.gd-file b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-file small { color: var(--muted); }
.gd-code { border: 1px solid var(--line); border-radius: 12px; padding: 8px; margin-bottom: 8px; background: #fafafa; display: grid; gap: 6px; }
.gd-code-h { display: flex; gap: 6px; }
.gd-code-h input { flex: 1; font-family: ui-monospace, Consolas, monospace; font-weight: 700; }
.gd-code textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.5; background: #0f0f12; color: #e5e7eb; border-color: #0f0f12; tab-size: 2; white-space: pre; overflow-x: auto; }
.gd-vid { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.gd-vid img, .gd-vid-ph { width: 80px; height: 60px; border-radius: 8px; object-fit: cover; flex: none; background: #f4f4f5; display: grid; place-items: center; color: var(--muted); }
.gd-vid > div { flex: 1; display: grid; gap: 4px; }
.gd-ai { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 8px; }
#ge-prog:empty { display: none; }
.qr-prev { display: flex; justify-content: center; padding: 14px; margin: 10px 0; border-radius: 14px; background: #e4e4e7; min-height: 120px; }
.qr-prev-in { transform-origin: top center; }
.qr-prev .lb { border: 0 !important; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.qr-pick { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.qr-pick label { display: flex !important; align-items: center; gap: 10px; margin: 0 !important; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-weight: 500; }
.qr-pick input[type=checkbox] { width: 20px !important; height: 20px; accent-color: var(--red); flex: none; }
.qr-pick span { flex: 1; min-width: 0; }
.qr-pick em { font-style: normal; color: var(--muted); font-size: 12px; margin-left: 4px; }
.qr-pick input[type=number] { width: 72px !important; flex: none; text-align: center; }

/* ---------- v18: บาร์โค้ด · ป้ายราคา ---------- */
.lb-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.lb-cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; scrollbar-width: none; }
.lb-cats button { flex: none; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.lb-cats em { font-style: normal; color: var(--muted); font-weight: 500; }
.lb-list { display: grid; gap: 8px; padding-bottom: 80px; }
.lb-grp { background: #fff; border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden; scroll-margin-top: 80px; }
.lb-grp > summary { display: flex; align-items: center; gap: 8px; padding: 11px 14px; cursor: pointer; list-style: none; background: #fafafa; }
.lb-grp > summary::-webkit-details-marker { display: none; }
.lb-grp > summary b { font-size: 15.5px; }
.lb-grp > summary em { font-style: normal; font-size: 12px; font-weight: 700; color: #fff; background: var(--red); padding: 1px 8px; border-radius: 999px; }
.lb-grp > summary .btn { margin-left: auto; }
.lb-grp[open] > summary { border-bottom: 1px solid var(--line); }
.lb-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid #f1f1f3; cursor: pointer; }
.lb-row:first-of-type { border-top: 0; }
.lb-row.is-sub { padding-left: 30px; }
.lb-row.is-sel { background: var(--red-soft); }
.lb-row.no-code .lb-mid b { color: #71717a; }
.lb-chk input { width: 20px !important; height: 20px; accent-color: var(--red); }
.lb-mid { flex: 1; min-width: 0; }
.lb-mid b { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-mid span { font-size: 12.5px; color: var(--muted); }
.lb-mid code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: #18181b; background: #f4f4f5; padding: 0 6px; border-radius: 5px; font-weight: 700; }
.lb-miss { font-style: normal; color: #b45309; }
.lb-own { font-style: normal; color: #2563eb; }
.lb-n { width: 62px !important; text-align: center; padding: 6px !important; flex: none; }
.lb-selbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 76px); z-index: 40; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; background: #18181b; color: #fff; padding: 10px 14px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.35); max-width: calc(100vw - 24px); }
.lb-selbar span { font-weight: 700; font-size: 14px; }
.lb-selbar .btn-outline { color: #fff; border-color: #52525b; background: transparent; }
@media (min-width: 900px) { .lb-selbar { bottom: 20px; } }
.lb-prev2 { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; padding: 16px; background: #3f3f46; border-radius: 14px; margin-bottom: 12px; }
.lb-prev2 figure { margin: 0; display: grid; justify-items: center; gap: 6px; }
.lb-prev2 canvas { background: #fff; border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.4); image-rendering: pixelated; }
.lb-prev2 figure:first-child canvas { width: 180px; height: 120px; }
.lb-prev2 figure:last-child canvas { width: 300px; height: 200px; max-width: 100%; }
.lb-prev2 figcaption { color: #e4e4e7; font-size: 12px; }
.lb-opts { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.lb-qty { display: flex; align-items: center; gap: 10px; }
.lb-qty label { margin: 0 !important; }
.lb-qty input { width: 90px !important; }
.lb-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.ct-list { display: grid; gap: 6px; max-height: 60vh; overflow-y: auto; margin-top: 8px; }
.ct-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.ct-row.is-ch { border-color: var(--green); background: #f0fdf4; }
.ct-row > div { flex: 1; min-width: 0; }
.ct-row b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-row small { color: var(--muted); font-size: 12px; }
.ct-row select { width: 46% !important; max-width: 240px; flex: none; }

/* ---------- % ความคืบหน้างาน (v30) ---------- */
.pct-box { margin-top: 12px; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; background: #fff; }
.pct-head { display: flex; justify-content: space-between; align-items: center; }
.pct-head label { margin: 0; font-weight: 600; }
.pct-head b { font-family: var(--head); font-size: 26px; color: var(--red); line-height: 1; }
.pct-head b.pct-down { color: var(--yellow); }
#os-pct { width: 100%; margin: 10px 0 6px; accent-color: var(--red); height: 28px; }
.pct-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.pct-auto { color: var(--yellow); font-weight: 600; }
/* ออกบิลจากข้อมูลโปรเจกต์ */
.bl-opts { display: grid; gap: 8px; }
.bl-opts button { display: grid; gap: 2px; text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 12px 14px; font: inherit; cursor: pointer; }
.bl-opts button small { color: var(--muted); font-size: 13px; }
.bl-opts button.on { border-color: var(--red); background: var(--red-soft); box-shadow: 0 0 0 1px var(--red) inset; }
.bl-opts button:disabled { opacity: .5; cursor: not-allowed; }
/* การเงิน: เทียบช่วงก่อน · ค้างรับ · กราฟรายวัน (v30) */
.cmp-row { display: grid; grid-template-columns: 1fr; gap: 8px; margin: -2px 0 12px; }
@media (min-width: 760px) { .cmp-row { grid-template-columns: 2fr 1fr; } }
.cmp { background: #fff; border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow); }
.cmp small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }
.cmp-items { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; font-size: 14px; }
.cmp em { font-style: normal; font-weight: 700; color: var(--muted); }
.cmp em.up { color: var(--green); }
.cmp em.down { color: var(--red); }
.cmp-remain b { display: block; font-family: var(--head); font-size: 22px; color: var(--yellow); line-height: 1.2; }
.cmp-remain span { font-size: 12.5px; color: var(--muted); }
.dc-key { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.dc-key i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 6px; }
.k-s { background: var(--red); }
.k-o { background: #f59fb0; }
.dc-bars { display: grid; grid-template-columns: repeat(var(--n), minmax(8px, 1fr)); gap: 3px; align-items: end; height: 180px; overflow-x: auto; }
.dc-col { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 3px; min-width: 8px; }
.dc-stack { display: flex; flex-direction: column; border-radius: 4px 4px 0 0; overflow: hidden; min-height: 2px; background: var(--gray-soft); transition: filter .15s; }
.dc-stack i { display: block; min-height: 0; }
.dc-col:hover .dc-stack { filter: brightness(1.15); }
.dc-col small { text-align: center; font-size: 10px; color: var(--muted); line-height: 1; }

/* ---------- คลังงาน · ตอบลูกค้า (v33) ---------- */
.lib-cats { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 0 12px; }
.lib-cats button { flex: none; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.lib-cats button.on { border-color: var(--red); color: var(--red); background: var(--red-soft); font-weight: 600; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.lib-grid > .empty { grid-column: 1 / -1; }
.lib-card { display: flex; flex-direction: column; text-align: left; background: #fff; border: 1.5px solid transparent; border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; padding: 0; font: inherit; cursor: pointer; transition: transform .15s, border-color .15s; }
.lib-card:hover { border-color: var(--red); transform: translateY(-2px); }
.lib-cover { position: relative; aspect-ratio: 4 / 3; background: var(--gray-soft); display: grid; place-items: center; color: var(--muted); }
.lib-cover img { width: 100%; height: 100%; object-fit: cover; }
.lib-cover > svg { width: 34px; height: 34px; opacity: .5; }
.lib-cover em { position: absolute; right: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 3px; background: rgba(0,0,0,.65); color: #fff; font-style: normal; font-size: 11.5px; padding: 2px 7px; border-radius: 999px; }
.lib-cover em svg { width: 12px; height: 12px; }
.lib-tx { padding: 9px 11px 12px; display: grid; gap: 2px; }
.lib-tx small { color: var(--muted); font-size: 11.5px; }
.lib-tx b { font-size: 14.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lib-price { color: var(--red); font-weight: 700; font-size: 15px; }
.lib-price i { font-style: normal; font-weight: 400; color: var(--muted); font-size: 11.5px; }
/* หน้ารายละเอียด */
.lib-view h4 { margin: 18px 0 8px; font-size: 15px; }
.lib-gal { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: -4px 0 12px; min-height: 60px; align-items: center; }
.lib-gal img { height: 200px; width: auto; max-width: 300px; object-fit: cover; border-radius: 12px; display: block; }
.lib-gal > button { flex: none; border: 0; padding: 0; background: none; cursor: zoom-in; scroll-snap-align: start; }
.lib-gal .lib-gal-save { display: grid; place-items: center; gap: 6px; width: 120px; height: 200px; border: 1.5px dashed var(--line); border-radius: 12px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; text-align: center; padding: 8px; }
.lib-h { margin: 6px 0 4px; font-size: 21px; }
.lib-meta { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.lib-meta span { background: var(--gray-soft); border-radius: 12px; padding: 8px 12px; display: grid; }
.lib-meta small { color: var(--muted); font-size: 11.5px; }
.lib-meta b { font-size: 18px; color: var(--red); }
.lib-meta i { font-style: normal; font-size: 12px; color: var(--muted); }
.lib-note { background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-top: 8px; }
.lib-note b { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #92400e; margin-bottom: 4px; }
.lib-reps { display: grid; gap: 8px; }
.lib-rep { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.lib-rep b { font-size: 13.5px; }
.lib-rep p { margin: 4px 0 0; font-size: 14px; white-space: normal; color: #3f3f46; }
.lib-rep.empty-rep p { color: var(--muted); font-style: italic; }
#lib-faq .lib-rep { margin-bottom: 8px; }
.lib-sec { margin-bottom: 12px; }
.lib-sec > b { display: block; font-size: 14px; margin-bottom: 4px; }
.lib-sec p, .lib-sec ol { margin: 0; font-size: 14px; color: #3f3f46; }
.lib-sec ol { padding-left: 20px; }
.lib-tb { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.lib-tb td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lib-tb td:nth-child(2) { white-space: nowrap; color: var(--muted); }
.lib-tb td:last-child { text-align: right; white-space: nowrap; }
.lib-tb td small { display: block; color: var(--muted); font-size: 12px; }
.lib-tb tfoot td { font-weight: 700; border-bottom: 0; }
.lib-acts { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
/* ฟอร์ม */
.lib-imgs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.lib-im { position: relative; width: 92px; height: 92px; border-radius: 12px; overflow: hidden; background: var(--gray-soft); }
.lib-im img { width: 100%; height: 100%; object-fit: cover; }
.lib-im.cover { outline: 2.5px solid var(--red); outline-offset: -2.5px; }
.lib-im em { position: absolute; left: 4px; top: 4px; background: var(--red); color: #fff; font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.lib-im button { position: absolute; top: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; cursor: pointer; }
.lib-im button svg { width: 14px; height: 14px; }
.lib-im button:not(.rm) { left: 4px; }
.lib-im button.rm { right: 4px; }
.lib-add { width: 92px; height: 92px; border-radius: 12px; border: 1.5px dashed var(--line); display: grid; place-content: center; justify-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.lib-add svg { width: 22px; height: 22px; }
.lib-sh { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin: 18px 0 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.lf-sec { border: 1.5px solid var(--line); border-radius: 14px; padding: 10px; margin-bottom: 8px; background: #fafafa; }
.lf-sec-h { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.lf-sec-h input { flex: 1; font-weight: 600; }
.lf-sec-h button, .lf-row button, .lf-rep > button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; font: inherit; }
.lf-sec-h button svg, .lf-row button svg, .lf-rep > button svg { width: 16px; height: 16px; }
.lf-row { display: grid; grid-template-columns: minmax(0, 1fr) 64px 84px auto; gap: 6px; margin-bottom: 6px; }
.lf-rep { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; margin-bottom: 8px; }
.lf-rep textarea { grid-column: 1; }
.lf-rep > button { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
/* หลายบัญชีรับเงิน (v33) */
.pq-accs-h { display: grid; gap: 2px; margin: 4px 0 8px; }
.pq-accs { display: grid; gap: 8px; margin-bottom: 14px; }
.pq-acc { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; background: #fff; }
.pq-acc.main { border-color: var(--green); background: #f0fdf4; }
.pq-acc b { display: block; }
.pq-acc small { color: var(--muted); font-size: 12.5px; }
.lib-link { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border: 1.5px solid var(--red); background: var(--red-soft); border-radius: 14px; padding: 10px 12px; margin-top: 12px; }
.lib-link b { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.lib-link small { color: var(--muted); font-size: 12.5px; }
/* แนะนำวันส่งงานใหม่จากคิว (v36) */
.eta-card { display: flex; gap: 12px; align-items: flex-start; background: #111; color: #fff; border-radius: 16px; padding: 12px 14px; margin-bottom: 12px; }
.eta-card > svg { width: 22px; height: 22px; flex: none; color: #ff5470; margin-top: 2px; }
.eta-card b { display: block; font-size: 15px; line-height: 1.4; }
.eta-card b em { font-style: normal; color: #ff5470; font-size: 18px; }
.eta-card small { display: block; color: #a1a1aa; font-size: 12.5px; margin-top: 3px; }
.eta-card.eta-weak { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.eta-card.eta-weak small { color: var(--muted); }
.eta-hint { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }
.eta-hint b { color: var(--text); }

/* v36: ข้อมูลงาน = โปรเจกต์ + รูป/ราคา (รวมเป็นรายการเดียว) */
.lib-cover > i { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font-style: normal; font-size: 11.5px; color: var(--muted); }
.lib-cover u { position: absolute; left: 6px; top: 6px; text-decoration: none; background: var(--red); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.lib-who { margin: 0 0 8px; }
.lib-who .adm { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; padding: 3px 9px; border-radius: 999px; }
.lib-who .adm svg, .lib-cust svg { width: 13px; height: 13px; }
.lib-cust { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: #047857; background: #ecfdf5; border: 1px solid #a7f3d0; padding: 2px 8px; border-radius: 999px; vertical-align: middle; margin-left: 6px; }
.lib-more { border: 1px dashed var(--line, #ddd); border-radius: 12px; padding: 6px 10px; margin-top: 10px; }
.lib-more > summary { cursor: pointer; font-weight: 600; font-size: 14px; padding: 4px 0; }
