/* ════════════════════════════════════════════════════════════════
   Chủ Quán AI — Chat Experience v4 (CSS)
   Nạp SAU chat.css. Chỉ ghi đè những gì cần để trải nghiệm chat mượt.
   ════════════════════════════════════════════════════════════════ */

/* ── 1. APP SHELL: ô nhập luôn nằm trong màn hình (trước đây nằm ở y≈1600px) ── */
html { height: 100%; }
body {
  height: 100vh;
  height: 100dvh;
  min-height: 0 !important;
  overflow: hidden;
}
.main-wrapper {
  flex: 1 1 0 !important;
  min-height: 0;
  height: auto !important;
}
.chat-messages { overscroll-behavior: contain; scrollbar-gutter: stable; }

/* ── 2. Chữ trong câu trả lời: dễ đọc như ChatGPT/Gemini ── */
.msg-bubble { font-size: 14.5px; line-height: 1.68; word-break: break-word; overflow-wrap: anywhere; }
.msg-row.ai .msg-bubble { width: 100%; max-width: calc(100% - 46px); }
.msg-bubble .md > :first-child { margin-top: 0; }
.msg-bubble .md > :last-child { margin-bottom: 0; }
.msg-bubble .md p { margin: 0 0 10px; }
.msg-bubble .md h2, .msg-bubble .md h3, .msg-bubble .md h4, .msg-bubble .md h5 {
  margin: 16px 0 6px; line-height: 1.35; font-weight: 800; letter-spacing: -0.01em;
}
.msg-bubble .md h2 { font-size: 1.2em; }
.msg-bubble .md h3 { font-size: 1.1em; }
.msg-bubble .md h4, .msg-bubble .md h5 { font-size: 1.02em; }
.msg-bubble .md ul, .msg-bubble .md ol { margin: 4px 0 12px; padding-left: 22px; }
.msg-bubble .md li { margin: 3px 0; padding-left: 2px; }
.msg-bubble .md li::marker { color: #f97316; font-weight: 700; }
.msg-bubble .md li > ul, .msg-bubble .md li > ol { margin: 4px 0 4px; }
.msg-bubble .md strong { font-weight: 700; color: inherit; }
.msg-bubble .md a { color: #0369a1; text-decoration: underline; text-underline-offset: 2px; }
body.dark-mode .msg-bubble .md a { color: #7dd3fc; }
.msg-bubble .md hr { border: 0; border-top: 1px solid rgba(100, 116, 139, .25); margin: 14px 0; }
.msg-bubble .md blockquote {
  margin: 10px 0; padding: 8px 14px; border-left: 3px solid #f97316;
  background: rgba(249, 115, 22, .07); border-radius: 0 10px 10px 0; font-weight: 600;
}
.msg-bubble .md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em;
  background: rgba(100, 116, 139, .14); padding: 1px 6px; border-radius: 6px;
}
.md-need {
  display: inline-block; padding: 0 8px; border-radius: 99px; font-size: .82em; font-weight: 700;
  background: #fef3c7; color: #92400e; border: 1px dashed #f59e0b;
}
body.dark-mode .md-need { background: rgba(245, 158, 11, .18); color: #fcd34d; }

/* Bảng cuộn ngang trên mobile, không làm vỡ khung */
.md-table-wrap {
  margin: 10px 0 14px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(100, 116, 139, .25); border-radius: 12px;
}
.msg-bubble .md-table-wrap table { width: 100%; min-width: 360px; border-collapse: collapse; margin: 0; font-size: .94em; }
.msg-bubble .md-table-wrap th, .msg-bubble .md-table-wrap td {
  padding: 9px 12px; border: 0; border-bottom: 1px solid rgba(100, 116, 139, .18); text-align: left; vertical-align: top;
}
.msg-bubble .md-table-wrap th { background: rgba(249, 115, 22, .09); font-weight: 800; white-space: nowrap; }
.msg-bubble .md-table-wrap tr:last-child td { border-bottom: 0; }
.msg-bubble .md-table-wrap tbody tr:nth-child(even) td { background: rgba(100, 116, 139, .045); }

/* Khối mã / văn bản mẫu có nút chép */
.md-code { margin: 10px 0 14px; border-radius: 12px; overflow: hidden; background: #0f172a; color: #e2e8f0; border: 1px solid #1e293b; }
.md-code-head {
  display: flex; align-items: center; justify-content: space-between; padding: 6px 10px 6px 14px;
  background: #1e293b; font-size: 11.5px; color: #94a3b8; text-transform: uppercase; letter-spacing: .05em;
}
.md-copy-code {
  font: inherit; text-transform: none; letter-spacing: 0; cursor: pointer; color: #e2e8f0;
  background: rgba(255, 255, 255, .08); border: 0; border-radius: 8px; padding: 4px 10px;
}
.md-copy-code:hover { background: rgba(255, 255, 255, .16); }
.md-code code { display: block; padding: 12px 14px; background: transparent; white-space: pre-wrap; overflow-x: auto; font-size: 13px; }

/* ── 3. Trạng thái chờ & con trỏ khi stream ── */
.msg-status { display: flex; align-items: center; gap: 10px; color: #64748b; font-size: 13.5px; min-height: 24px; }
body.dark-mode .msg-status { color: #94a3b8; }
.typing-dots { display: inline-flex; gap: 4px; }
.typing-dots i { width: 7px; height: 7px; border-radius: 50%; background: #f97316; animation: cqDot 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes cqDot { 0%, 80%, 100% { transform: scale(.55); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }
.stream-caret {
  display: inline-block; width: 8px; height: 1.05em; margin-left: 3px; vertical-align: -0.15em;
  background: #f97316; border-radius: 2px; animation: cqCaret 1s steps(2, start) infinite;
}
@keyframes cqCaret { to { visibility: hidden; } }

/* ── 4. Thanh tác vụ dưới mỗi câu trả lời ── */
.msg-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-top: 12px; padding-top: 8px; border-top: 1px solid rgba(100, 116, 139, .16); position: relative; }
.msg-foot > button, .msg-foot summary {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; min-width: 34px; padding: 0 9px; justify-content: center;
  font: inherit; font-size: 12.5px; font-weight: 600; color: #64748b; background: transparent; border: 0; border-radius: 10px;
  cursor: pointer; list-style: none; transition: background .15s, color .15s;
}
.msg-foot summary::-webkit-details-marker { display: none; }
.msg-foot svg, .msg-user-tools svg, .cq-jump svg {
  width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none;
}
.msg-foot > button:hover, .msg-foot summary:hover, .msg-foot > button:focus-visible { background: rgba(249, 115, 22, .1); color: #c2410c; }
.msg-foot > button.on { color: #ea580c; background: rgba(249, 115, 22, .14); }
.msg-foot > button.on svg { fill: currentColor; fill-opacity: .18; }
.msg-foot .only-last { display: none; }
.msg-row.is-last .msg-foot .only-last { display: inline-flex; }
.msg-more { position: relative; }
.msg-more[open] summary { background: rgba(249, 115, 22, .1); color: #c2410c; }
.msg-more-pop {
  position: absolute; left: 0; bottom: 40px; z-index: 30; min-width: 220px; padding: 6px;
  background: #fff; border: 1px solid rgba(100, 116, 139, .25); border-radius: 14px; box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
}
body.dark-mode .msg-more-pop { background: #1e293b; border-color: #334155; }
.msg-more-pop a, .msg-more-pop button {
  display: block; width: 100%; text-align: left; padding: 10px 12px; font: inherit; font-size: 13px; font-weight: 600;
  color: inherit; text-decoration: none; background: transparent; border: 0; border-radius: 9px; cursor: pointer;
}
.msg-more-pop a:hover, .msg-more-pop button:hover { background: rgba(249, 115, 22, .1); }

/* Gợi ý bước tiếp theo */
.msg-suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cq-suggest {
  font: inherit; font-size: 13px; font-weight: 600; line-height: 1.3; text-align: left; cursor: pointer; color: #9a3412;
  background: #fff7ed; border: 1px solid #fed7aa; border-radius: 99px; padding: 8px 14px; transition: transform .12s, background .15s;
}
.cq-suggest:hover { background: #ffedd5; transform: translateY(-1px); }
body.dark-mode .cq-suggest { background: rgba(249, 115, 22, .12); color: #fdba74; border-color: rgba(249, 115, 22, .35); }

/* Thông báo trong bong bóng (lỗi / đã dừng) */
.msg-note { margin-top: 10px; padding: 9px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.msg-note.warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.msg-note.muted { background: rgba(100, 116, 139, .1); color: #475569; }
body.dark-mode .msg-note.warn { background: rgba(245, 158, 11, .14); color: #fcd34d; border-color: rgba(245, 158, 11, .35); }
body.dark-mode .msg-note.muted { color: #cbd5e1; }
.cq-retry, .cq-continue {
  font: inherit; font-weight: 700; margin-left: 4px; cursor: pointer; color: #fff; background: #ea580c; border: 0; border-radius: 99px; padding: 4px 12px;
}
.cq-retry:hover, .cq-continue:hover { background: #c2410c; }

/* Công cụ nhỏ cho tin nhắn của người dùng */
.msg-row.user .msg-bubble { position: relative; }
.msg-user-tools { position: absolute; right: calc(100% + 6px); bottom: 4px; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.msg-row.user:hover .msg-user-tools, .msg-user-tools:focus-within { opacity: 1; }
.msg-user-tools button {
  width: 30px; height: 30px; display: grid; place-items: center; color: #64748b; background: transparent; border: 0; border-radius: 8px; cursor: pointer;
}
.msg-user-tools button:hover { background: rgba(100, 116, 139, .14); color: #0f172a; }
body.dark-mode .msg-user-tools button:hover { color: #fff; }

/* Nút cuộn xuống tin mới nhất */
.cq-jump {
  position: absolute; left: 50%; bottom: calc(var(--cq-bar-h, 150px) + 14px); z-index: 20; width: 38px; height: 38px;
  display: grid; place-items: center; color: #334155; background: #fff; border: 1px solid rgba(100, 116, 139, .3);
  border-radius: 50%; box-shadow: 0 6px 18px rgba(15, 23, 42, .16); cursor: pointer;
  opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity .18s, transform .18s;
}
.cq-jump.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
body.dark-mode .cq-jump { background: #1e293b; color: #e2e8f0; border-color: #334155; }

/* ── 5. Ô nhập: nút Gửi ↔ Dừng ── */
.btn-send svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.btn-send.is-stop { background: #0f172a !important; }
.btn-send.is-stop svg rect { fill: #fff; stroke: #fff; }
.btn-send:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.btn-send:not(:disabled):active { transform: scale(.94); }
.history-empty { font-size: 11.5px; color: var(--light-muted, #64748b); padding: 6px; }

/* ── 6. Thông báo cập nhật phiên bản (thay cho hộp thoại confirm chặn người dùng) ── */
.cq-update-toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 100000; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 16px; color: #fff; background: #0f172a; border-radius: 99px; font-size: 13.5px;
  box-shadow: 0 12px 34px rgba(15, 23, 42, .35); transform: translateX(-50%);
}
.cq-update-toast button { font: inherit; font-weight: 700; color: #fff; background: #ea580c; border: 0; border-radius: 99px; padding: 6px 14px; cursor: pointer; }
.cq-update-toast .x { background: transparent; color: #94a3b8; padding: 6px 8px; }

/* ── 7. Mobile ── */
@media (max-width: 768px) {
  .msg-bubble { font-size: 15px; }
  .msg-row.ai .msg-bubble { max-width: calc(100% - 42px); }
  .msg-foot > button span { display: none; }
  .msg-foot > button[data-act="copy"] span, .msg-foot > button[data-act="regen"] span { display: inline; }
  .msg-foot > button, .msg-foot summary { height: 40px; min-width: 40px; }
  .msg-user-tools { position: static; opacity: .75; justify-content: flex-end; margin-top: 6px; }
  .msg-user-tools button { width: 36px; height: 32px; color: rgba(255, 255, 255, .85); }
  .msg-user-tools button:hover { background: rgba(255, 255, 255, .18); color: #fff; }
  .cq-suggest { font-size: 13.5px; padding: 9px 14px; }
  .input-hint-row { display: none !important; }
  /* Banner cài app không còn che ô nhập: đưa lên đỉnh và ẩn khi đang chat */
  .pwa-mobile-banner { top: 44px !important; bottom: auto !important; border-radius: 0 0 14px 14px !important; }
  body.cq-chatting .pwa-mobile-banner { display: none !important; }
  .md-code code { font-size: 12.5px; }
  .input-box-wrap { gap: 2px !important; padding-left: 6px !important; padding-right: 6px !important; }
  .input-box-wrap .btn-skill-simple, .input-box-wrap .btn-attach-simple { padding: 6px !important; min-width: 32px !important; }
  .input-box-wrap .chat-textarea { flex: 1 1 0 !important; min-width: 0 !important; width: auto !important; }
  .input-box-wrap .input-tools { gap: 2px !important; flex-shrink: 0; }
  .md table { font-size: 13px; }
  .md th, .md td { padding: 7px 8px !important; }
}
@media (hover: none) {
  .msg-user-tools { opacity: .75; }
}
@media (prefers-reduced-motion: reduce) {
  .stream-caret, .typing-dots i { animation: none; }
  .cq-jump, .cq-suggest { transition: none; }
}

/* ── Màn hình chào gọn ── */
body.cq-lite .welcome-fnb .process-pill-badge,
body.cq-lite .welcome-fnb .hero-badge,
body.cq-lite .welcome-fnb [class^="salekit-orb"] { display: none !important; }
body.cq-lite .welcome-fnb .hero-title { font-size: clamp(24px, 4.2vw, 34px) !important; line-height: 1.25 !important; margin: 8px 0 6px !important; }
body.cq-lite .welcome-fnb .hero-desc { font-size: 15px !important; max-width: 640px; margin: 0 auto 14px !important; }
body.cq-lite .prompt-grid:not(.cq-all) > .prompt-card:nth-child(n+7) { display: none; }
.cq-more-prompts { display: block; margin: 10px auto 4px; border: 1px solid rgba(249,115,22,.35); background: transparent; color: #c2410c; border-radius: 999px; padding: 8px 18px; font: 600 13.5px/1 inherit; cursor: pointer; }
.cq-more-prompts:hover { background: rgba(249,115,22,.08); }
.cq-more { margin: 18px auto 0; max-width: 980px; border: 1px solid rgba(100,116,139,.25); border-radius: 14px; padding: 4px 14px 14px; }
.cq-more > summary { cursor: pointer; padding: 10px 2px; font-weight: 700; font-size: 14px; color: #475569; list-style: none; }
.cq-more > summary::before { content: '▸ '; }
.cq-more[open] > summary::before { content: '▾ '; }
@media (max-width: 768px) {
  body.cq-lite .prompt-card-sub { display: none !important; }
  body.cq-lite .welcome-fnb .hero-desc { font-size: 14px !important; }
}
body:not(.cq-chatting) .cq-jump { display: none !important; }

/* ── Cụm icon tiện ích trên thanh trên: to, rõ, có nhãn khi rê chuột/chạm ── */
@media (min-width: 769px) and (max-width: 1440px) {
  .topbar-ecosystem-links { gap: 9px; }
  .topbar-ecosystem-links .eco-btn {
    position: relative; width: 42px; height: 42px; padding: 0 !important; justify-content: center;
    border-radius: 13px; font-size: 22px; line-height: 1;
    box-shadow: 0 3px 10px rgba(15, 23, 42, .18), inset 0 1px 0 rgba(255, 255, 255, .28);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
  }
  .topbar-ecosystem-links .eco-btn > span:first-child { font-size: 22px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25)); }
  .topbar-ecosystem-links .eco-btn:hover { transform: translateY(-2px) scale(1.06); box-shadow: 0 8px 18px rgba(15, 23, 42, .28); filter: none; }
  .topbar-ecosystem-links .eco-btn.mail { background: linear-gradient(135deg, #fb923c, #ea580c); color: #fff; border: 0; }
  .topbar-ecosystem-links .eco-btn.drive { background: linear-gradient(135deg, #2dd4bf, #0d9488); color: #fff; border: 0; }
  .topbar-ecosystem-links .eco-btn.web { background: linear-gradient(135deg, #38bdf8, #0284c7); color: #fff; border: 0; }
  .topbar-ecosystem-links .eco-btn[data-tip]:hover::after, .topbar-ecosystem-links .eco-btn[data-tip]:focus-visible::after {
    content: attr(data-tip); position: absolute; top: calc(100% + 9px); left: 50%; transform: translateX(-50%);
    background: #0f172a; color: #fff; font-size: 12.5px; font-weight: 600; line-height: 1; padding: 7px 11px; border-radius: 8px;
    white-space: nowrap; z-index: 99999; pointer-events: none; box-shadow: 0 6px 16px rgba(0, 0, 0, .3);
  }
}
@media (min-width: 769px) {
  .topbar-ecosystem-links .eco-btn.mail { background: linear-gradient(135deg, #fb923c, #ea580c); color: #fff; border: 0; }
  .topbar-ecosystem-links .eco-btn.drive { background: linear-gradient(135deg, #2dd4bf, #0d9488); color: #fff; border: 0; }
  .topbar-ecosystem-links .eco-btn.web { background: linear-gradient(135deg, #38bdf8, #0284c7); color: #fff; border: 0; }
}
@media (min-width: 1441px) {
  .topbar-ecosystem-links { gap: 8px; }
  .topbar-ecosystem-links .eco-btn { padding: 7px 11px; font-size: 13px; border-radius: 11px; }
  .topbar-ecosystem-links .eco-btn > span:first-child { font-size: 18px; }
}

/* ───────────── Sổ quán (dữ liệu thật theo từng chủ quán) ───────────── */
.shop-open-btn { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; margin: 8px 0 0; padding: 10px 12px; border: 1.5px solid rgba(249,115,22,.35); border-radius: 12px; background: linear-gradient(135deg, rgba(255,247,237,.95), rgba(255,237,213,.8)); color: #9a3412; cursor: pointer; transition: transform .15s, box-shadow .15s; font-family: inherit; }
.shop-open-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(234,88,12,.2); }
.shop-open-btn .soi { font-size: 24px; }
.shop-open-btn .sot { display: flex; flex-direction: column; line-height: 1.25; }
.shop-open-btn b { font-size: 14px; } .shop-open-btn small { font-size: 11.5px; opacity: .85; }
body.dark-mode .shop-open-btn { background: rgba(249,115,22,.14); color: #fdba74; border-color: rgba(249,115,22,.4); }
body.shop-open { overflow: hidden; }
.shop-modal { position: fixed; inset: 0; z-index: 100000; display: none; align-items: center; justify-content: center; background: rgba(15,23,42,.55); backdrop-filter: blur(4px); padding: 16px; }
.shop-modal.open { display: flex; animation: shopFade .18s ease; }
@keyframes shopFade { from { opacity: 0; } to { opacity: 1; } }
.shop-card { width: min(860px, 100%); max-height: min(92dvh, 820px); display: flex; flex-direction: column; background: #fff; color: #0f172a; border-radius: 20px; box-shadow: 0 30px 80px rgba(0,0,0,.35); overflow: hidden; }
body.dark-mode .shop-card { background: #111827; color: #e5e7eb; }
.shop-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 22px 8px; }
.shop-title { font-size: 20px; font-weight: 800; } .shop-sub { font-size: 13px; color: #64748b; margin-top: 2px; }
.shop-close { border: 0; background: rgba(100,116,139,.15); width: 36px; height: 36px; border-radius: 50%; font-size: 16px; cursor: pointer; color: inherit; flex-shrink: 0; }
.shop-tabs { display: flex; gap: 6px; padding: 6px 18px 10px; overflow-x: auto; border-bottom: 1px solid rgba(100,116,139,.2); scrollbar-width: none; }
.shop-tabs button { flex-shrink: 0; border: 1px solid transparent; background: transparent; padding: 9px 14px; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 600; color: #475569; cursor: pointer; min-height: 40px; }
.shop-tabs button.active { background: linear-gradient(135deg, #f97316, #ea580c); color: #fff; box-shadow: 0 4px 12px rgba(234,88,12,.35); }
.shop-body { padding: 16px 22px 24px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.shop-sec { margin: 0 0 16px; padding: 14px 16px; border: 1px solid rgba(100,116,139,.22); border-radius: 14px; background: rgba(248,250,252,.6); }
body.dark-mode .shop-sec { background: rgba(255,255,255,.04); }
.shop-sec-title { font-weight: 700; font-size: 14.5px; margin-bottom: 10px; }
.shop-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.shop-kpi { padding: 12px 14px; border-radius: 14px; background: linear-gradient(135deg, rgba(34,197,94,.1), rgba(34,197,94,.04)); border: 1px solid rgba(34,197,94,.25); }
.shop-kpi.warn { background: linear-gradient(135deg, rgba(239,68,68,.12), rgba(239,68,68,.04)); border-color: rgba(239,68,68,.35); }
.shop-kpi-l { font-size: 12px; color: #64748b; font-weight: 600; } .shop-kpi-v { font-size: 19px; font-weight: 800; margin: 2px 0; } .shop-kpi-s { font-size: 12px; color: #64748b; }
.shop-chart { display: flex; align-items: flex-end; gap: 8px; height: 150px; }
.shop-bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.shop-bar-fill { width: 100%; max-width: 46px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, #fb923c, #ea580c); min-height: 2px; transition: height .4s ease; }
.shop-bar-v { font-size: 11px; color: #64748b; min-height: 14px; } .shop-bar-l { font-size: 12px; font-weight: 600; color: #475569; }
.shop-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.shop-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed rgba(100,116,139,.25); font-size: 14px; }
.shop-row:last-child { border-bottom: 0; }
.shop-muted { font-size: 12.5px; color: #64748b; line-height: 1.5; } .shop-foot { font-size: 12px; color: #64748b; margin-top: 4px; }
.shop-empty { text-align: center; padding: 26px 10px 8px; color: #475569; } .shop-empty-ico { font-size: 44px; } .shop-empty-t { font-size: 18px; font-weight: 800; margin: 6px 0; color: inherit; }
.shop-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 14px; }
.shop-opt { text-align: left; border: 1.5px solid rgba(249,115,22,.35); background: rgba(255,247,237,.7); border-radius: 16px; padding: 16px; cursor: pointer; font: inherit; color: #0f172a; transition: transform .15s, box-shadow .15s; }
.shop-opt:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(234,88,12,.2); }
body.dark-mode .shop-opt { background: rgba(249,115,22,.1); color: #e5e7eb; }
.shop-opt-ico { font-size: 30px; } .shop-opt-t { font-weight: 800; font-size: 16px; margin: 6px 0 2px; } .shop-opt-d { font-size: 13px; color: #64748b; }
.shop-seg { display: inline-flex; background: rgba(100,116,139,.15); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.shop-seg button { border: 0; background: transparent; padding: 10px 16px; border-radius: 9px; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; color: inherit; min-height: 40px; }
.shop-seg button.active { background: #fff; color: #c2410c; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.shop-field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: #475569; margin-bottom: 8px; }
.shop-field input, .shop-field select, .shop-actions input, .shop-actions select { font: inherit; font-size: 15px; padding: 11px 12px; border: 1.5px solid rgba(100,116,139,.35); border-radius: 11px; background: #fff; color: #0f172a; min-height: 44px; width: 100%; box-sizing: border-box; }
.shop-actions input { width: auto; flex: 1 1 180px; }
.shop-field input:focus, .shop-actions input:focus { outline: 2px solid #f97316; outline-offset: 1px; }
.shop-preview { font-size: 13px; font-weight: 700; color: #c2410c; min-height: 18px; margin: -2px 0 6px; }
.shop-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.shop-btn { display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid rgba(100,116,139,.35); background: #fff; color: #0f172a; padding: 11px 16px; border-radius: 11px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none; min-height: 44px; transition: transform .12s, box-shadow .12s; }
.shop-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.shop-btn.primary { background: linear-gradient(135deg, #f97316, #ea580c); border-color: transparent; color: #fff; }
.shop-btn.ghost { color: #475569; } .shop-btn.danger { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.shop-x { border: 0; background: transparent; cursor: pointer; font-size: 16px; padding: 6px; border-radius: 8px; } .shop-x:hover { background: rgba(239,68,68,.12); }
.shop-drop { border: 2.5px dashed rgba(249,115,22,.5); border-radius: 16px; padding: 30px 14px; text-align: center; cursor: pointer; background: rgba(255,247,237,.5); transition: background .15s, border-color .15s; }
.shop-drop.over, .shop-drop:hover, .shop-drop:focus-visible { background: rgba(255,237,213,.9); border-color: #ea580c; outline: none; }
.shop-drop-ico { font-size: 38px; } .shop-drop-t { font-weight: 800; font-size: 16px; margin: 4px 0; }
.shop-result { margin-top: 10px; font-size: 14px; } .shop-ok { color: #15803d; font-weight: 700; } .shop-err { color: #b91c1c; font-weight: 700; }
.shop-ul { margin: 0 0 8px 18px; padding: 0; font-size: 14px; line-height: 1.6; } .shop-ul li { margin: 4px 0; }
.shop-code { background: #0f172a; border-radius: 12px; padding: 12px 14px; overflow-x: auto; }
.shop-code code, .shop-pre code { color: #86efac; font: 600 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.shop-pre { background: #0f172a; border-radius: 12px; padding: 12px 14px; overflow-x: auto; margin: 0 0 8px; } .shop-pre code { white-space: pre; }
.shop-warn { margin-top: 10px; font-size: 12.5px; padding: 9px 12px; border-radius: 10px; background: rgba(245,158,11,.12); color: #92400e; line-height: 1.5; }
.shop-codebox { margin-top: 10px; } .shop-code-big { font: 800 34px/1 ui-monospace, Menlo, monospace; letter-spacing: 6px; color: #c2410c; padding: 10px 0; }
@media (max-width: 768px) {
  .shop-modal { padding: 0; align-items: flex-end; }
  .shop-card { width: 100%; max-height: 94dvh; border-radius: 20px 20px 0 0; }
  .shop-head { padding: 14px 16px 6px; } .shop-body { padding: 12px 14px 22px; }
  .shop-cols { grid-template-columns: 1fr; } .shop-kpis { grid-template-columns: repeat(2, 1fr); }
  .shop-actions .shop-btn, .shop-actions input { flex: 1 1 100%; }
}
#toast { z-index: 100002 !important; }

/* ===== Hướng dẫn từng bước (cq-guide) ===== */
.cqg-help-btn { line-height: 1; position: relative; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; border: 2px solid rgba(249,115,22,.55); background: linear-gradient(135deg,#fb923c,#ea580c); color: #fff; font-weight: 800; font-size: 20px; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; margin-left: 8px; box-shadow: 0 4px 12px rgba(234,88,12,.35); transition: transform .15s, box-shadow .15s; }
.cqg-help-btn:hover { transform: translateY(-2px) scale(1.06); box-shadow: 0 8px 18px rgba(234,88,12,.45); }
.cqg-help-btn .dot { position: absolute; top: -3px; right: -3px; width: 14px; height: 14px; border-radius: 50%; background: #ef4444; border: 2px solid #fff; animation: cqgPulse 1.6s infinite; }
.cqg-help-btn .dot[hidden] { display: none; }
@keyframes cqgPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.25); } }
.cqg-layer { position: fixed; inset: 0; z-index: 100010; }
.cqg-dim { position: absolute; inset: 0; background: transparent; }
.cqg-dim.solid { background: rgba(15,23,42,.62); }
.cqg-spot { position: absolute; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(15,23,42,.62), 0 0 0 3px #fb923c; transition: all .25s ease; pointer-events: none; display: none; }
.cqg-card, .cqg-corner, .cqg-modal-box, .cqg-menu { font-family: inherit; color: #1f2937; background: #fff; border-radius: 16px; box-shadow: 0 18px 50px rgba(15,23,42,.35); }
.cqg-card { position: absolute; padding: 18px 18px 14px; width: 380px; max-width: calc(100vw - 24px); max-height: calc(100vh - 24px); overflow: auto; }
.cqg-card.center { left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(440px, calc(100vw - 24px)); }
.cqg-card.sheet { left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none; border-radius: 18px 18px 0 0; max-height: 70vh; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
.cqg-x { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(100,116,139,.12); color: #475569; cursor: pointer; font-size: 15px; }
.cqg-x:hover { background: rgba(100,116,139,.25); }
.cqg-ico { font-size: 30px; line-height: 1; margin-bottom: 4px; }
.cqg-meta { font-size: 12px; color: #ea580c; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.cqg-title { margin: 4px 30px 8px 0; font-size: 18px; line-height: 1.3; }
.cqg-body { font-size: 14.5px; line-height: 1.55; }
.cqg-body p { margin: 0 0 8px; } .cqg-body ul, .cqg-corner ul, .cqg-rel ul { margin: 4px 0 8px; padding-left: 20px; } .cqg-body li { margin: 3px 0; }
.cqg-extra { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.cqg-try, .cqg-ebook { min-height: 40px; padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 13.5px; font-family: inherit; text-decoration: none; display: inline-flex; align-items: center; cursor: pointer; }
.cqg-try { border: 0; background: #0d9488; color: #fff; }
.cqg-ebook { border: 1.5px solid #cbd5e1; background: #fff; color: #334155; }
.cqg-dots { display: flex; gap: 5px; justify-content: center; margin: 8px 0; flex-wrap: wrap; }
.cqg-dots i { width: 7px; height: 7px; border-radius: 50%; background: #e2e8f0; } .cqg-dots i.past { background: #fdba74; } .cqg-dots i.on { background: #ea580c; width: 18px; border-radius: 5px; }
.cqg-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; }
.cqg-next, .cqg-skip, .cqg-back { min-height: 44px; padding: 8px 18px; border-radius: 12px; font-weight: 700; font-size: 14px; font-family: inherit; cursor: pointer; }
.cqg-next { border: 0; background: linear-gradient(135deg,#fb923c,#ea580c); color: #fff; margin-left: auto; }
.cqg-skip, .cqg-back { border: 0; background: transparent; color: #64748b; }
.cqg-corner { position: fixed; right: 16px; bottom: 16px; z-index: 100005; width: 340px; max-width: calc(100vw - 24px); padding: 16px; border: 2px solid rgba(249,115,22,.4); animation: cqgIn .35s ease; }
.cqg-corner p { margin: 4px 0 8px; font-size: 14px; line-height: 1.5; } .cqg-corner li { font-size: 13.5px; margin: 2px 0; }
@keyframes cqgIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.cqg-menu { position: fixed; z-index: 100008; width: 340px; max-width: calc(100vw - 24px); max-height: calc(100vh - 90px); overflow: auto; padding: 8px; }
.cqg-menu-h { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 8px 8px; } .cqg-menu-h span { font-size: 12px; color: #64748b; }
.cqg-sep { padding: 8px 8px 4px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: #94a3b8; letter-spacing: .04em; }
.cqg-item { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; padding: 9px 10px; min-height: 48px; border: 0; background: transparent; border-radius: 10px; cursor: pointer; font-family: inherit; color: inherit; }
.cqg-item:hover, .cqg-item:focus-visible { background: rgba(249,115,22,.1); outline: none; }
.cqg-item .i { font-size: 22px; width: 28px; text-align: center; } .cqg-item .t { flex: 1; display: flex; flex-direction: column; line-height: 1.3; } .cqg-item b { font-size: 14px; } .cqg-item small { font-size: 12px; color: #64748b; }
.cqg-item .bd { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #f1f5f9; color: #475569; }
.cqg-item.new .bd { background: #ef4444; color: #fff; }
.cqg-modal { position: fixed; inset: 0; z-index: 100009; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; padding: 12px; }
.cqg-modal-box { position: relative; width: 520px; max-width: 100%; max-height: 86vh; overflow: auto; padding: 20px; }
.cqg-rel { margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: #fff7ed; } .cqg-rel-h { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; } .cqg-rel-h span { font-size: 12px; color: #9a3412; } .cqg-rel li { font-size: 13.5px; margin: 2px 0; }
body.dark-mode .cqg-card, body.dark-mode .cqg-corner, body.dark-mode .cqg-modal-box, body.dark-mode .cqg-menu { background: #111827; color: #e5e7eb; }
body.dark-mode .cqg-ebook { background: transparent; color: #e2e8f0; border-color: #475569; } body.dark-mode .cqg-rel { background: rgba(249,115,22,.12); } body.dark-mode .cqg-rel-h span, body.dark-mode .cqg-item small, body.dark-mode .cqg-menu-h span { color: #cbd5e1; }
body.dark-mode .cqg-item .bd { background: #1f2937; color: #cbd5e1; } body.dark-mode .cqg-dots i { background: #334155; } body.dark-mode .cqg-x { color: #e2e8f0; }
@media (max-width: 768px) {
  .cqg-help-btn { width: 40px; height: 40px; margin-left: 6px; }
  .cqg-corner { left: 12px; right: 12px; bottom: 12px; width: auto; }
  .cqg-modal { align-items: flex-end; padding: 0; } .cqg-modal-box { border-radius: 18px 18px 0 0; max-height: 88vh; }
}

/* ===== Tư vấn 1-1 (cq-consult) ===== */
.cq-consult-btn { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; margin: 8px 0 0; padding: 10px 12px; border: 1.5px solid rgba(13,148,136,.4); border-radius: 12px; background: linear-gradient(135deg, rgba(240,253,250,.95), rgba(204,251,241,.7)); color: #115e59; cursor: pointer; font-family: inherit; transition: transform .15s, box-shadow .15s; }
.cq-consult-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(13,148,136,.22); }
.cq-consult-btn .soi { font-size: 24px; } .cq-consult-btn .sot { display: flex; flex-direction: column; line-height: 1.25; } .cq-consult-btn b { font-size: 14px; } .cq-consult-btn small { font-size: 11.5px; opacity: .85; }
body.dark-mode .cq-consult-btn { background: rgba(13,148,136,.16); color: #5eead4; border-color: rgba(45,212,191,.4); }
.cq-consult-hero { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; margin: 10px auto 4px; padding: 12px 22px; min-height: 48px; border: 0; border-radius: 14px; background: linear-gradient(135deg,#14b8a6,#0d9488); color: #fff; font-weight: 700; font-size: 15px; font-family: inherit; cursor: pointer; box-shadow: 0 6px 16px rgba(13,148,136,.35); transition: transform .15s; }
.cq-consult-hero:hover { transform: translateY(-2px); } .cq-consult-hero small { font-weight: 500; font-size: 12px; opacity: .9; }
.cq-consult { max-width: 560px; }
.cqc-head { display: flex; justify-content: space-between; margin-bottom: 6px; } .cqc-step { font-size: 12px; font-weight: 700; color: #0d9488; text-transform: uppercase; }
.cqc-bar { height: 5px; border-radius: 4px; background: rgba(100,116,139,.2); overflow: hidden; margin-bottom: 10px; } .cqc-bar i { display: block; height: 100%; background: linear-gradient(90deg,#14b8a6,#fb923c); transition: width .3s; }
.cqc-intro { font-size: 14px; margin: 0 0 8px; opacity: .9; } .cqc-q { font-weight: 700; font-size: 16px; margin: 4px 0 10px; }
.cqc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cqc-chip { min-height: 42px; padding: 8px 14px; border-radius: 99px; border: 1.5px solid rgba(13,148,136,.4); background: rgba(240,253,250,.9); color: #115e59; font-weight: 600; font-size: 14px; font-family: inherit; cursor: pointer; transition: all .12s; text-align: left; }
.cqc-chip:hover { background: #ccfbf1; } .cqc-chip.on { background: #0d9488; color: #fff; border-color: #0d9488; }
body.dark-mode .cqc-chip { background: rgba(13,148,136,.15); color: #99f6e4; } body.dark-mode .cqc-chip.on { background: #0d9488; color: #fff; }
.cqc-other input { width: 100%; box-sizing: border-box; margin-top: 10px; padding: 10px 12px; min-height: 42px; border-radius: 10px; border: 1.5px solid #cbd5e1; font-size: 14px; font-family: inherit; background: transparent; color: inherit; }
.cqc-nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.cqc-link { border: 0; background: transparent; color: #64748b; font-weight: 600; font-size: 13px; font-family: inherit; cursor: pointer; padding: 10px 4px; min-height: 40px; } .cqc-link:hover { color: #0d9488; text-decoration: underline; }
.cqc-ok { margin-left: auto; min-height: 44px; padding: 8px 20px; border: 0; border-radius: 12px; background: linear-gradient(135deg,#14b8a6,#0d9488); color: #fff; font-weight: 700; font-size: 14px; font-family: inherit; cursor: pointer; } .cqc-ok:disabled { opacity: .45; cursor: not-allowed; }
.cqc-sum { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; } .cqc-sum-row { display: flex; gap: 10px; padding: 7px 10px; border-radius: 10px; background: rgba(13,148,136,.08); font-size: 13.5px; } .cqc-sum-row span { flex: 0 0 120px; color: #64748b; }
.cq-checkin { margin: 0 auto 14px; max-width: 560px; padding: 14px 16px; border: 2px solid rgba(13,148,136,.45); border-radius: 16px; background: linear-gradient(135deg, rgba(240,253,250,.95), rgba(255,247,237,.9)); text-align: left; color: #134e4a; animation: cqgIn .35s ease; }
.cqk-t { font-weight: 800; font-size: 15px; margin-bottom: 4px; } .cqk-p { margin: 0 0 10px; font-size: 14px; line-height: 1.5; }
body.dark-mode .cq-checkin { background: rgba(13,148,136,.14); color: #ccfbf1; }
@media (max-width: 768px) { .cqc-sum-row span { flex-basis: 96px; } .cqc-ok { width: 100%; } }

/* ── Trợ lý của tôi (v2.8) ── */
.as-hero { display: flex; gap: 14px; align-items: center; padding: 14px 16px; margin-bottom: 14px; border-radius: 16px; background: linear-gradient(135deg, rgba(249,115,22,.14), rgba(168,85,247,.12)); border: 1px solid rgba(249,115,22,.28); }
.as-hero-ico { font-size: 34px; line-height: 1; }
.as-hero-t { font-weight: 800; font-size: 16px; margin-bottom: 3px; }
.as-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-top: 8px; }
.as-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.as-chip { border: 1.5px solid rgba(249,115,22,.4); background: rgba(249,115,22,.08); color: #c2410c; border-radius: 999px; padding: 8px 13px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; min-height: 38px; transition: background .12s, transform .12s; }
.as-chip:hover { background: rgba(249,115,22,.18); transform: translateY(-1px); }
.as-lock { padding: 12px 14px; margin-bottom: 10px; border-radius: 12px; background: rgba(245,158,11,.1); border: 1px dashed rgba(245,158,11,.55); }
.as-lock-t { font-weight: 800; font-size: 14px; margin-bottom: 4px; color: #92400e; }
.as-mems { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; max-height: 300px; overflow: auto; }
.as-mem { display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border-radius: 11px; background: rgba(100,116,139,.08); font-size: 14px; line-height: 1.45; }
.as-mem.pinned { background: rgba(249,115,22,.1); border: 1px solid rgba(249,115,22,.3); }
.as-mem-k { font-size: 18px; flex: none; }
.as-mem-t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.as-mem-b { flex: none; border: 0; background: transparent; cursor: pointer; font-size: 17px; padding: 6px 8px; min-width: 38px; min-height: 38px; border-radius: 8px; }
.as-mem-b:hover { background: rgba(100,116,139,.18); }
.as-switch { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; min-height: 40px; cursor: pointer; }
.as-switch input { width: 20px; height: 20px; accent-color: #f97316; }
.msg-note.cq-memnote { font-size: 12.5px; opacity: .9; }
body.dark-mode .as-chip { color: #fdba74; }
body.dark-mode .as-lock-t { color: #fcd34d; }
body.dark-mode .as-mem { background: rgba(255,255,255,.06); }

/* hạn mức lượt chat */
.cq-quota{max-width:820px;margin:0 auto 6px;padding:5px 12px;font-size:12px;font-weight:600;border-radius:999px;display:inline-flex;align-items:center;gap:6px;flex-wrap:wrap;background:rgba(16,185,129,.12);color:#047857;border:1px solid rgba(16,185,129,.3)}
.cq-quota.low{background:rgba(245,158,11,.14);color:#92400e;border-color:rgba(245,158,11,.4)}
.cq-quota.out{background:rgba(239,68,68,.12);color:#b91c1c;border-color:rgba(239,68,68,.35)}
.cq-quota a{color:inherit;text-decoration:underline;font-weight:800}
