/* iCodeDev — mobile-first */
:root {
  --bg: #f7f8fb; --surface: #fff; --text: #172033; --muted: #5d6779; --line: #e3e7ef;
  --brand: #1d4ed8; --brand-ink: #fff; --brand-soft: #e8efff; --accent: #0ea5e9;
  --warn-bg: #fff6db; --warn-ink: #7a5a00; --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141d; --surface: #171e2a; --text: #e8ecf3; --muted: #9aa5b8; --line: #283244;
    --brand: #5b8cff; --brand-ink: #0b1020; --brand-soft: #1c2943; --accent: #38bdf8;
    --warn-bg: #3a3112; --warn-ink: #f5d77a; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", "Noto Sans Thai", "Sarabun", sans-serif;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 6vw, 3rem); }
h2 { font-size: clamp(1.4rem, 4vw, 1.9rem); }
h3 { font-size: 1.15rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 16px; }
.section { padding-block: 40px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; z-index: 10; background: var(--surface); padding: 8px 12px; }

.preview-bar { background: var(--warn-bg); color: var(--warn-ink); text-align: center; font-size: .85rem; padding: 6px 16px; }

/* header + เมนูมือถือ (ไม่ต้องใช้ JS) */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 2px; font-size: 1.25rem; font-weight: 600; color: var(--text); text-decoration: none; }
.logo b { color: var(--brand); }
.logo-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 6px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-button { width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; }
.nav-button span, .nav-button span::before, .nav-button span::after { display: block; width: 22px; height: 2px; background: var(--text); position: relative; content: ""; }
.nav-button span::before { position: absolute; top: -7px; }
.nav-button span::after { position: absolute; top: 7px; }
.nav { display: none; width: 100%; flex-direction: column; padding-bottom: 12px; }
.nav a { padding: 10px 4px; text-decoration: none; color: var(--text); }
.nav-toggle:checked ~ .nav { display: flex; }
.nav-toggle:focus-visible + .nav-button { outline: 2px solid var(--brand); }
@media (min-width: 820px) {
  .nav-button { display: none; }
  .nav { display: flex; width: auto; flex-direction: row; align-items: center; gap: 8px; padding: 0; }
  .nav a { padding: 8px 10px; }
}

/* ปุ่ม */
.btn { display: inline-block; background: var(--brand); color: var(--brand-ink) !important; padding: 12px 20px; border-radius: 10px; text-decoration: none; font-weight: 600; border: 0; cursor: pointer; font-size: 1rem; }
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--brand) !important; box-shadow: inset 0 0 0 2px var(--brand); }
.btn-small { padding: 8px 14px; }

/* hero */
.hero { background: linear-gradient(135deg, var(--brand-soft), transparent 70%); padding-block: 56px 40px; }
.hero .accent { color: var(--brand); }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 640px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }

