/* SKG 泰国店员端 · 亮色移动端 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --brand: #0E9F8F; --brand-dark: #0B7F73; --brand-bg: #E5F5F3;
  --bg: #F4F6F6; --card: #fff; --ink: #17322F; --muted: #6B7F7C; --line: #E3EAE9;
  --amber: #B87A00; --amber-bg: #FFF4DC; --green: #1F9254; --green-bg: #E3F5EB;
  --red: #C2402A; --red-bg: #FDEAE5; --blue: #2563EB; --blue-bg: #E8EFFD;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
html, body { height: 100%; }
body { font-family: -apple-system, "Noto Sans Thai", "Sarabun", Roboto, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 16px; }
.hidden { display: none !important; }
button { font: inherit; border: 0; cursor: pointer; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }

/* 登录 */
.login { min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #0E9F8F 0%, #0B7F73 55%, #085E55 100%); padding: 24px; }
.login-card { background: #fff; border-radius: 20px; padding: 32px 24px; width: 100%; max-width: 360px;
  display: flex; flex-direction: column; gap: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.25); }
.login-logo { font-size: 34px; font-weight: 800; letter-spacing: 4px; color: var(--brand); text-align: center; }
.login-sub { text-align: center; color: var(--muted); margin-top: -10px; }
.login-card input[type=text], .login-card input:not([type]), .login-card input[type=password] {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 14px; font-size: 16px; width: 100%; }
.login-card input:focus { outline: none; border-color: var(--brand); }
.remember { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; }
.btn-primary { background: var(--brand); color: #fff; border-radius: 12px; padding: 14px; font-size: 17px; font-weight: 700; }
.btn-primary:active { background: var(--brand-dark); }
.btn-primary[disabled] { opacity: .55; }
.login-err { color: var(--red); text-align: center; font-size: 14px; min-height: 18px; }
.lang-row { display: flex; justify-content: center; gap: 10px; }
.lang-btn { padding: 6px 16px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.lang-btn.on { background: var(--brand-bg); color: var(--brand); border-color: var(--brand); font-weight: 700; }

/* 壳 */
#topbar { position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 16px 10px; }
#top-title { font-weight: 800; font-size: 18px; }
#lang-toggle { border: 1px solid var(--line); border-radius: 99px; padding: 5px 14px; font-size: 13px; color: var(--brand); font-weight: 700; }
#view { padding: 16px 16px calc(86px + var(--safe-b)); max-width: 560px; margin: 0 auto; }
#tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: #fff;
  border-top: 1px solid var(--line); display: flex; padding-bottom: var(--safe-b); }
#tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 6px; text-decoration: none; color: var(--muted); font-size: 11px; }
#tabbar a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#tabbar a.on { color: var(--brand); font-weight: 700; }
.tab-scan .scan-circle { width: 46px; height: 46px; margin-top: -22px; border-radius: 50%;
  background: var(--brand); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(14,159,143,.4); }
.tab-scan .scan-circle svg { stroke: #fff !important; width: 24px; height: 24px; }

/* 通用卡片 */
.card { background: var(--card); border-radius: 14px; padding: 16px; margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(23,50,47,.05); }
.h2 { font-size: 15px; font-weight: 800; margin-bottom: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.badge.pending { background: var(--amber-bg); color: var(--amber); }
.badge.approved { background: var(--blue-bg); color: var(--blue); }
.badge.settled { background: var(--green-bg); color: var(--green); }
.badge.rejected { background: var(--red-bg); color: var(--red); }
.badge.draft { background: var(--amber-bg); color: var(--amber); }

/* 首页 */
.hero { background: linear-gradient(140deg, var(--brand), var(--brand-dark)); color: #fff;
  border-radius: 16px; padding: 20px 18px; margin-bottom: 14px; }
.hero .hi { font-size: 19px; font-weight: 800; }
.hero .store { opacity: .85; font-size: 13px; margin-top: 3px; }
.hero .units { margin-top: 14px; font-size: 13px; opacity: .9; }
.hero .units b { font-size: 30px; font-weight: 800; margin-right: 4px; }
.tri { display: flex; gap: 8px; margin-bottom: 14px; }
.tri .t { flex: 1; border-radius: 12px; padding: 12px 10px; text-align: center; }
.tri .t .v { font-size: 17px; font-weight: 800; margin-top: 2px; }
.tri .amber { background: var(--amber-bg); color: var(--amber); }
.tri .blue { background: var(--blue-bg); color: var(--blue); }
.tri .green { background: var(--green-bg); color: var(--green); }
.tri .lbl { font-size: 11.5px; }
.big-actions { display: flex; gap: 10px; }
.big-actions a { flex: 1; background: #fff; border-radius: 14px; padding: 18px 12px; text-align: center;
  text-decoration: none; color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(23,50,47,.06); }
.big-actions svg { width: 30px; height: 30px; stroke: var(--brand); fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; margin-bottom: 6px; }

/* 产品 */
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pcard { background: #fff; border-radius: 14px; overflow: hidden; text-decoration: none; color: var(--ink);
  box-shadow: 0 1px 3px rgba(23,50,47,.06); position: relative; }
.pcard img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #fafafa; }
.pcard .pin { padding: 9px 10px 11px; }
.pcard .sku { font-weight: 800; font-size: 14px; }
.pcard .cat { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.pcard .price { color: var(--brand-dark); font-weight: 800; margin-top: 5px; font-size: 15px; }
.pcard .reb { position: absolute; top: 8px; right: 8px; background: rgba(184,122,0,.92); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 99px; padding: 2px 8px; }
.pd-img { width: 100%; border-radius: 14px; background: #fff; display: block; }
.pd-name { font-size: 16px; font-weight: 800; margin: 12px 0 4px; }
.pd-price { font-size: 22px; color: var(--brand-dark); font-weight: 800; }
.pd-reb { display: inline-block; margin-left: 8px; background: var(--amber-bg); color: var(--amber);
  border-radius: 8px; padding: 2px 10px; font-size: 13px; font-weight: 700; }
.spec-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.spec-table td { padding: 7px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.spec-table td:first-child { color: var(--muted); width: 42%; }
.pitch-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; font-size: 14.5px; line-height: 1.55; }
.pitch-item .copy { float: right; color: var(--brand); font-size: 12.5px; font-weight: 700; padding: 2px 6px; }
.acc { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; overflow: hidden; }
.acc summary { padding: 11px 12px; font-weight: 700; font-size: 14px; cursor: pointer; list-style: none; }
.acc summary::-webkit-details-marker { display: none; }
.acc .body { padding: 0 12px 12px; font-size: 14px; color: #2c4340; line-height: 1.55; }
video { width: 100%; border-radius: 12px; background: #000; }
.back { color: var(--brand); font-weight: 700; text-decoration: none; font-size: 14px; display: inline-block; margin-bottom: 10px; }

/* AI 问答 */
.chat { display: flex; flex-direction: column; gap: 10px; min-height: 55dvh; }
.msg { max-width: 86%; padding: 11px 14px; border-radius: 16px; line-height: 1.55; font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(23,50,47,.06); }
.msg.ai a { color: var(--brand); font-weight: 700; }
.msg.typing span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  margin-right: 4px; animation: blink 1.2s infinite; }
.msg.typing span:nth-child(2) { animation-delay: .2s; } .msg.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .25 } 40% { opacity: 1 } }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; -webkit-overflow-scrolling: touch; }
.chips button { flex: 0 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 99px;
  padding: 7px 14px; font-size: 13.5px; color: var(--ink); }
.ask-bar { position: fixed; left: 0; right: 0; bottom: calc(64px + var(--safe-b)); background: var(--bg);
  padding: 8px 16px; display: flex; gap: 8px; max-width: 560px; margin: 0 auto; }
.ask-bar input { flex: 1; border: 1.5px solid var(--line); border-radius: 99px; padding: 11px 16px; background: #fff; }
.ask-bar input:focus { outline: none; border-color: var(--brand); }
.ask-bar button { background: var(--brand); color: #fff; border-radius: 50%; width: 44px; height: 44px; flex: 0 0 44px; font-size: 18px; }
#view.view-ask { padding-bottom: calc(140px + var(--safe-b)); }

/* 拍小票 */
.scan-hero { text-align: center; padding: 26px 16px; }
.scan-hero .ico { width: 84px; height: 84px; border-radius: 50%; background: var(--brand-bg);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.scan-hero .ico svg { width: 40px; height: 40px; stroke: var(--brand); fill: none; stroke-width: 1.7; stroke-linecap: round; }
.scan-note { font-size: 13px; color: var(--muted); margin-top: 10px; line-height: 1.6; }
.btn-line { border: 1.5px solid var(--brand); color: var(--brand); border-radius: 12px; padding: 12px; font-weight: 700; width: 100%; margin-top: 10px; }
.preview-img { width: 100%; border-radius: 14px; }
.itbl { width: 100%; font-size: 14px; border-collapse: collapse; }
.itbl th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; padding: 4px; }
.itbl td { padding: 4px; }
.itbl select, .itbl input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 6px; background: #fff; font-size: 14px; }
.itbl tr.low select, .itbl tr.low input { background: var(--amber-bg); }
.itbl .del { color: var(--red); font-size: 18px; padding: 4px 8px; }
.row-add { color: var(--brand); font-weight: 700; font-size: 14px; padding: 8px 4px; }
.sum-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 4px; font-size: 15px; }
.sum-row b.reb { color: var(--amber); font-size: 20px; }
.field-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; font-size: 14px; }
.field-row input { border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #fff; }
.ok-hero { text-align: center; padding: 40px 16px; }
.ok-hero .big { font-size: 44px; }
.ok-hero .amt { font-size: 30px; font-weight: 800; color: var(--amber); margin: 8px 0 2px; }
.spin { display: inline-block; width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; animation: rot .8s linear infinite; vertical-align: -4px; margin-right: 8px; }
.spin.dark { border-color: rgba(14,159,143,.25); border-top-color: var(--brand); }
@keyframes rot { to { transform: rotate(360deg) } }

/* 返点 */
.rec { display: flex; gap: 10px; background: #fff; border-radius: 14px; padding: 12px; margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(23,50,47,.05); }
.rec img { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; background: #f0f0f0; }
.rec .noimg { width: 54px; height: 54px; border-radius: 10px; background: var(--brand-bg); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-size: 22px; }
.rec .mid { flex: 1; min-width: 0; }
.rec .sku-line { font-weight: 700; font-size: 14px; }
.rec .date { font-size: 12px; color: var(--muted); margin-top: 2px; }
.rec .right { text-align: right; }
.rec .amt { font-weight: 800; color: var(--amber); font-size: 15px; margin-bottom: 4px; }
.rec .note { font-size: 12px; color: var(--red); margin-top: 4px; }
/* 账号条（含切换账号） */
.acct-row { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 14px;
  padding: 12px 14px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(23,50,47,.06); }
.acct-ava { width: 44px; height: 44px; border-radius: 50%; background: var(--brand-bg);
  display: flex; align-items: center; justify-content: center; font-size: 22px; flex: 0 0 44px; }
.acct-info { flex: 1; min-width: 0; }
.acct-name { font-weight: 800; font-size: 16px; }
.acct-store { font-size: 12.5px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#switch-acct { border: 1.5px solid var(--line); color: var(--brand); border-radius: 99px;
  padding: 8px 14px; font-size: 13px; font-weight: 700; flex: 0 0 auto; }
/* 首页主按钮：拍小票 */
.primary-cta { display: flex; align-items: center; justify-content: center; gap: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff;
  border-radius: 16px; padding: 22px 16px; margin-bottom: 12px; text-decoration: none;
  font-size: 19px; font-weight: 800; box-shadow: 0 8px 22px rgba(14,159,143,.35); }
.primary-cta svg { width: 32px; height: 32px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; }
.primary-cta:active { transform: scale(.985); }
/* 返点钱数卡 */
.money-card { display: block; background: #fff; border-radius: 16px; padding: 16px;
  text-decoration: none; color: var(--ink); box-shadow: 0 1px 3px rgba(23,50,47,.06); }
.mc-label { font-size: 13px; color: var(--muted); }
.mc-big { font-size: 38px; font-weight: 800; color: var(--amber); margin: 2px 0 10px; }
.mc-chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* 搜索 + 语音 */
.searchbar { display: flex; align-items: center; gap: 8px; background: #fff; border: 1.5px solid var(--line);
  border-radius: 14px; padding: 4px 6px 4px 14px; margin-bottom: 12px; }
.searchbar > svg { width: 20px; height: 20px; stroke: var(--muted); fill: none; stroke-width: 2; stroke-linecap: round; flex: 0 0 20px; }
.searchbar input { flex: 1; border: 0; padding: 11px 0; font-size: 16px; background: none; min-width: 0; }
.searchbar input:focus { outline: none; }
.mic-btn { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%; background: var(--brand-bg);
  display: flex; align-items: center; justify-content: center; }
.mic-btn svg { width: 21px; height: 21px; stroke: var(--brand); fill: none; stroke-width: 1.9; stroke-linecap: round; }
.mic-btn.rec { background: var(--red); animation: pulse 1s infinite; }
.mic-btn.rec svg { stroke: #fff; }
.mic-btn.busy { opacity: .5; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(194,64,42,.5) } 50% { box-shadow: 0 0 0 9px rgba(194,64,42,0) } }
/* 首页两个大拍照按钮 */
.big-actions.photo2 { margin-bottom: 12px; }
.big-actions.photo2 > * { padding: 20px 10px; font-size: 15px; line-height: 1.35; }
.big-actions.photo2 svg { width: 36px; height: 36px; }
.big-actions button { flex: 1; background: #fff; border-radius: 14px; text-align: center; font-weight: 700;
  box-shadow: 0 1px 3px rgba(23,50,47,.06); color: var(--ink); }
.big-actions button svg { stroke: var(--brand); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 6px; }
/* 详情页返点大条 */
.reb-banner { margin-top: 10px; background: linear-gradient(120deg, #FFB300, #FF8A00); color: #fff;
  border-radius: 14px; padding: 14px 16px; font-size: 17px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(255,138,0,.35); }
.reb-banner b { font-size: 24px; margin-left: 4px; }
/* 拍S/N 小按钮 */
.sn-cam { background: var(--brand-bg); color: var(--brand); border-radius: 99px; padding: 5px 12px; font-size: 12.5px; font-weight: 700; }

/* 语言三选菜单 */
#lang-wrap { position: relative; }
#lang-toggle { border: 1px solid var(--line); border-radius: 99px; padding: 5px 14px; font-size: 13px; color: var(--brand); font-weight: 700; }
#lang-menu { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(23,50,47,.18); min-width: 130px; overflow: hidden; z-index: 60; }
#lang-menu button { display: block; width: 100%; text-align: left; padding: 12px 16px; font-size: 15px; }
#lang-menu button.on { color: var(--brand); font-weight: 800; background: var(--brand-bg); }
#lang-menu button:not(:last-child) { border-bottom: 1px solid var(--line); }

/* 平板 / 电脑自适应 */
@media (min-width: 768px) {
  #view { max-width: 760px; }
  .ask-bar { max-width: 760px; }
  .pgrid { grid-template-columns: repeat(3, 1fr); }
  .big-actions.photo2 > * { padding: 26px 12px; }
}
@media (min-width: 1100px) {
  #view { max-width: 1000px; }
  .ask-bar { max-width: 1000px; }
  .pgrid { grid-template-columns: repeat(4, 1fr); }
  .pd-img { max-width: 560px; margin: 0 auto; }
}

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(100px + var(--safe-b));
  background: rgba(23,50,47,.92); color: #fff; border-radius: 99px; padding: 10px 20px; font-size: 14px; z-index: 99;
  opacity: 0; transition: opacity .25s; pointer-events: none; }
.toast.show { opacity: 1; }
