/* Campaign Agent v2 — tinh gọn cho người không rành digital: một cột chat, chữ to, ít thứ trên màn hình. */
:root {
  color-scheme: dark;
  --bg: #0E0A08;
  --panel: #16110E;
  --panel-2: #1D1612;
  --line: rgba(230, 195, 154, .12);
  --line-2: rgba(230, 195, 154, .22);
  --text: #F4ECE4;
  --muted: #B9A99B;
  --muted-2: #8C7C70;
  --crema: #E6C39A;
  --caramel: #C28E5F;
  --accent: #D9505C;
  --ok: #7FC8A0;
  --warn: #F0B45B;
  --bad: #E36A6A;
  --grad: linear-gradient(90deg, #3E2519, #6F4E37 34%, #8E1B2B 74%, #B8323F);
  --grad-text: linear-gradient(90deg, #E6C39A, #C28E5F 42%, #C8404C);
  --display: "Display", "Arial Narrow", system-ui, sans-serif;
  --body: "Body", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--body); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--crema); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--crema); outline-offset: 2px; }

/* ---------- nút ---------- */
.btn { display: inline-flex; align-items: center; gap: 10px; border: 1px solid var(--line-2); background: transparent; border-radius: 999px; padding: 10px 18px; cursor: pointer; font-weight: 600; font-size: 15px; line-height: 1.2; text-decoration: none; color: var(--text); transition: background .15s, border-color .15s, opacity .15s; }
.btn:hover { background: rgba(230, 195, 154, .06); border-color: var(--crema); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { background: #8E1B2B; border-color: #B8323F; color: #fff; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn .cost { font: 500 12px var(--mono); background: rgba(0, 0, 0, .28); border-radius: 999px; padding: 3px 8px; letter-spacing: .02em; }
.btn.small { padding: 7px 13px; font-size: 14px; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; font-size: 13px; }
.linkbtn:hover { color: var(--text); background: rgba(255, 255, 255, .05); }

/* ---------- tin nhắn ---------- */
.msg { margin: 0 0 22px; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble { background: var(--panel-2); border: 1px solid var(--line); border-radius: 18px 18px 4px 18px; padding: 11px 16px; max-width: 86%; white-space: pre-wrap; word-break: break-word; }
.msg.agent .body { font-size: 16.5px; }
.msg.agent .body p { margin: 0 0 10px; }
.msg.agent .body p:last-child { margin-bottom: 0; }
.msg.agent .body ul { margin: 6px 0 10px; padding-left: 20px; }
.msg.followup .body { border-left: 3px solid var(--crema); padding-left: 14px; }
.msg .tools { display: flex; align-items: center; gap: 2px; margin-top: 6px; opacity: .55; transition: opacity .15s; }
.msg:hover .tools, .msg .tools:focus-within { opacity: 1; }
.msg .tools .on { color: var(--crema); }
.msg .tools .code { font: 500 11.5px var(--mono); color: var(--muted-2); margin-left: 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.sources { margin-top: 8px; font-size: 13px; color: var(--muted-2); }
.sources a { color: var(--muted); }
.typing { color: var(--muted-2); font-size: 15px; display: flex; gap: 6px; align-items: center; margin-bottom: 22px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; } }

/* ---------- thẻ ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-top: 14px; }
.card h4 { margin: 0 0 4px; font: 700 22px/1.15 var(--display); text-transform: uppercase; letter-spacing: .02em; }
.card .sub { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.progress { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin-top: 12px; }
.bar { flex: none; width: 120px; height: 6px; background: rgba(255, 255, 255, .07); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--grad); }
.rows { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; gap: 8px 16px; margin: 0; }
.rows dt { color: var(--muted); font-size: 14px; }
.rows dd { margin: 0; word-break: break-word; }
.tag { display: inline-block; font: 500 11px var(--mono); letter-spacing: .06em; color: var(--muted-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: 2px; }
details { margin-top: 12px; }
details summary { cursor: pointer; color: var(--muted); font-size: 14px; list-style: none; }
details summary::before { content: "▸ "; }
details[open] summary::before { content: "▾ "; }
details > div { margin-top: 12px; }
.numbers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.numbers div { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; }
.numbers b { display: block; font-size: 18px; }
.numbers span { color: var(--muted); font-size: 13px; }
.box { border-radius: 10px; padding: 12px 14px; margin-top: 10px; background: var(--panel-2); }
.box.bad { border-left: 3px solid var(--bad); }
.box.warn { border-left: 3px solid var(--warn); }
.box.good { border-left: 3px solid var(--ok); }
.box b { display: block; margin-bottom: 2px; }
.box p { margin: 2px 0 0; color: var(--muted); font-size: 14.5px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.list { margin: 8px 0 0; padding-left: 20px; }
.list li { margin-bottom: 6px; }
.optitem { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.optitem:first-of-type { border-top: 0; }
.optitem p { margin: 2px 0 0; color: var(--muted); font-size: 14.5px; }
.note { font-size: 13px; color: var(--muted-2); margin-top: 10px; }
.badge-test { display: inline-block; background: rgba(240, 180, 91, .14); color: var(--warn); border-radius: 999px; font-size: 12px; padding: 2px 9px; margin-left: 8px; vertical-align: 2px; }

/* ---------- ô nhập ---------- */
.composer { padding: 12px 24px 18px; }
.composer form { max-width: 780px; margin: 0 auto; display: flex; gap: 10px; align-items: flex-end; background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; padding: 8px 8px 8px 16px; }
.composer form:focus-within { border-color: var(--crema); }
.composer textarea { flex: 1; resize: none; border: 0; background: transparent; outline: none; font-size: 16.5px; line-height: 1.5; padding: 8px 0; max-height: 220px; }
.composer textarea::placeholder { color: var(--muted-2); }
.send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--grad); color: #fff; cursor: pointer; display: grid; place-items: center; flex: none; }
.send[disabled] { opacity: .4; cursor: not-allowed; }
.hello .composer { padding: 0; }
.hint { max-width: 780px; margin: 8px auto 0; color: var(--muted-2); font-size: 12.5px; text-align: center; }

/* ---------- modal & toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; padding: 24px; width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; }
.modal h2 { font: 700 26px var(--display); text-transform: uppercase; margin: 0 0 8px; }
.modal .row-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #2A201A; border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 18px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { border-color: var(--bad); }
table.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
table.simple td, table.simple th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.simple th { color: var(--muted); font-weight: 500; }

/* ---------- khung website: menu + chân trang giống website ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.site-header { position: sticky; top: 0; z-index: 30; background: rgba(14, 10, 8, .86); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(217, 80, 92, .18); }
.site-header .nav { display: flex; align-items: center; gap: 24px; height: 72px; }
.logo { display: flex; align-items: center; gap: 10px; font: 700 18px var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--text); text-decoration: none; white-space: nowrap; }
.nav-links { display: flex; gap: 22px; margin-left: auto; }
.nav-links a { color: var(--muted); text-decoration: none; font: 600 14px var(--display); letter-spacing: .1em; text-transform: uppercase; }
.nav-links a:hover, .nav-links a.active { color: var(--crema); }
.nav-right { display: flex; gap: 8px; align-items: center; }
.hpill { display: inline-flex; align-items: center; gap: 7px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; color: var(--muted); cursor: pointer; font-size: 13.5px; white-space: nowrap; }
.hpill:hover { border-color: var(--line-2); color: var(--text); }
.hpill b { color: var(--text); }
.iconbtn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: none; display: grid; place-items: center; cursor: pointer; flex: none; }
.menu-toggle { display: none; }
.mobile-menu[hidden] { display: none; }
.mobile-menu { border-top: 1px solid var(--line); padding: 8px 24px 14px; display: grid; }
.mobile-menu a { color: var(--muted); text-decoration: none; padding: 10px 0; font: 600 15px var(--display); letter-spacing: .08em; text-transform: uppercase; }
.site-footer { border-top: 1px solid var(--line); margin-top: 72px; padding: 44px 0 26px; color: var(--muted); font-size: 14px; background: #0B0806; }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 28px; }
.foot-grid h4 { font: 600 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); margin: 4px 0 12px; }
.foot-grid a, .foot-grid span { display: block; color: var(--muted); text-decoration: none; margin-bottom: 8px; }
.foot-grid a:hover { color: var(--crema); }
.foot-grid p { max-width: 320px; }
.foot-base { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted-2); }
.page { min-height: calc(100vh - 72px); }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.wide { width: 100%; justify-content: center; padding: 13px; }
.kicker { font: 500 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.muted { color: var(--muted); font-size: 14px; }
.grad { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- hero + minh hoạ (chỗ đặt ảnh quảng cáo) ---------- */
.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; padding: 48px 0 36px; }
.hero h1 { font: 700 clamp(44px, 5.6vw, 76px)/1.02 var(--display); text-transform: uppercase; margin: 14px 0 16px; }
.hero p { color: var(--muted); font-size: 17px; max-width: 560px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 14px; }
.hero .note { font-size: 13.5px; color: var(--muted-2); }
.greet { padding: 36px 0 8px; }
.greet h1 { font: 700 46px var(--display); text-transform: uppercase; margin: 0; }
.greet p { color: var(--muted); margin: 4px 0 0; }
.art { position: relative; min-height: 400px; border-radius: 24px; overflow: hidden; background: radial-gradient(420px 300px at 70% 20%, rgba(184, 50, 63, .35), transparent 70%), radial-gradient(420px 320px at 20% 90%, rgba(111, 78, 55, .45), transparent 70%), #140E0B; border: 1px solid var(--line); display: grid; place-items: center; }
.art-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.phone { position: relative; width: 230px; height: 360px; border-radius: 30px; background: #0B0806; border: 1px solid var(--line-2); box-shadow: 0 30px 60px rgba(0, 0, 0, .5); padding: 14px; }
.ph-top { width: 70px; height: 6px; border-radius: 6px; background: #2A201A; margin: 0 auto 14px; }
.ad { background: #1D1612; border-radius: 14px; padding: 10px; }
.ad-h { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.ad-h i { width: 22px; height: 22px; border-radius: 50%; background: var(--grad); }
.ad-img { height: 190px; border-radius: 10px; background: linear-gradient(140deg, #6F4E37, #3E2519 45%, #8E1B2B); display: grid; place-items: center; color: rgba(255, 255, 255, .55); font-size: 12px; }
.ad-cta { margin-top: 8px; text-align: center; background: #2A201A; border-radius: 8px; padding: 7px; font-size: 12.5px; font-weight: 600; }
.float { position: absolute; background: rgba(22, 17, 14, .92); border: 1px solid var(--line-2); border-radius: 14px; padding: 10px 14px; font-size: 13px; box-shadow: 0 12px 30px rgba(0, 0, 0, .4); }
.float b { display: block; font-size: 22px; color: var(--ok); }
.float span { color: var(--muted); }
.f1 { top: 34px; left: 22px; }
.f2 { bottom: 30px; right: 18px; max-width: 250px; color: var(--text); }

/* ---------- tổng quan ---------- */
.dash-loading { color: var(--muted); padding: 40px 0; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; margin-top: 10px; }
.sec-head { display: flex; align-items: center; gap: 10px; margin: 8px 0 14px; }
.sec-head h2, .ask-block h2 { font: 700 28px var(--display); text-transform: uppercase; margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kpi span { color: var(--muted); font-size: 13.5px; display: block; }
.kpi b { display: block; font-size: 24px; margin: 4px 0 2px; font-weight: 600; }
.kpi em { font-style: normal; font-size: 12.5px; color: var(--muted-2); }
.kpi em.up-good { color: var(--ok); } .kpi em.up-bad { color: var(--bad); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; margin-bottom: 16px; }
.panel-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.panel h3 { margin: 0; font-size: 16px; }
.muted-panel { opacity: .85; }
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .gl { stroke: rgba(230, 195, 154, .1); }
.chart .ax { fill: var(--muted-2); font-size: 11px; font-family: var(--body); }
.chart .ln { fill: none; stroke: #D9505C; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .xh { stroke: var(--muted-2); stroke-dasharray: 3 3; }
.chart .dotm { fill: #D9505C; stroke: var(--panel); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .tip { position: absolute; top: 4px; background: #2A201A; border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; pointer-events: none; white-space: nowrap; }
.chart .tbl summary { font-size: 13px; }
.table-wrap { overflow-x: auto; }
.camp td:first-child { font-weight: 500; }
.rate { display: inline-flex; gap: 5px; align-items: center; font-size: 13px; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.rate.good { background: rgba(127, 200, 160, .12); color: var(--ok); }
.rate.watch { background: rgba(240, 180, 91, .12); color: var(--warn); }
.rate.bad { background: rgba(227, 106, 106, .12); color: var(--bad); }
.ask-block { margin-top: 26px; background: linear-gradient(135deg, rgba(111, 78, 55, .22), rgba(142, 27, 43, .16)); border: 1px solid var(--line-2); border-radius: 20px; padding: 26px; display: grid; gap: 16px; }
.ask-copy p { color: var(--muted); margin: 6px 0 0; }
.recent h3 { font: 500 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); margin: 6px 0 8px; }
.recent-item { display: flex; justify-content: space-between; gap: 12px; width: 100%; background: rgba(0, 0, 0, .18); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; margin-bottom: 8px; cursor: pointer; text-align: left; }
.recent-item:hover { border-color: var(--line-2); }
.recent-item small { color: var(--muted-2); white-space: nowrap; }
.promo { position: relative; overflow: hidden; margin-top: 22px; border-radius: 20px; border: 1px solid var(--line); padding: 24px 26px; display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; background: radial-gradient(500px 200px at 100% 0%, rgba(184, 50, 63, .28), transparent 70%), var(--panel); }
.promo-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .35; z-index: 0; }
.promo > * { position: relative; }
.promo h3 { margin: 6px 0 4px; font: 700 26px var(--display); text-transform: uppercase; }
.promo p { margin: 0; color: var(--muted); }

/* ---------- trang trò chuyện ---------- */
.chat { max-width: 820px; }
.chat-top { display: flex; align-items: center; gap: 12px; padding: 22px 0 6px; }
.chat-top h1 { font: 700 26px/1.15 var(--display); text-transform: uppercase; margin: 0; }
.back { font-size: 14px; }
.thread { padding: 18px 0 8px; min-height: 40vh; }
.composer.sticky { position: sticky; bottom: 0; padding: 12px 0 18px; background: linear-gradient(transparent, var(--bg) 30%); }
.composer form { display: flex; gap: 10px; align-items: flex-end; background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; padding: 8px 8px 8px 16px; }
.composer form:focus-within { border-color: var(--crema); }
.composer textarea { flex: 1; resize: none; border: 0; background: transparent; outline: none; font-size: 16.5px; line-height: 1.5; padding: 8px 0; max-height: 220px; }
.composer textarea::placeholder { color: var(--muted-2); }
.send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--grad); color: #fff; cursor: pointer; display: grid; place-items: center; flex: none; }

/* ---------- đăng nhập ---------- */
.auth { display: grid; grid-template-columns: 1fr 440px; gap: 48px; align-items: center; max-width: 1100px; margin: 0 auto; padding: 48px 24px; }
.auth h1 { font: 700 44px/1 var(--display); text-transform: uppercase; margin: 0 0 8px; }
.auth p.lead { color: var(--muted); margin: 0 0 22px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14px; color: var(--muted); }
.field input, .field select, .field textarea { background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; outline: none; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--crema); }
.auth .switch { margin-top: 18px; color: var(--muted); font-size: 14px; text-align: center; }
.auth .switch button { background: none; border: 0; color: var(--crema); cursor: pointer; text-decoration: underline; }
.err { color: var(--bad); font-size: 14px; min-height: 20px; margin-top: 8px; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plans label { border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; cursor: pointer; font-size: 14px; color: var(--muted); }
.plans input { margin-right: 6px; }
.plans label:has(input:checked) { border-color: var(--crema); color: var(--text); }

/* ---------- admin ---------- */
.admin h1 { font: 700 40px var(--display); text-transform: uppercase; margin: 0 0 4px; }
.tabs { display: flex; gap: 6px; margin: 18px 0; flex-wrap: wrap; }
.tabs button { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.tabs button.on { border-color: var(--crema); color: var(--text); }
.qitem { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.qitem .meta { font-size: 13px; color: var(--muted-2); margin-bottom: 8px; display: flex; gap: 10px; flex-wrap: wrap; }
.qitem .q { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; white-space: pre-wrap; }
.qitem .a { white-space: pre-wrap; color: var(--muted); }
.chip { font: 500 11.5px var(--mono); border-radius: 999px; padding: 2px 8px; background: rgba(217, 80, 92, .14); color: #F2A0A6; }
.chip.new { background: rgba(240, 180, 91, .14); color: var(--warn); }

/* ---------- màn nhỏ ---------- */
@media (max-width: 1100px) {
  .nav-links { display: none; }
  .menu-toggle { display: grid; }
  .nav-right { margin-left: auto; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .wrap { padding: 0 16px; }
  .hero { grid-template-columns: 1fr; padding-top: 28px; gap: 24px; }
  .art { min-height: 320px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .auth { grid-template-columns: 1fr; padding-top: 24px; }
  .auth-art { display: none; }
  .rows { grid-template-columns: 1fr; gap: 2px 0; }
  .rows dd { margin-bottom: 8px; }
  .numbers { grid-template-columns: 1fr 1fr; }
  .card { padding: 16px; }
  .optitem { flex-direction: column; }
  .msg.user .bubble { max-width: 92%; }
}
@media (max-width: 520px) {
  .chart .ax { font-size: 24px; }
  .chart .ln { stroke-width: 4; }
  .chart .dotm { r: 8; }
  .logo span { display: none; }
  .hpill { padding: 7px 10px; }
  #p-acc { display: none; }
  .site-header .nav { gap: 10px; }
  .ask-block { padding: 18px; }
}

/* ---------- cửa sổ trò chuyện nổi ---------- */
.chat-win { position: fixed; z-index: 41; right: 20px; top: 20px; bottom: 20px; width: min(600px, calc(100vw - 40px)); display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--line-2); border-radius: 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, .55); overflow: hidden; animation: slidein .24s cubic-bezier(.2, .8, .2, 1); }
@keyframes slidein { from { transform: translateY(18px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
.cw-head { cursor: grab; user-select: none; touch-action: none; display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #1D1612, var(--bg)); }
.cw-ava, .m-ava { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line-2); }
.cw-ava svg, .m-ava svg { width: 22px; height: 22px; }
.cw-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.cw-t b { font: 700 18px var(--display); text-transform: uppercase; letter-spacing: .03em; }
.cw-t span { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-head .iconbtn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 16px; color: var(--muted); }
.cw-head .iconbtn:hover { color: var(--text); border-color: var(--crema); }
.chat-win .thread { flex: 1; overflow-y: auto; padding: 20px 18px 8px; min-height: 0; overscroll-behavior: contain; }
.chat-win .composer { padding: 10px 14px 14px; border-top: 1px solid var(--line); }
.chat-win .composer form { max-width: none; }
.cw-empty { color: var(--muted); text-align: center; padding: 40px 10px; }
.chat-win .msg.agent { display: flex; gap: 12px; align-items: flex-start; }
.chat-win .m-ava { width: 32px; height: 32px; margin-top: 2px; }
.chat-win .m-ava svg { width: 18px; height: 18px; }
.chat-win .m-main { flex: 1; min-width: 0; }
.chat-win .msg.agent .body { font-size: 16px; }
.chat-win .card { padding: 16px; }
.chat-win .rows { grid-template-columns: minmax(110px, 32%) 1fr; gap: 6px 14px; }
.chat-win .rows dd { margin: 0; }
.chat-win .numbers { grid-template-columns: 1fr 1fr 1fr; }

/* nhận xét sản phẩm */
.insight { margin-top: 14px; border-radius: 16px; padding: 16px; background: radial-gradient(120% 140% at 100% 0%, rgba(142, 27, 43, .35), transparent 55%), var(--panel); border: 1px solid var(--line-2); }
.in-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 12px; }
.in-h .kicker { width: 100%; font: 600 11.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--crema); }
.in-h b { font: 700 22px/1.1 var(--display); text-transform: uppercase; }
.in-h small { color: var(--muted); font-size: 13.5px; }
.in-pts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.in-pt { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .035); border: 1px solid var(--line); font-size: 14px; line-height: 1.4; }
.in-pt svg { color: var(--accent); }
.in-note { margin: 10px 0 0; color: var(--muted-2); font-size: 12.5px; }

/* brief dạng danh sách tick */
.checklist { margin-top: 14px; padding: 14px 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.cl-h { display: flex; align-items: center; gap: 12px; font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.cl-h span:first-child { font: 600 11.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--crema); }
.cl-h .bar { flex: 1; width: auto; }
.cl-h b { color: var(--text); font-family: var(--mono); font-size: 13px; }
.checklist ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.checklist li { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 6px; border-radius: 999px; font-size: 13.5px; color: var(--muted-2); border: 1px dashed var(--line-2); }
.checklist .ck { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; border: 1px solid var(--line-2); }
.checklist li.done { color: var(--text); border-style: solid; border-color: rgba(127, 200, 160, .35); background: rgba(127, 200, 160, .08); }
.checklist li.done .ck { background: var(--ok); border-color: var(--ok); color: #0E0A08; font-weight: 700; }
.checklist li.now { color: var(--text); border: 1px solid var(--accent); background: rgba(217, 80, 92, .12); }
.checklist li.now .ck { border-color: var(--accent); color: var(--accent); font-size: 18px; line-height: 0; }
.checklist li em { font-style: normal; font-size: 11.5px; color: var(--accent); margin-left: 2px; }

/* trả lời nhanh */
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.qchip { border: 1px solid var(--line-2); background: var(--panel); color: var(--text); border-radius: 999px; padding: 9px 15px; font-size: 14.5px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s, transform .1s; }
.qchip:hover { border-color: var(--crema); background: var(--panel-2); }
.qchip:active { transform: scale(.97); }
.qchip.pri { background: var(--grad); border-color: transparent; color: #fff; }

/* cửa sổ thu nhỏ */
.chat-pill { position: fixed; right: 20px; bottom: 20px; z-index: 41; display: flex; align-items: center; gap: 12px; max-width: min(360px, calc(100vw - 40px)); padding: 10px 18px 10px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: 0 14px 40px rgba(0, 0, 0, .5); cursor: pointer; text-align: left; animation: slidein .2s ease; }
.chat-pill svg { flex: none; width: 36px; height: 36px; padding: 7px; border-radius: 50%; background: var(--bg); }
.chat-pill span { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.chat-pill b { font-size: 14px; }
.chat-pill small { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 720px) {
  body:has(.chat-win) { overflow: hidden; }
  .chat-win { inset: 0; width: 100%; border-radius: 0; border: 0; }
  .cw-rs, #cw-max { display: none; }
  .cw-head { cursor: default; }
  .chat-win .thread { padding: 16px 14px 8px; }
  .chat-win .m-ava { display: none; }
  .chat-win .rows { grid-template-columns: 1fr; gap: 2px 0; }
  .chat-win .rows dd { margin: 0 0 8px; }
  .in-pts { grid-template-columns: 1fr; }
  .in-pt { flex-direction: row; align-items: center; }
  .chat-win .numbers { grid-template-columns: 1fr 1fr; }
  .chat-pill { right: 12px; bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) { .chat-win, .chat-pill { animation: none; } }
.chat-win.moving { user-select: none; box-shadow: 0 40px 100px rgba(0, 0, 0, .7); }
.chat-win.moving .cw-head { cursor: grabbing; }
.chat-win.max { inset: 12px !important; width: auto !important; height: auto !important; }
.cw-rs { position: absolute; z-index: 2; touch-action: none; }
.cw-rs.e, .cw-rs.w { top: 14px; bottom: 14px; width: 8px; cursor: ew-resize; }
.cw-rs.e { right: -3px; } .cw-rs.w { left: -3px; }
.cw-rs.n, .cw-rs.s { left: 14px; right: 14px; height: 8px; cursor: ns-resize; }
.cw-rs.n { top: -3px; } .cw-rs.s { bottom: -3px; }
.cw-rs.se, .cw-rs.sw, .cw-rs.ne, .cw-rs.nw { width: 16px; height: 16px; }
.cw-rs.se { right: -3px; bottom: -3px; cursor: nwse-resize; } .cw-rs.nw { left: -3px; top: -3px; cursor: nwse-resize; }
.cw-rs.sw { left: -3px; bottom: -3px; cursor: nesw-resize; } .cw-rs.ne { right: -3px; top: -3px; cursor: nesw-resize; }
.chat-win.max .cw-rs { display: none; }
.in-link { display: inline-block; margin-top: 12px; font-size: 14px; font-weight: 600; color: var(--crema); }
.chat-win .sources { margin-top: 10px; font-size: 13px; color: var(--muted-2); }
