/* Live Helper dashboard — โทน Claude.com (ครีมอุ่น + ส้มดินเผา coral, พื้นสว่าง)
   ฟอนต์ Prompt (ไม่มีหัว) ฝังในเครื่อง */
@font-face { font-family:'Prompt'; font-weight:400; font-style:normal; font-display:swap; src:url('/assets/fonts/Prompt-Regular.ttf') format('truetype'); }
@font-face { font-family:'Prompt'; font-weight:500; font-style:normal; font-display:swap; src:url('/assets/fonts/Prompt-Medium.ttf') format('truetype'); }
@font-face { font-family:'Prompt'; font-weight:600; font-style:normal; font-display:swap; src:url('/assets/fonts/Prompt-SemiBold.ttf') format('truetype'); }
@font-face { font-family:'Prompt'; font-weight:700; font-style:normal; font-display:swap; src:url('/assets/fonts/Prompt-Bold.ttf') format('truetype'); }
@font-face { font-family:'Prompt'; font-weight:800; font-style:normal; font-display:swap; src:url('/assets/fonts/Prompt-ExtraBold.ttf') format('truetype'); }
* { box-sizing: border-box; }
:root {
  --bg: #F2F0E9; --panel: #FFFFFF; --panel2: #F6F4EC; --line: #E4E0D5;
  --txt: #23221E; --muted: #86847B; --accent: #C96442; --accent2: #B0562F;
  --ok: #3E7A52; --warn: #B4690E; --bad: #C0392B; --blue: #4A6FA5;
  --imgbg: #ECE8DE; --shadow: 0 1px 3px rgba(40,36,28,.06), 0 1px 2px rgba(40,36,28,.04);
}
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--txt);
  font-family: "Prompt","Kanit","IBM Plex Sans Thai","Leelawadee UI","Segoe UI",sans-serif; font-size: 15px; }

.topbar { display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-size: 22px; font-weight: 800; color: var(--txt); }
.brand .sub { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 8px; }
.status { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pill { background: var(--panel2); border: 1px solid var(--line); color: var(--txt);
  padding: 6px 14px; border-radius: 999px; font-size: 13px; text-decoration: none; }
.pill.link { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.pill.mode { cursor: pointer; font-weight: 700; }
.pill.mode.approve { border-color: var(--accent2); color: var(--accent2); }
.pill.mode.auto { border-color: var(--ok); color: var(--ok); }
.pill.ok { border-color: var(--ok); color: var(--ok); }
.pill.bad { border-color: var(--bad); color: var(--bad); }

.grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; padding: 16px;
  align-items: start; height: calc(100% - 60px); }
.col { display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.panel.grow { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.panel h3 { margin: 0 0 12px; font-size: 16px; display: flex; align-items: center; gap: 10px; justify-content: space-between; color: var(--txt); }

.cam { width: 100%; aspect-ratio: 16/9; background: #1c1a16; border-radius: 10px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; }
.cam img { width: 100%; height: 100%; object-fit: contain; }

.row { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.btn { background: var(--panel2); border: 1px solid var(--line); color: var(--txt);
  padding: 10px 16px; border-radius: 10px; cursor: pointer; font-size: 15px; font-weight: 600; transition: border-color .12s, background .12s; }
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.big { flex: 1; padding: 18px; font-size: 20px; font-weight: 800; }
.btn.scan { background: linear-gradient(135deg,#D97757,#C15F3C); border: none; color: #fff; }
.btn.hide { background: linear-gradient(135deg,#cf5147,#b23a30); border: none; color: #fff; }
.btn.approve { background: linear-gradient(135deg,#4a9068,#3E7A52); border: none; font-weight: 800; color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.fld { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
select, input[type=text], input[type=number], input[type=file], textarea {
  background: #fff; border: 1px solid var(--line); color: var(--txt);
  padding: 9px 12px; border-radius: 9px; font-size: 14px; width: 100%; }
textarea { resize: vertical; min-height: 74px; font-family: inherit; line-height: 1.35; }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.row select, .row input { width: auto; flex: 1; }
.form input { margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; min-height: 18px; }
#search { width: 150px; font-size: 13px; padding: 5px 10px; }

/* current shown */
.current-box { display: flex; gap: 14px; align-items: center; padding: 10px; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 10px; min-height: 92px; }
.current-box.empty { color: var(--muted); justify-content: center; }
.current-box img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; background: var(--imgbg); }
.current-box .c-name { font-weight: 700; font-size: 17px; }
.current-box .c-price { color: var(--accent); font-weight: 800; font-size: 20px; }
.current-box .c-code { color: var(--muted); font-size: 13px; }

/* pending candidates */
.pending-box { flex: 1 1 auto; overflow-y: auto; color: var(--muted); }
.cand { display: flex; gap: 12px; align-items: center; padding: 10px; border: 2px solid var(--line);
  border-radius: 10px; margin-bottom: 8px; background: var(--panel2); cursor: pointer; }
.cand.sel { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent); }
.cand img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: var(--imgbg); }
.cand .c-main { flex: 1; color: var(--txt); }
.cand .c-name { font-weight: 700; }
.cand .c-meta { font-size: 12px; color: var(--muted); }
.cand .c-score { font-size: 20px; font-weight: 800; color: var(--accent); }
.reason { font-size: 12px; color: var(--warn); margin: 6px 0; }

/* product list */
.product-list { overflow-y: auto; flex: 1 1 auto; }
.prod { display: flex; gap: 10px; align-items: center; padding: 8px; border-bottom: 1px solid var(--line); }
.prod img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; background: var(--imgbg); }
.prod .p-main { flex: 1; min-width: 0; }
.prod .p-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prod .p-meta { font-size: 12px; color: var(--muted); }
.prod .p-emb { font-size: 12px; color: var(--ok); }
.prod .p-emb.zero { color: var(--bad); }
.prod .btn { padding: 6px 12px; font-size: 13px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(60px);
  background: #2B2A25; border: 1px solid #3a382f; color: #F5F2EA; padding: 12px 22px;
  border-radius: 10px; opacity: 0; transition: all .3s ease; z-index: 50; box-shadow: 0 8px 24px rgba(40,36,28,.25); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hidden { display: none !important; }

.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); border: 1px solid var(--warn); color: var(--warn);
  padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-top: 10px; }
.btn.auto-off { background: var(--panel2); color: var(--muted); }
.btn.auto-on { background: linear-gradient(135deg,#4a9068,#3E7A52); border: none; color: #fff;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 22%, transparent); }
.live-badge { font-size: 13px; padding: 4px 10px; border-radius: 999px; margin-left: 8px; }

.btn.small { padding: 4px 10px; font-size: 12px; }
.gallery-wrap { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.gallery-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.gallery { display: flex; flex-wrap: wrap; gap: 8px; max-height: 220px; overflow-y: auto; }
.gthumb { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--imgbg); }
.gthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gthumb .del { position: absolute; top: 2px; right: 2px; background: rgba(192,57,43,.92); color:#fff; border:none;
  width: 20px; height: 20px; border-radius: 6px; cursor: pointer; font-size: 12px; line-height: 1; }

@media (max-width: 1100px) { .grid { grid-template-columns: 1fr; height: auto; } }
