/* ============================================================
   RST PROFIT — ธีมเดียวกับ RST SHOP (ส้ม/ดำ, Prompt, มุม 4px, ไม่มีเงา)
   ============================================================ */
:root {
  --orange: #F47B20;
  --orange-dark: #B35309;
  --orange-soft: #FDEBDC;
  --black: #1E1F22;
  --ink: #1E1F22;
  --gray: #62676F;
  --muted: #8A9099;
  --light: #F2F3F5;
  --border: #D5D8DC;
  --line: #E6E8EB;
  --white: #fff;
  --green: #1a7f45;
  --green-soft: #E3F3EA;
  --red: #C8102E;
  --red-soft: #FBE6E9;
  --blue: #1F5FAD;
  --blue-soft: #E5EEF9;
  --amber: #A86200;
  --amber-soft: #FFF2D9;
  --radius: 4px;
  --side: 220px;
  --font: 'Prompt', 'Segoe UI', Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--light);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--orange-dark); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.muted { color: var(--gray); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.sp { justify-content: space-between; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* ---------- ปุ่ม / ฟอร์ม ---------- */
.btn {
  font: inherit; font-size: 14px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 6px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--white); color: var(--ink); cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--gray); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.primary:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
.btn.dark { background: var(--black); border-color: var(--black); color: #fff; }
.btn.danger { color: var(--red); border-color: #E8B4BD; }
.btn.danger:hover { background: var(--red-soft); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.05); }
.btn.small { min-height: 30px; padding: 3px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn .ic { font-size: 16px; line-height: 1; }

input, select, textarea {
  font: inherit; font-size: 15px; color: var(--ink);
  width: 100%; min-height: 40px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--radius); background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; border-color: var(--orange); }
input[type=checkbox] { width: 18px; min-height: 18px; height: 18px; accent-color: var(--orange); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--gray); font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; cursor: pointer; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.fgrid .span2 { grid-column: span 2; }
.fgrid .full { grid-column: 1 / -1; }
.fgrid > *, .stack > *, .grid-main > *, .grid2 > * { min-width: 0; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 44px; }
.input-suffix span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; pointer-events: none; }
.form-error { color: var(--red); min-height: 1.2em; margin: 0; font-size: 14px; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }

/* ---------- หน้าเข้าสู่ระบบ ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--black); }
.auth-card { width: 100%; max-width: 360px; background: #fff; border-radius: var(--radius); padding: 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.auth-card p { margin: -8px 0 4px; }
.brand-lg { font-size: 24px; font-weight: 400; display: flex; align-items: center; gap: 10px; }
.brand-lg b, .brand b { font-weight: 700; color: var(--orange); }
.logo-dot { width: 12px; height: 12px; background: var(--orange); border-radius: 2px; display: inline-block; transform: rotate(45deg); }

/* ---------- โครงแอป ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: var(--side); flex: none; background: var(--black); color: #fff;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { font-size: 18px; padding: 20px 18px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #2E3035; }
.nav { display: flex; flex-direction: column; padding: 10px 8px; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius);
  color: #C9CCD1; text-decoration: none; font-size: 15px;
}
.nav a .ic { width: 20px; text-align: center; font-size: 16px; }
.nav a:hover { background: #2A2C30; color: #fff; }
.nav a.active { background: var(--orange); color: #fff; }
.side-foot { padding: 14px 16px; border-top: 1px solid #2E3035; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.side-foot .muted { color: #9DA2AA; }
.side-foot .btn.ghost { color: #C9CCD1; padding-left: 0; }
.main { flex: 1; min-width: 0; }
.view { max-width: 1280px; margin: 0 auto; padding: 22px 24px 60px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .sub { color: var(--gray); font-size: 13px; margin-top: 2px; }
.back { color: var(--gray); text-decoration: none; font-size: 14px; display: inline-flex; gap: 4px; margin-bottom: 6px; }

/* ---------- การ์ด ---------- */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head .muted { font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.grid2 > .card + .card, .grid3 > .card + .card, .grid-main > * + .card { margin-top: 0; }

/* ---------- ตัวเลขสรุป ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.kpi .label { font-size: 13px; color: var(--gray); }
.kpi .value { font-size: 24px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .foot { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.hero { background: var(--black); border-color: var(--black); color: #fff; }
.kpi.hero .label, .kpi.hero .foot { color: #A8ADB4; }
.kpi.hero .value.pos { color: #6FD39B; }
.kpi.hero .value.neg { color: #FF8A9B; }
.kpis.sm .value { font-size: 19px; }

.progress { height: 8px; background: var(--light); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress > span { display: block; height: 100%; background: var(--orange); border-radius: 4px; }

/* ---------- ขั้นตอนสถานะ ---------- */
.pipeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pipe { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; text-decoration: none; color: inherit; display: block; }
.pipe:hover { border-color: var(--gray); }
.pipe .n { font-size: 22px; font-weight: 600; }
.pipe .t { font-size: 13px; color: var(--gray); }
.pipe .c { font-size: 12px; color: var(--muted); }

/* ---------- ป้ายสถานะ ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 3px; white-space: nowrap; background: var(--light); color: var(--gray); }
.badge.ordered { background: var(--amber-soft); color: var(--amber); }
.badge.shipping { background: var(--blue-soft); color: var(--blue); }
.badge.arrived { background: var(--green-soft); color: var(--green); }
.badge.soldout { background: var(--black); color: #fff; }
.badge.shop { background: var(--orange-soft); color: var(--orange-dark); }
.badge.src { background: var(--light); color: var(--gray); }

/* ---------- ตาราง ---------- */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--gray); font-size: 12px; padding: 8px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #FAFAFB; }
th.right, td.right { text-align: right; }
tfoot td { font-weight: 600; border-top: 1px solid var(--border); border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* ---------- รายการสินค้า ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type=search] { flex: 1 1 220px; }
.toolbar select { width: auto; flex: 0 1 170px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { font: inherit; font-size: 13px; border: 1px solid var(--border); background: #fff; border-radius: 20px; padding: 4px 12px; cursor: pointer; color: var(--gray); }
.chip.on { background: var(--black); border-color: var(--black); color: #fff; }
.chip b { font-weight: 600; margin-left: 4px; }
.thumb { width: 48px; height: 48px; border-radius: 3px; object-fit: cover; background: var(--light); border: 1px solid var(--line); flex: none; }
.thumb.ph { display: grid; place-items: center; color: var(--muted); font-size: 18px; }
.item-cell { display: flex; gap: 10px; align-items: center; min-width: 220px; }
.item-cell .nm { font-weight: 500; line-height: 1.3; }
.item-cell .meta { font-size: 12px; color: var(--muted); }
.cards-list { display: none; }

/* ---------- ฟอร์มสินค้า ---------- */
.section-title { font-size: 13px; font-weight: 600; color: var(--gray); text-transform: none; margin: 4px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.sum-card { position: sticky; top: 16px; }
.sum-line { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; font-size: 14px; }
.sum-line .k { color: var(--gray); }
.sum-line.total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; font-weight: 600; }
.sum-line.big { font-size: 18px; font-weight: 600; }
.sum-sub { padding-left: 12px; font-size: 13px; }
.sum-sub .k { color: var(--muted); }
.callout { background: var(--orange-soft); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; color: var(--orange-dark); }
.callout.gray { background: var(--light); color: var(--gray); }
.callout.red { background: var(--red-soft); color: var(--red); }

/* ---------- รูปภาพ ---------- */
.img-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.img-tile { position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--light); border: 1px solid var(--line); }
.img-tile img { width: 100%; height: 100%; object-fit: cover; }
.img-tile .cover { position: absolute; left: 4px; top: 4px; background: var(--orange); color: #fff; font-size: 11px; padding: 0 6px; border-radius: 2px; }
.img-tile .acts { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; padding: 4px; background: linear-gradient(transparent, rgba(0,0,0,.55)); opacity: 0; transition: opacity .15s; }
.img-tile:hover .acts, .img-tile:focus-within .acts { opacity: 1; }
.img-tile .acts button { font: inherit; font-size: 12px; border: 0; background: rgba(255,255,255,.92); border-radius: 3px; padding: 2px 7px; cursor: pointer; }
.img-tile .src-tag { position: absolute; right: 4px; top: 4px; font-size: 10px; padding: 0 5px; border-radius: 2px; background: rgba(30,31,34,.75); color: #fff; }
.img-add { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.img-add .btn { flex-direction: column; min-height: 66px; font-size: 13px; gap: 2px; white-space: normal; text-align: center; line-height: 1.25; }
.img-add .btn .ic { font-size: 20px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gallery .g { position: relative; border: 2px solid transparent; border-radius: var(--radius); cursor: pointer; background: #fff; padding: 0; overflow: hidden; text-align: left; font: inherit; }
.gallery .g img { aspect-ratio: 1; width: 100%; object-fit: cover; background: var(--light); }
.gallery .g .cap { font-size: 11px; color: var(--gray); padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-top: 1px solid var(--line); }
.gallery .g.sel { border-color: var(--orange); }
.gallery .g.sel::after { content: '✓'; position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; background: var(--orange); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.gallery .g.broken { display: none; }
.gallery .g .used { position: absolute; left: 6px; top: 6px; font-size: 10px; background: var(--green); color: #fff; padding: 0 5px; border-radius: 2px; }
.gallery .g .src-tag { position: absolute; left: 6px; bottom: 30px; font-size: 10px; padding: 0 5px; border-radius: 2px; background: rgba(30,31,34,.75); color: #fff; }

.store-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow: auto; }
.store-row { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.store-row .imgs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.store-row .imgs button { padding: 0; border: 2px solid transparent; border-radius: 3px; cursor: pointer; background: none; position: relative; }
.store-row .imgs button.sel { border-color: var(--orange); }
.store-row .imgs img { width: 76px; height: 76px; object-fit: cover; border-radius: 2px; }

/* ---------- หน้าต่างลอย ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(20,21,23,.55); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 560px; display: flex; flex-direction: column; max-height: calc(100vh - 80px); }
.modal.wide { max-width: 900px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 8px; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.x { font-size: 22px; line-height: 1; border: 0; background: none; cursor: pointer; color: var(--gray); padding: 4px 8px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--black); color: #fff; padding: 10px 18px; border-radius: var(--radius); opacity: 0; pointer-events: none; transition: all .2s; z-index: 100; font-size: 14px; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); }

/* ---------- กราฟ ---------- */
.chart { width: 100%; position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .zero { stroke: var(--gray); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover { fill: rgba(0,0,0,.035); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--gray); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.tip { position: absolute; pointer-events: none; background: var(--black); color: #fff; font-size: 12px; padding: 8px 10px; border-radius: var(--radius); white-space: nowrap; z-index: 5; display: none; line-height: 1.6; }
.tip b { font-weight: 600; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

.mini-list { display: flex; flex-direction: column; }
.mini-list a, .mini-list div.li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.mini-list a:last-child, .mini-list div.li:last-child { border-bottom: 0; }
.mini-list .thumb { width: 38px; height: 38px; }
.mini-list .nm { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-list .nm small { display: block; color: var(--muted); font-size: 12px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs button { font: inherit; font-size: 14px; border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--gray); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--orange); font-weight: 500; }

/* ---------- มือถือ ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .sum-card { position: static; }
  .grid3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 14px; }
  .shell { flex-direction: column; }
  .side { position: fixed; bottom: 0; top: auto; left: 0; right: 0; width: 100%; height: auto; z-index: 40; flex-direction: row; padding-bottom: env(safe-area-inset-bottom); }
  .brand, .side-foot { display: none; }
  .nav { flex-direction: row; padding: 4px; gap: 0; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 0; padding: 6px 2px; font-size: 10.5px; flex: 1; text-align: center; }
  .nav a .ic { font-size: 18px; width: auto; }
  .view { padding: 14px 16px 90px; }
  h1 { font-size: 19px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .kpi .value { font-size: 20px; }
  .pipeline { grid-template-columns: repeat(2, 1fr); }
  .img-add { grid-template-columns: repeat(2, 1fr); }
  .fgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fgrid .span2 { grid-column: 1 / -1; }
  .table-items { display: none; }
  .cards-list { display: flex; flex-direction: column; gap: 8px; }
  .icard { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; display: flex; gap: 10px; text-decoration: none; color: inherit; }
  .icard .thumb { width: 64px; height: 64px; }
  .icard .body { flex: 1; min-width: 0; }
  .icard .nm { font-weight: 500; line-height: 1.3; }
  .icard .nums { display: flex; gap: 12px; font-size: 12px; color: var(--gray); margin-top: 4px; flex-wrap: wrap; }
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal, .modal.wide { max-height: 92vh; border-radius: 10px 10px 0 0; }
  .gallery { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .toast { bottom: 80px; }
  .img-tile .acts { opacity: 1; }
}
@media (max-width: 380px) {
  .fgrid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* ตัวช่วยแปลงเยน → บาท (ไม่ใช่ยอดที่ใช้คำนวณ แค่เติมช่องบาทให้) */
.yen-box { background: var(--orange-soft); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; }
.yen-box::after { content: '↓ แปลงเป็นบาทใส่ช่องด้านล่างให้อัตโนมัติ'; grid-column: 1 / -1; font-size: 12px; color: var(--orange-dark); }

/* ปุ่มส่งขึ้นขายหน้าเว็บ RST SHOP */
.shop-card { margin-bottom: 14px; border-left: 4px solid var(--border); }
.shop-card.live { border-left-color: var(--green); background: var(--green-soft); }
.shop-card .shop-title { font-weight: 600; }
.shop-card.live .shop-title { color: var(--green); }

/* ---------- กรอกหลายชิ้น (ตารางแบบ Excel) ---------- */
.bulk-def { margin-bottom: 14px; }
.bulk-card { padding: 10px; }
.bulk-scroll { overflow: auto; max-height: calc(100vh - 260px); border: 1px solid var(--line); border-radius: var(--radius); }
.bulk-table { min-width: 1180px; border-collapse: separate; border-spacing: 0; }
.bulk-table th { position: sticky; top: 0; z-index: 2; background: var(--light); padding: 8px 6px; border-bottom: 1px solid var(--border); }
.bulk-table td { padding: 2px 3px; border-bottom: 1px solid var(--line); }
.bulk-table tr.sold td { background: #F4FAF6; }
.bulk-table .cell { min-height: 34px; padding: 4px 6px; font-size: 14px; border: 1px solid transparent; background: transparent; border-radius: 3px; }
.bulk-table .cell:hover { border-color: var(--line); }
.bulk-table .cell:focus { background: #fff; border-color: var(--orange); outline: none; }
.bulk-table .cell.n { text-align: right; font-variant-numeric: tabular-nums; }
.bulk-table select.cell { padding-right: 2px; }
.bulk-table .c-no { width: 36px; text-align: center; font-size: 12px; }
.bulk-table .c-img { width: 62px; }
.bulk-table .c-name { min-width: 240px; }
.bulk-table .c-date { width: 140px; }
.bulk-table .c-src { width: 150px; }
.bulk-table .c-num { width: 96px; }
.bulk-table .c-out { width: 92px; text-align: right; padding-right: 8px; font-size: 14px; }
.bulk-table .c-out .est { opacity: .6; }
.bulk-table .c-out .b { font-weight: 600; }
.bulk-table .c-x { width: 34px; }
.bulk-table .c-x .x { font-size: 18px; padding: 2px 6px; }
.img-btn { width: 52px; height: 40px; border: 1px dashed var(--border); border-radius: 3px; background: #fff; font: inherit; font-size: 11px; color: var(--gray); cursor: pointer; padding: 0; position: relative; overflow: hidden; }
.img-btn img { width: 100%; height: 100%; object-fit: cover; }
.img-btn span { position: absolute; right: 2px; bottom: 2px; background: var(--black); color: #fff; font-size: 10px; padding: 0 4px; border-radius: 2px; }
.img-btn:hover { border-color: var(--orange); }
@media (max-width: 760px) { .bulk-scroll { max-height: calc(100vh - 200px); } }
/* ตรึงคอลัมน์ # / รูป / ชื่อ ไว้ทางซ้ายตอนเลื่อนตารางไปขวา */
.bulk-table .c-no, .bulk-table .c-img, .bulk-table .c-name { position: sticky; z-index: 1; background: #fff; }
.bulk-table th.c-no, .bulk-table th.c-img, .bulk-table th.c-name { z-index: 3; background: var(--light); }
.bulk-table tr.sold td.c-no, .bulk-table tr.sold td.c-img, .bulk-table tr.sold td.c-name { background: #F4FAF6; }
.bulk-table .c-no { left: 0; min-width: 36px; }
.bulk-table .c-img { left: 36px; min-width: 62px; }
.bulk-table .c-name { left: 98px; box-shadow: 1px 0 0 var(--line); }
@media (max-width: 760px) {
  .bulk-table .c-no { display: none; }
  .bulk-table .c-img { left: 0; }
  .bulk-table .c-name { left: 62px; min-width: 160px; }
}

/* ---------- โลโก้ร้าน RST Truck Parts ---------- */
.center { text-align: center; justify-content: center; }
.auth-logo { width: 100%; max-width: 300px; height: auto; margin: -8px auto 0; }
.auth-card .brand-lg { font-size: 20px; }
.brand { flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 14px 12px; text-decoration: none; color: #fff; }
.brand img { width: 100%; height: auto; }
.brand-sub { font-size: 12px; color: #A8ADB4; letter-spacing: .3px; }
.brand-sub b { color: var(--orange); font-weight: 600; }
.mtop { display: none; }
@media (max-width: 760px) {
  .mtop { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 16px; background: var(--black); position: sticky; top: 0; z-index: 30; }
  .mtop img { height: 46px; width: auto; }
}

/* ---------- ซื้อจากญี่ปุ่น / ไทย ---------- */
.origin-toggle { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.origin-toggle .opt { flex-direction: row; cursor: pointer; position: relative; }
.origin-toggle .opt input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; min-height: 0; opacity: 0; pointer-events: none; }
.origin-toggle .opt span { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; color: var(--ink); font-size: 15px; font-weight: 500; }
.origin-toggle .opt input:checked + span { background: var(--black); border-color: var(--black); color: #fff; }
.origin-toggle .opt input:focus-visible + span { outline: 2px solid var(--orange); outline-offset: 1px; }
.origin-box { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }

/* ---------- ตัวช่วยตั้งราคา (ส่วนต่าง) ---------- */
.price-help { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.price-help .ph-title { font-weight: 600; margin-bottom: 6px; }
.price-help table { font-size: 13px; }
.price-help th { padding: 4px 6px; }
.price-help td { padding: 5px 6px; }
.price-help tr.tm td { background: var(--orange-soft); }
.price-help .hint { margin-top: 6px; }

/* ---------- ปุ่มขาย ---------- */
.btn.sell { background: var(--green); border-color: var(--green); color: #fff; }
.btn.sell:hover { background: #146536; border-color: #146536; }
.sold-note { background: var(--green-soft); color: var(--green); }

/* ---------- หน้ารายการสินค้า ---------- */
.big-tabs button { font-size: 15px; padding: 12px 16px; }
.big-tabs button b { font-weight: 600; margin-left: 4px; color: var(--gray); }
.big-tabs button.on b { color: var(--orange-dark); }
.list-sum { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.list-sum > div { background: #fff; padding: 10px 12px; display: flex; flex-direction: column; min-width: 0; }
.list-sum span { font-size: 12px; color: var(--gray); }
.list-sum b { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.items-table td { vertical-align: top; }
.items-table .item-cell { min-width: 200px; }
.cost-parts { display: flex; flex-direction: column; font-size: 12px; color: var(--gray); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bulk-table th.c-num.wide { width: 130px; }
@media (max-width: 760px) {
  .list-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .list-sum > div:first-child { grid-column: 1 / -1; }
  .origin-toggle .opt { flex: 1; }
  .origin-toggle .opt span { width: 100%; justify-content: center; padding: 10px 8px; font-size: 14px; }
}

/* ธงญี่ปุ่น / ไทย (วาดด้วย CSS) */
.flag { display: inline-block; width: 18px; height: 12px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.15); vertical-align: -1px; margin-right: 6px; flex: none; }
.flag.jp { background: radial-gradient(circle at 50% 50%, #BC002D 0 3.6px, #fff 4px); }
.flag.th { background: linear-gradient(#A51931 0 16.66%, #fff 16.66% 33.33%, #2D2A4A 33.33% 66.66%, #fff 66.66% 83.33%, #A51931 83.33%); }
.og { white-space: nowrap; display: inline-flex; align-items: center; }
.tabs { overflow-y: hidden; }

/* ---------- หน้าเพิ่มสินค้าแบบสั้น ---------- */
.flow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.flow b { color: var(--ink); background: var(--orange-soft); padding: 2px 10px; border-radius: 12px; font-weight: 600; }
.flow span { color: var(--border); }
.new-form { max-width: 820px; }
.big-cost input { font-size: 22px; font-weight: 600; min-height: 52px; }
.big-cost .input-suffix span { font-size: 15px; }

/* ---------- ขั้นตอน ① ซื้อ → ② ถึงไทย → ③ ตั้งราคา → ④ ขาย ---------- */
.steps-card { margin-bottom: 14px; padding: 12px; }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.step { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 6px; background: #fff; min-width: 0; }
.step .step-title { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.step .step-body { font-size: 13px; line-height: 1.6; flex: 1; }
.step .step-body b { font-size: 15px; }
.step .btn { align-self: flex-start; }
.step .tick { width: 18px; height: 18px; border-radius: 50%; background: var(--green); color: #fff; font-size: 11px; display: inline-grid; place-items: center; }
.step.done { background: #F7FBF8; border-color: #CFE8D8; }
.step.current { border: 2px solid var(--orange); background: #fff; }
.cost-compare { background: var(--light); border-radius: var(--radius); padding: 10px 12px; }
.more-box { display: flex; flex-direction: column; gap: 12px; }
.more-box > summary { cursor: pointer; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; font-weight: 500; list-style: none; }
.more-box > summary::-webkit-details-marker { display: none; }
.more-box > summary::before { content: '▸ '; color: var(--gray); }
.more-box[open] > summary::before { content: '▾ '; }
.more-box[open] > summary { margin-bottom: 12px; }
.more-box > .card + .card { margin-top: 12px; }
@media (max-width: 1100px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .steps { grid-template-columns: minmax(0, 1fr); } }
.order-total { align-self: end; background: var(--light); border-radius: var(--radius); padding: 9px 12px; font-size: 14px; }
.order-total b { font-size: 16px; }
.order-total .muted { display: block; font-size: 12px; }
