/* line.html: จำลองแชท LINE OA ในมือถือของลูกค้า ภายในจอมือถือใช้โทนสว่างแบบแอปแชทเสมอ (ไม่ขึ้นกับโหมดมืดของหน้า) */
.line-page { --lc-bg: #8aa3c6; --lc-me: #8fe07c; --lc-ink: #1d2433; --lc-muted: #6b7486; --lc-line: #e3e7ef; --lc-accent: #06a94d; }

.line-stage {
  min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 380px) auto;
  justify-content: center; align-items: center; gap: 48px; padding: 32px 16px;
}
.line-side { display: grid; gap: 16px; align-content: center; }
.line-side h1 { margin: 0; font-family: var(--font-head); font-size: 1.7rem; line-height: 1.3; }
.line-side p { margin: 0; }
.try-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--muted); }
.try-list b { color: var(--ink); }
.side-actions { display: flex; gap: 10px; align-items: center; }
.who-select { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; }

/* ---------- มือถือ ---------- */
.phone {
  position: relative; width: 390px; height: min(800px, calc(100vh - 64px)); min-height: 560px;
  display: flex; flex-direction: column; overflow: hidden; border-radius: 40px;
  border: 10px solid #05081c; background: var(--lc-bg); color: var(--lc-ink);
  box-shadow: 0 30px 80px rgba(3, 6, 25, .55), 0 0 0 1px rgba(255, 255, 255, .08);
  color-scheme: light;
  /* ช่องกรอกใช้สไตล์กลางของ style.css: เปลี่ยนตัวแปรให้เป็นโทนสว่างในจอมือถือ */
  --bg-2: #f4f6fa; --line: #d5dae5; --ink: #1d2433; --muted: #6b7486; --placeholder: #8a91a3; --surface: #fff; --primary-2: #06a94d;
}
.lc-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 10px; background: #fff; border-bottom: 1px solid var(--lc-line); flex: none; }
.lc-back, .lc-icon { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--lc-ink); cursor: pointer; text-decoration: none; }
.lc-back:hover, .lc-icon:hover { background: #f0f2f6; }
.lc-oa { width: 36px; height: 36px; flex: none; border-radius: 50%; background: #10173f; display: grid; place-items: center; }
.lc-oa svg { width: 28px; height: 28px; }
.lc-title { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.lc-title b { font-size: 1rem; }
.lc-title small { font-size: .74rem; color: var(--lc-muted); }

.lc-body { flex: 1; overflow-y: auto; padding: 14px 12px 10px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.lc-day { align-self: center; padding: 3px 10px; border-radius: 999px; background: rgba(0, 0, 0, .18); color: #fff; font-size: .72rem; margin: 6px 0; }
.lc-row { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.lc-row.is-me { justify-content: flex-end; }
.lc-av { width: 32px; height: 32px; flex: none; border-radius: 50%; background: #10173f; display: grid; place-items: center; align-self: flex-start; }
.lc-av svg { width: 24px; height: 24px; }
.lc-col { display: grid; gap: 3px; min-width: 0; max-width: 78%; }
.lc-sender { font-size: .72rem; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.lc-bubble { padding: 9px 12px; border-radius: 18px; background: #fff; font-size: .93rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px 1px rgba(0, 0, 0, .06); }
.is-me .lc-bubble { background: var(--lc-me); }
.lc-meta { font-size: .66rem; color: rgba(255, 255, 255, .9); white-space: nowrap; padding-bottom: 2px; display: grid; justify-items: end; line-height: 1.25; }
.lc-row:not(.is-me) .lc-meta { justify-items: start; }
.lc-img { width: 150px; border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.lc-img img { display: block; width: 100%; }
.lc-img .lc-noimg { display: grid; place-items: center; gap: 4px; height: 120px; color: var(--lc-muted); font-size: .8rem; }

/* การ์ดแบบ Flex Message */
.lc-card { width: 250px; border-radius: 16px; overflow: hidden; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.lc-card-top { padding: 12px 14px; color: #fff; display: grid; gap: 2px; background: #3d4f9e; }
.lc-card-top b { font-size: .98rem; }
.lc-card-top strong { font-family: var(--font-head); font-size: 1.5rem; line-height: 1.2; }
.lc-card.tone-ok .lc-card-top { background: linear-gradient(135deg, #0f9d58, #12b886); }
.lc-card.tone-bad .lc-card-top { background: linear-gradient(135deg, #d6334a, #f0645a); }
.lc-card.tone-info .lc-card-top { background: linear-gradient(135deg, #5b4bdb, #2b8fd6); }
.lc-card dl { margin: 0; padding: 10px 14px; display: grid; gap: 5px; font-size: .84rem; }
.lc-card dl div { display: flex; justify-content: space-between; gap: 10px; }
.lc-card dt { color: var(--lc-muted); }
.lc-card dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.lc-card p { margin: 0; padding: 0 14px 12px; font-size: .78rem; color: var(--lc-muted); }
.lc-stars { display: flex; gap: 4px; padding: 4px 14px 14px; }
.lc-stars button { flex: 1; height: 38px; border: 1px solid var(--lc-line); border-radius: 10px; background: #fff; color: #f5a524; cursor: pointer; display: grid; place-items: center; }
.lc-stars button:hover:not(:disabled) { background: #fff7e6; }
.lc-stars button:disabled { cursor: default; opacity: .55; }
.lc-stars .ic { fill: none; }
.lc-stars button:hover:not(:disabled) .ic, .lc-stars .is-on .ic { fill: currentColor; }
.lc-stars button.is-on:disabled { opacity: 1; }
.lc-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.lc-typing i { width: 7px; height: 7px; border-radius: 50%; background: #9aa3b5; animation: lc-dot 1.2s infinite ease-in-out; }
.lc-typing i:nth-child(2) { animation-delay: .15s; }
.lc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes lc-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.lc-quick { display: flex; gap: 8px; overflow-x: auto; padding: 6px 12px 10px; flex: none; scrollbar-width: none; }
.lc-quick::-webkit-scrollbar { display: none; }
.lc-quick button { flex: none; padding: 7px 14px; border-radius: 999px; border: 1px solid #fff; background: rgba(255, 255, 255, .92); color: var(--lc-accent); font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; }
.lc-quick button:hover { background: #fff; }

/* ช่องพิมพ์ + เมนูร้าน (Rich menu) */
.lc-foot { flex: none; background: #fff; border-top: 1px solid var(--lc-line); }
.lc-input { display: flex; align-items: center; gap: 6px; padding: 8px 8px; }
.phone .lc-input input:not([type=file]) { flex: 1; min-width: 0; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--lc-line); background: #f4f6fa; color: var(--lc-ink); font: inherit; font-size: .95rem; }
.phone .lc-input input:not([type=file]):focus { outline: 2px solid rgba(6, 169, 77, .35); border-color: var(--lc-accent); }
.lc-send { width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; background: var(--lc-accent); color: #fff; display: grid; place-items: center; cursor: pointer; }
.lc-send:disabled { background: #c9cfdb; cursor: default; }
.lc-menu-toggle { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px; border: 0; border-top: 1px solid var(--lc-line); background: #fff; color: var(--lc-muted); font: inherit; font-size: .82rem; cursor: pointer; }
.lc-menu-toggle .ic { transition: transform .2s; }
.lc-menu-toggle[aria-expanded="false"] .ic { transform: rotate(180deg); }
.lc-rich { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: #232c63; }
.lc-rich button { display: grid; justify-items: center; gap: 6px; padding: 14px 6px; border: 0; background: linear-gradient(160deg, #1a2257, #232f73); color: #fff; font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; }
.lc-rich button:hover { background: linear-gradient(160deg, #222c6b, #2c3a8a); }
.lc-rich .ic { width: 26px; height: 26px; color: #ffc94a; }
.lc-rich[hidden] { display: none; }

/* หน้าเพิ่มเพื่อน */
.lc-follow { flex: 1; overflow-y: auto; display: grid; align-content: center; justify-items: center; gap: 10px; padding: 24px; background: linear-gradient(180deg, #10173f 0, #10173f 38%, #f6f7fb 38%); text-align: center; }
.lc-follow-logo { width: 96px; height: 96px; border-radius: 50%; background: #0b1030; border: 4px solid #fff; display: grid; place-items: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.lc-follow-logo svg { width: 70px; height: 70px; }
.lc-follow h2 { margin: 6px 0 0; font-family: var(--font-head); color: var(--lc-ink); }
.lc-follow p { margin: 0; color: var(--lc-muted); }
.lc-follow-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; text-align: left; }
.lc-follow-list li { display: flex; gap: 10px; align-items: center; font-size: .9rem; }
.lc-follow-list .ic { color: var(--lc-accent); }
.lc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 22px; border: 0; border-radius: 12px; background: var(--lc-accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; width: 100%; }
.lc-btn:hover { filter: brightness(1.05); }
.lc-btn:disabled { background: #c9cfdb; cursor: default; }
.lc-btn-ghost { background: #eef1f6; color: var(--lc-ink); }

/* ---------- หน้า LIFF ---------- */
.liff { position: absolute; inset: 7% 0 0; z-index: 5; display: flex; flex-direction: column; background: #f6f7fb; border-radius: 22px 22px 0 0; box-shadow: 0 -16px 40px rgba(0, 0, 0, .3); animation: liff-up .28s cubic-bezier(.2, .9, .3, 1); }
.liff[hidden] { display: none; }
@keyframes liff-up { from { transform: translateY(100%); } }
.liff-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--lc-line); background: #fff; border-radius: 22px 22px 0 0; }
.liff-head div { display: grid; line-height: 1.25; }
.liff-head small { font-size: .72rem; color: var(--lc-muted); }
.liff-body { flex: 1; overflow-y: auto; padding: 16px; display: grid; gap: 14px; align-content: start; }
.liff-body h3 { margin: 0; font-size: 1rem; }
.liff-body p { margin: 0; }
.lf-field { display: grid; gap: 6px; font-size: .88rem; font-weight: 600; }
.liff .lf-field input:not([type=file]), .lf-field select { min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid #d5dae5; background-color: #fff; color: var(--lc-ink); font: inherit; font-weight: 400; }
.liff .lf-field input:not([type=file]):focus, .lf-field select:focus { outline: 2px solid rgba(6, 169, 77, .3); border-color: var(--lc-accent); }
.liff .lf-field input.is-invalid:not([type=file]) { border-color: #d6334a; outline: 2px solid rgba(214, 51, 74, .2); }
.lf-field select { padding-right: 36px; }
.lf-field small { font-weight: 400; color: var(--lc-muted); font-size: .78rem; }
.lf-note { padding: 10px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--lc-line); font-size: .82rem; color: var(--lc-muted); }
.lf-error { color: #d6334a; font-size: .84rem; font-weight: 600; }
.lf-amounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lf-amounts button { display: grid; gap: 1px; padding: 10px 4px; border-radius: 12px; border: 1px solid #d5dae5; background: #fff; color: var(--lc-ink); font: inherit; cursor: pointer; }
.lf-amounts button b { font-size: 1rem; }
.lf-amounts button small { color: var(--lc-muted); font-size: .72rem; }
.lf-amounts button.is-active { border-color: var(--lc-accent); background: #e9f8ef; box-shadow: 0 0 0 1px var(--lc-accent) inset; }
.lf-sum { display: grid; gap: 4px; padding: 12px 14px; border-radius: 14px; background: #10173f; color: #fff; }
.lf-sum strong { font-family: var(--font-head); font-size: 1.6rem; color: #ffc94a; line-height: 1.2; }
.lf-sum small { color: #b9c1e6; }
.lf-qr { display: grid; justify-items: center; gap: 6px; padding: 14px; border-radius: 16px; background: #fff; border: 1px solid var(--lc-line); text-align: center; }
.lf-qr .qr { width: 190px; height: 190px; }
.lf-qr b { font-size: 1.25rem; }
.lf-qr small { color: var(--lc-muted); }
.lf-ids { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lf-ids li { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: #fff; border: 1px solid var(--lc-line); }
.lf-ids li b { flex: 1; font-variant-numeric: tabular-nums; }
.lf-hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lf-hist li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--lc-line); font-size: .84rem; }
.lf-hist small { color: var(--lc-muted); display: block; }
.lf-tag { align-self: center; padding: 2px 8px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; background: #eef1f6; color: var(--lc-muted); }
.lf-tag.ok { background: #e3f7ec; color: #0b7a43; }
.lf-tag.bad { background: #fde8eb; color: #b4243a; }
.lf-tag.warn { background: #fff3db; color: #8a5600; }
.lf-slip { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; background: #fff; border: 1px solid var(--lc-line); }
.lf-slip img { width: 96px; border-radius: 10px; display: block; }
.lf-row { display: flex; gap: 8px; }
.lf-row > * { flex: 1; }

/* ปุ่มในการ์ด (เลือก SUGO ID ในแชท) */
.lc-card-btns { display: grid; gap: 6px; padding: 0 14px 14px; }
.lc-card-btns button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border: 1px solid var(--lc-accent); border-radius: 10px; background: #fff; color: var(--lc-accent); font: inherit; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; }
.lc-card-btns button:hover:not(:disabled) { background: #e9f8ef; }
.lc-card-btns button:disabled { border-color: var(--lc-line); color: var(--lc-muted); cursor: default; }
.lc-card-btns button.is-on { border-color: var(--lc-accent); background: var(--lc-accent); color: #fff; }
.lc-card-btns .ic { width: 16px; height: 16px; }

/* อัลบั้มรูป (จำลองการเลือกรูปในมือถือ) */
.album { position: absolute; inset: 0; z-index: 6; display: flex; align-items: flex-end; background: rgba(10, 14, 30, .45); }
.album[hidden] { display: none; }
.album-box { width: 100%; max-height: 80%; overflow-y: auto; background: #fff; border-radius: 22px 22px 0 0; padding: 12px 14px calc(16px + env(safe-area-inset-bottom)); animation: liff-up .25s cubic-bezier(.2, .9, .3, 1); }
.album-head { display: flex; align-items: center; justify-content: space-between; }
.album-note { margin: 4px 0 12px; font-size: .78rem; color: var(--lc-muted); }
.album-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.album-item { display: grid; justify-items: center; gap: 2px; padding: 6px; border: 1px solid var(--lc-line); border-radius: 12px; background: #f6f7fb; color: var(--lc-ink); font: inherit; text-align: center; cursor: pointer; }
.album-item:hover { border-color: var(--lc-accent); }
.album-item img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: top; border-radius: 8px; }
.album-item b { font-size: .78rem; line-height: 1.3; }
.album-item small { font-size: .68rem; color: var(--lc-muted); }
.album-file { align-content: center; }
.album-file .ic { width: 30px; height: 30px; color: var(--lc-accent); }

/* ---------- จอเล็ก: มือถือเต็มจอ ไม่มีกรอบ ---------- */
@media (max-width: 860px) {
  .line-stage { display: block; padding: 0; min-height: 0; }
  .line-side { display: none; }
  .phone { width: 100%; height: 100vh; height: 100dvh; min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
  .lc-head { padding-top: max(10px, env(safe-area-inset-top)); }
  .lc-rich { padding-bottom: env(safe-area-inset-bottom); }
  .liff { inset: max(28px, env(safe-area-inset-top)) 0 0; }
}
@media (min-width: 861px) { [data-who-open] { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .liff, .lc-typing i { animation: none; }
}