/* การ์ดสินค้า */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a:hover { color: var(--brand); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tile { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 1.2rem; }
.badge { font-size: .75rem; background: var(--warn-bg); color: var(--warn-ink); padding: 3px 10px; border-radius: 999px; }
.price { margin: 8px 0 0; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 40px; padding-block: 28px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }

/* ---- S1 ---- */
.nav a[aria-current="page"] { color: var(--brand); font-weight: 600; }
.h3 { font-size: 1.15rem; }
.narrow { max-width: 820px; }
.center { text-align: center; }
.center-row { justify-content: center; }
.big-code { font-size: 4rem; font-weight: 700; color: var(--brand); margin: 0; line-height: 1; }
.hero-small { padding-block: 28px 20px; }
.crumbs { color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }
.product-title { display: flex; gap: 16px; align-items: center; }
.product-title h1 { margin: 0; }
.product-title .lead { margin: 4px 0 0; }
.tile svg { display: block; }
.tile-lg { width: 64px; height: 64px; border-radius: 18px; flex: none; }
.tile-sm { width: 30px; height: 30px; border-radius: 8px; margin-right: 10px; vertical-align: middle; flex: none; }
.badge-brand { background: var(--brand); color: var(--brand-ink); }
.product-card { position: relative; }
.stretched::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.product-card:hover { border-color: var(--brand); }
.card-accent { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-bottom: 16px; }
.two-col { display: grid; gap: 24px; }
@media (min-width: 820px) { .two-col { grid-template-columns: 3fr 2fr; align-items: start; } }
.prose p { margin: 0 0 1em; font-size: 1.05rem; }
.checks { list-style: none; padding: 0; margin: 12px 0; }
.checks li { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; }
.checks svg { color: var(--brand); flex: none; margin-top: 4px; }

.plans { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.plan { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 20px 20px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.plan .btn-block { margin-top: auto; }
.plan-featured { border: 2px solid var(--brand); }
.plan-flag { position: absolute; top: -12px; left: 20px; background: var(--brand); color: var(--brand-ink); font-size: .8rem; font-weight: 600; padding: 2px 12px; border-radius: 999px; }
.plan-price { font-size: 1.8rem; font-weight: 700; margin: 4px 0; }
.btn-block { display: block; text-align: center; }
.note { margin-top: 12px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.price-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.price-table th, .price-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.price-table thead th { font-size: .9rem; color: var(--muted); font-weight: 600; }
.price-table tbody tr:last-child > * { border-bottom: 0; }
.price-table td { white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-link { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; font-weight: 600; }
.save { color: #15803d; font-size: .8rem; font-weight: 600; }
@media (prefers-color-scheme: dark) { .save { color: #4ade80; } }

.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 10px 0 0; color: var(--muted); }
.notice { margin-top: 20px; background: var(--brand-soft); border-color: transparent; }
.empty { text-align: center; padding: 36px 20px; }
.shot { display: block; width: 100%; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); margin-top: 8px; }

/* ---- S3: ฟอร์มสาธารณะ ---- */
.form label { display: block; margin-bottom: 14px; font-weight: 600; }
.form input:not([type=checkbox]):not([type=file]), .form textarea, .form select {
  display: block; width: 100%; margin-top: 6px; font: inherit; font-weight: 400; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text);
}
.form input:focus, .form textarea:focus, .form select:focus { outline: 2px solid var(--brand); border-color: transparent; }
.form .row { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form .hint { font-weight: 400; color: var(--muted); font-size: .85rem; margin: -8px 0 14px; }
.form .check-label { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.form .check-label input { width: 20px; height: 20px; margin-top: 3px; flex: none; accent-color: var(--brand); }
.form .privacy { margin: 14px 0 0; }
.req { color: #b91c1c; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-error { background: #fdecec; color: #8a1c1c; padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; }
.form-error ul { margin: 6px 0 0; padding-left: 20px; }
@media (prefers-color-scheme: dark) { .form-error { background: #3b1717; color: #fca5a5; } }

/* ---- S4: ข่าวสาร ---- */
.title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.post-card h3 { margin-top: 4px; }
.post-thumb { width: calc(100% + 40px); max-width: none; margin: -20px -20px 14px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; display: block; }
.pager { display: flex; gap: 16px; align-items: center; margin-top: 20px; }
.cover { margin: 8px 0 24px; }
.article h2 { margin-top: 1.4em; }
.article ul, .article ol { padding-left: 1.4em; }
.article li { margin-bottom: .3em; }
.article blockquote { margin: 1em 0; padding: 4px 16px; border-left: 4px solid var(--brand); color: var(--muted); }
.article pre { background: var(--surface); border: 1px solid var(--line); padding: 12px; border-radius: 10px; overflow-x: auto; }
.article img { border-radius: 10px; }
.article table { border-collapse: collapse; display: block; overflow-x: auto; }
.article th, .article td { border: 1px solid var(--line); padding: 6px 10px; }
.draft-flag { background: var(--warn-bg); color: var(--warn-ink); padding: 8px 14px; border-radius: 10px; }
.center-block { margin-inline: auto; }

/* ---- D1: หน้า Demo ---- */
[hidden] { display: none !important; }
.demo-link { margin: 12px 0 0; }
.demo-chip { color: var(--brand); font-weight: 600; margin: 0 0 4px; }
.app-window { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); box-shadow: 0 10px 40px rgba(16, 24, 40, .12); margin-top: 8px; }
.app-titlebar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.dots { display: inline-flex; gap: 6px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: #f87171; display: block; }
.dots i:nth-child(2) { background: #fbbf24; }
.dots i:nth-child(3) { background: #34d399; }
.app-name { font-weight: 600; font-size: .95rem; }
.demo-flag { margin-left: auto; font-size: .75rem; background: var(--warn-bg); color: var(--warn-ink); padding: 2px 10px; border-radius: 999px; }
.app-body { display: grid; }
.app-tabs { display: flex; overflow-x: auto; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); background: var(--bg); }
.app-tab { white-space: nowrap; padding: 8px 14px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: .95rem; }
.app-tab[aria-current="page"] { background: var(--brand); color: var(--brand-ink); }
@media (min-width: 900px) {
  .app-body { grid-template-columns: 200px 1fr; }
  .app-tabs { flex-direction: column; border-bottom: 0; border-right: 1px solid var(--line); padding: 12px; }
}
.app-screens { padding: 16px; min-width: 0; }
.screen + .screen { margin-top: 32px; padding-top: 24px; border-top: 1px dashed var(--line); }
.js .screen:not(.active) { display: none; }
.js .screen + .screen { margin-top: 0; padding-top: 0; border-top: 0; }
.screen-title { font-size: 1.25rem; outline: none; }
.feature-note { margin-top: 18px; background: var(--brand-soft); border-radius: 12px; padding: 12px 16px; }
.feature-note p { margin: 4px 0 0; }
.h4 { font-size: 1rem; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 6px 14px; cursor: pointer; font: inherit; font-size: .9rem; }
.chip.is-on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.demo-cta { margin-block: 24px 0; }

/* POS */
.pos-sell { display: grid; gap: 16px; }
@media (min-width: 760px) { .pos-sell { grid-template-columns: 1fr 300px; align-items: start; } }
.pos-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.pos-item { display: flex; flex-direction: column; justify-content: space-between; min-height: 84px; padding: 12px; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); cursor: pointer; font: inherit; }
.pos-item:hover, .pos-item:focus-visible { border-color: var(--brand); }
.pos-item:active { transform: scale(.98); }
.pos-item-name { font-weight: 600; line-height: 1.3; }
.pos-item-price { color: var(--brand); font-weight: 700; margin-top: 6px; }
.pos-cart { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--bg); }
.cart-items { list-style: none; padding: 0; margin: 0 0 12px; max-height: 260px; overflow-y: auto; }
.cart-line { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.cart-name { font-size: .95rem; }
.qty { display: inline-flex; align-items: center; gap: 6px; }
.qty button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; font-size: 1rem; line-height: 1; }
.cart-price { min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.empty-cart { padding: 12px 0; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0 0 12px; font-variant-numeric: tabular-nums; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; text-align: right; }
.totals .grand { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.cart-actions { display: flex; justify-content: space-between; gap: 8px; }
.pay-total { font-size: 1.15rem; }
.pay-total b { font-size: 1.6rem; color: var(--brand); }
.pay-panel { margin-bottom: 16px; }
.cash-input { display: block; font-weight: 600; max-width: 260px; }
.cash-input input, .search-box input { display: block; width: 100%; margin-top: 6px; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); }
.change { font-size: 1.1rem; }
.change b { color: #15803d; }
.qr-mock { width: 168px; height: 168px; margin: 0 auto 8px; border: 10px solid #fff; border-radius: 8px; background-color: #fff;
  background-image: linear-gradient(90deg, #111 50%, transparent 50%), linear-gradient(#111 50%, transparent 50%);
  background-size: 24px 24px, 16px 16px; box-shadow: 0 0 0 1px var(--line); }
.search-box { display: block; font-weight: 600; max-width: 320px; margin-bottom: 12px; }
.demo-table td, .demo-table th { white-space: nowrap; }
.tier { font-size: .8rem; padding: 2px 10px; border-radius: 999px; }
.tier-gold { background: #fef3c7; color: #92400e; }
.tier-silver { background: #e5e7eb; color: #374151; }
.stat-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 20px; }
.mini-stat { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; }
.mini-stat b { font-size: 1.5rem; }
.two-col-demo { display: grid; gap: 24px; }
@media (min-width: 760px) { .two-col-demo { grid-template-columns: 1fr 1fr; } }
.bar-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; margin-bottom: 8px; font-size: .95rem; }
.bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.receipt { max-width: 320px; margin: 0 auto; background: #fffef8; color: #222; padding: 18px; font-family: ui-monospace, Menlo, Consolas, "Noto Sans Thai", monospace; font-size: .9rem; border-radius: 4px; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }
.receipt-items { list-style: none; padding: 8px 0; margin: 8px 0; border-top: 1px dashed #999; border-bottom: 1px dashed #999; }
.receipt-items li, .receipt-line { display: flex; justify-content: space-between; gap: 8px; margin: 2px 0; }
@media (prefers-color-scheme: dark) {
  .change b { color: #4ade80; }
  .tier-gold { background: #3d2f0b; color: #fcd34d; }
  .tier-silver { background: #2e3440; color: #d1d5db; }
}
.w-0 { width: 0%; }
.w-5 { width: 5%; }
.w-10 { width: 10%; }
.w-15 { width: 15%; }
.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-30 { width: 30%; }
.w-35 { width: 35%; }
.w-40 { width: 40%; }
.w-45 { width: 45%; }
.w-50 { width: 50%; }
.w-55 { width: 55%; }
.w-60 { width: 60%; }
.w-65 { width: 65%; }
.w-70 { width: 70%; }
.w-75 { width: 75%; }
.w-80 { width: 80%; }
.w-85 { width: 85%; }
.w-90 { width: 90%; }
.w-95 { width: 95%; }
.w-100 { width: 100%; }

/* ---- D2: Demo คลินิก ---- */
.warn-stat b { color: #b45309; }
.queue-board { display: grid; gap: 16px; }
@media (min-width: 760px) { .queue-board { grid-template-columns: 220px 1fr; align-items: start; } }
.now-calling { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px; border-radius: 14px; background: var(--brand); color: var(--brand-ink); text-align: center; }
.now-calling .muted { color: inherit; opacity: .85; }
.now-calling b { font-size: 2.6rem; line-height: 1; letter-spacing: .04em; }
.now-calling .btn { background: var(--brand-ink); color: var(--brand) !important; }
.now-calling .btn:disabled { opacity: .6; cursor: default; }
.queue-list { list-style: none; padding: 0; margin: 0; }
.queue-list li { display: grid; grid-template-columns: 60px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.queue-list li[data-queue="done"] { opacity: .55; }
.queue-list li[data-queue="calling"] { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.q-status { font-size: .8rem; padding: 2px 10px; border-radius: 999px; background: var(--line); white-space: nowrap; }
li[data-queue="calling"] .q-status { background: var(--brand); color: var(--brand-ink); }
li[data-queue="waiting"] .q-status { background: var(--warn-bg); color: var(--warn-ink); }
.schedule td { vertical-align: top; min-width: 160px; }
.appt { display: block; padding: 6px 10px; border-radius: 8px; border-left: 4px solid var(--brand); background: var(--brand-soft); font-size: .9rem; white-space: normal; }
.appt-pending { border-left-color: #d97706; background: var(--warn-bg); }
.appt-online { border-left-color: #059669; background: #e7f8ee; }
.patient-card { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; }
.pt-name { font-size: 1.15rem; }
.patient-card p { margin: 2px 0 0; }
.allergy { background: #fdecec; color: #8a1c1c; padding: 8px 12px; border-radius: 10px; margin: 0; }
.visits details { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.visits summary { cursor: pointer; }
.visit-detail { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 10px 0 0; }
.visit-detail dt { color: var(--muted); }
.visit-detail dd { margin: 0; }
.rx-table td:nth-child(2) { white-space: normal; min-width: 180px; }
.low-badge { font-size: .75rem; background: #fdecec; color: #8a1c1c; padding: 1px 8px; border-radius: 999px; }
.rx-table + .allergy { margin-top: 12px; }
.docs-row { display: grid; gap: 20px; }
@media (min-width: 760px) { .docs-row { grid-template-columns: 1fr 1fr; align-items: start; } }
.cert p { line-height: 1.8; }
.right { text-align: right; }
@media (prefers-color-scheme: dark) {
  .appt-online { background: #133222; }
  .allergy, .low-badge { background: #3b1717; color: #fca5a5; }
  .warn-stat b { color: #fbbf24; }
}

/* ---- D3: Demo คลังสินค้า + iService ---- */
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.low-text { color: #b91c1c; }
.move { font-size: .75rem; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.move-in { background: #e7f8ee; color: #14532d; }
.move-out { background: #fdecec; color: #8a1c1c; }
.move-tr { background: var(--brand-soft); color: var(--brand); }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: end; margin-bottom: 12px; }
.filter-bar .search-box { margin-bottom: 0; }
.check-inline { display: inline-flex; gap: 8px; align-items: center; padding-bottom: 10px; }
.check-inline input { width: 18px; height: 18px; accent-color: var(--brand); }
.scan-box { border: 1px dashed var(--line); border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.scan-result { margin: 8px 0 0; font-weight: 600; }
.scan-result.found { color: #15803d; }
.scan-result.missing { color: #b91c1c; }
.transfer-list { display: grid; gap: 12px; }
.transfer p { margin: 0 0 10px; }
.steps { display: flex; list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { flex: 1; position: relative; text-align: center; font-size: .85rem; color: var(--muted); padding-top: 30px; counter-increment: s; }
.steps li::before { content: counter(s); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 24px; height: 24px; line-height: 24px; border-radius: 50%; background: var(--line); color: var(--muted); font-weight: 700; z-index: 1; }
.steps li::after { content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--line); }
.steps li:first-child::after { display: none; }
.steps li.done, .steps li.current { color: var(--text); }
.steps li.done::before { background: var(--brand); color: var(--brand-ink); }
.steps li.done::after, .steps li.current::after { background: var(--brand); }
.steps li.current::before { background: var(--warn-bg); color: var(--warn-ink); box-shadow: 0 0 0 2px var(--brand); }
.legend { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.key-in, .bar-in { background: #059669 !important; }
.key-out, .bar-out { background: #dc2626 !important; }
.bar-row-2 { grid-template-columns: 50px 1fr auto; }
.bars { display: grid; gap: 4px; }
.kanban { display: grid; gap: 12px; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); overflow-x: auto; padding-bottom: 6px; }
.kcol { background: var(--bg); border-radius: 12px; padding: 10px; min-height: 160px; }
.kcount { display: inline-block; min-width: 22px; text-align: center; font-size: .8rem; background: var(--line); border-radius: 999px; padding: 0 6px; }
.kcards { display: grid; gap: 8px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.kcard p { margin: 6px 0; }
.kcard.moved { animation: pop .4s ease; }
@keyframes pop { from { transform: scale(.96); box-shadow: 0 0 0 2px var(--brand); } to { transform: none; } }
.doc { max-width: 560px; border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.doc-grid { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.doc-grid dt { color: var(--muted); }
.doc-grid dd { margin: 0; }
.grand-row th, .grand-row td { font-weight: 700; font-size: 1.05rem; }
.phone-preview { max-width: 360px; border: 1px solid var(--line); border-radius: 22px; padding: 16px; background: var(--bg); }
.bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 10px 14px; margin: 0; }
@media (prefers-color-scheme: dark) {
  .low-text, .scan-result.missing { color: #f87171; }
  .scan-result.found { color: #4ade80; }
  .move-in { background: #133222; color: #a7f3c4; }
  .move-out { background: #3b1717; color: #fca5a5; }
}

/* ---- D4: Demo ขายสินค้า + ภาษี ---- */
.wrap-cell { white-space: normal !important; min-width: 160px; }
.channel { font-size: .75rem; padding: 1px 8px; border-radius: 999px; white-space: nowrap; background: var(--line); }
.ch-web { background: var(--brand-soft); color: var(--brand); }
.ch-social { background: #ede9fe; color: #5b21b6; }
.ch-chat { background: #e7f8ee; color: #14532d; }
.ch-market { background: #ffedd5; color: #9a3412; }
.variant-table td { text-align: center; }
.variant-table td.out { color: #b91c1c; font-weight: 600; }
.variant-table td.lowq { color: #b45309; font-weight: 600; }
.ship-label { max-width: 380px; border: 2px solid #222; border-radius: 6px; padding: 14px; background: #fff; color: #111; }
.ship-label .muted { color: #555; }
.label-head { display: flex; justify-content: space-between; font-size: .9rem; border-bottom: 2px solid #222; padding-bottom: 8px; margin-bottom: 10px; }
.label-barcode { height: 56px; background: repeating-linear-gradient(90deg, #111 0 2px, #fff 2px 4px, #111 4px 7px, #fff 7px 9px, #111 9px 10px, #fff 10px 13px); }
.label-track { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .15em; margin: 4px 0 10px; }
.label-grid { display: grid; gap: 10px; border-top: 1px dashed #999; padding-top: 10px; }
.label-grid p { margin: 2px 0 0; }
.pp30 { max-width: 520px; }
.pp30-grid { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 0; font-variant-numeric: tabular-nums; }
.pp30-grid dt { color: var(--muted); }
.pp30-grid dd { margin: 0; text-align: right; }
.pp30-grid .pp30-result { color: var(--text); font-weight: 700; font-size: 1.1rem; border-top: 2px solid var(--line); padding-top: 8px; }
@media (prefers-color-scheme: dark) {
  .ch-social { background: #2e1f4d; color: #c4b5fd; }
  .ch-chat { background: #133222; color: #a7f3c4; }
  .ch-market { background: #3d2410; color: #fdba74; }
}
