:root {
  --brand: #0068FF;
  --brand-600: #0055d4;
  --brand-50: #EAF2FF;
  --green: #00A85A;
  --amber: #F59E0B;
  --red: #E5484D;
  --bg: #F3F5F9;
  --surface: #FFFFFF;
  --text: #121826;
  --muted: #667085;
  --line: #E4E7EC;
  --mc-bubble: #0068FF;
  --mc-text: #FFFFFF;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
.app { height: 100dvh; max-width: 560px; margin: 0 auto; background: var(--bg); position: relative; overflow: hidden; }
@media (min-width: 600px) { .app { box-shadow: 0 0 0 1px var(--line); } }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; color: #344054; }
.error { color: var(--red); font-size: 13px; min-height: 18px; margin: 6px 0 0; }
input[type=tel], textarea.fb {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 16px; outline: none;
}
input[type=tel]:focus, textarea.fb:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }

.btn { border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform .05s, background .15s, opacity .15s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-600); }
.btn-secondary { background: var(--brand-50); color: var(--brand); }
.btn-ghost { background: #fff; color: #344054; box-shadow: inset 0 0 0 1px var(--line); }
.btn-block { width: 100%; margin-top: 14px; padding: 13px; font-size: 16px; }

/* ---------- Login ---------- */
.login { height: 100%; display: grid; place-items: center; padding: 20px 16px; background: linear-gradient(180deg, #0068FF 0, #0068FF 38%, var(--bg) 38%); }
.login-card { width: 100%; background: #fff; border-radius: 20px; padding: 24px 20px; box-shadow: 0 12px 32px rgba(0,40,120,.15); }
.login-card h1 { font-size: 22px; margin: 14px 0 6px; }
.brand-badge { width: 56px; height: 56px; border-radius: 16px; background: var(--brand); display: grid; place-items: center; }
.hint { font-size: 12.5px; color: var(--muted); background: #F9FAFB; border-radius: 10px; padding: 10px 12px; margin: 16px 0 0; }

/* ---------- Chat layout ---------- */
.chat { height: 100%; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px; background: #fff; border-bottom: 1px solid var(--line); }
.call-short { display: none; }
.bot-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; display: grid; place-items: center; }
.bot-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-status { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.btn-call { background: #FFF4E5; color: #B54708; padding: 8px 12px; border-radius: 999px; font-size: 13.5px; flex: none; }
.btn-call:hover { background: #FFE8C7; }

.progress { width: 100%; background: #fff; padding: 8px 14px 8px; border-bottom: 1px solid var(--line); }
.progress-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.progress-text { flex: 1; min-width: 0; border: 0; background: none; padding: 0; display: flex; justify-content: space-between; font-size: 13px; color: #344054; font-weight: 600; gap: 8px; text-align: left; }
.btn-first { flex: none; border: 1px solid #C7D7FE; background: var(--brand-50); color: var(--brand); font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.btn-first:active { transform: scale(.97); }
.step-dots { display: flex; gap: 6px; margin-top: 7px; overflow-x: auto; scrollbar-width: none; }
.step-dots::-webkit-scrollbar { display: none; }
.step-dot { flex: none; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.step-dot.done { background: #E7F8EF; border-color: #A6E4C3; color: var(--green); }
.step-dot.stuck { background: #FEF0C7; border-color: #FEDF89; color: #B54708; }
.step-dot.current { background: var(--brand); border-color: var(--brand); color: #fff; }
.progress-text span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { color: var(--muted); }
.progress-track { height: 6px; border-radius: 99px; background: #EEF1F6; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), #33A1FF); border-radius: 99px; transition: width .4s ease; }
.ticket-banner { background: #FFF8EB; color: #93370D; font-size: 13px; padding: 8px 14px; border-bottom: 1px solid #FCE7C2; }
.ticket-banner:not([hidden]) + .callback-bar { background: #FFFCF5; }
.callback-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: #fff; padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 13px; color: #344054; }
.cb-info { min-width: 0; display: grid; gap: 2px; }
.cb-row { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.cb-row b { color: var(--text); }
.cb-ico { flex: none; }
.cb-actions { display: flex; gap: 6px; flex: none; }
.cb-btn { border: 1px solid var(--line); background: #fff; color: var(--brand); font-size: 12.5px; font-weight: 600; padding: 5px 10px; border-radius: 99px; white-space: nowrap; }
.cb-btn:hover { background: var(--brand-50); }
.slot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.slot { border: 1px solid #C7D7FE; background: #fff; color: #344054; padding: 9px 10px; border-radius: 12px; font-size: 13px; text-align: left; }
.slot.selected { background: var(--brand); border-color: var(--brand); color: #fff; }
.slot:first-child { grid-column: 1 / -1; }
/* thẻ thông tin thiết bị */
.device-card { align-self: stretch; background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 4px; }
.device-card .dc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.device-card .dc-title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.device-card .dc-ico { width: 30px; height: 30px; border-radius: 9px; background: var(--brand-50); display: grid; place-items: center; font-size: 16px; }
.device-card dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; font-size: 13.5px; }
.device-card dt { color: var(--muted); }
.device-card dd { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.device-card .dc-val { font-weight: 600; overflow-wrap: anywhere; }
.device-card .dc-empty { color: var(--muted); font-weight: 400; }
.device-card .dc-link { border: 0; background: none; color: var(--brand); font-size: 13px; font-weight: 600; padding: 0; }
.device-card .dc-edit { display: flex; gap: 6px; width: 100%; }
.device-card .dc-edit input { flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; outline: none; }
.device-card .dc-edit input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.device-card .dc-edit .btn { padding: 6px 12px; font-size: 13px; }
.st-pill { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: #F2F4F7; color: #475467; }
.st-pill.blue { background: var(--brand-50); color: var(--brand); }
.st-pill.green { background: #E7F8EF; color: var(--green); }
.st-pill.amber { background: #FEF0C7; color: #B54708; }
.device-card .dc-hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

.messages { flex: 1; overflow-y: auto; padding: 14px 12px 8px; display: flex; flex-direction: column; gap: 8px; scroll-behavior: smooth; overscroll-behavior: contain; }
.row { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.row.bot .mini-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; flex: none; }
.row.bot .mini-avatar.ghost { visibility: hidden; }
.row.mc { justify-content: flex-end; }
.bubble { max-width: min(82%, 420px); padding: 10px 13px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); word-wrap: break-word; overflow-wrap: anywhere; }
.row.bot .bubble { border-bottom-left-radius: 6px; }
.row.mc .bubble { background: var(--mc-bubble); color: var(--mc-text); border-bottom-right-radius: 6px; box-shadow: none; }
.event-pill { font-size: 13px; background: var(--brand-50); color: var(--brand); padding: 6px 12px; border-radius: 99px; font-weight: 600; max-width: 85%; }
.bubble p { margin: 0; }
.bubble a { color: inherit; }
.bubble b { font-weight: 700; }
.day-sep { align-self: center; font-size: 12px; color: var(--muted); padding: 4px 10px; margin: 6px 0; }

/* step card */
.card { width: min(86%, 440px); min-width: 0; background: #fff; border-radius: var(--radius); border-bottom-left-radius: 6px; box-shadow: var(--shadow); overflow: hidden; }
.card-intro { padding: 10px 13px 0; color: #344054; }
.card-body { padding: 12px 13px 13px; }
.eyebrow { font-size: 11.5px; letter-spacing: .06em; font-weight: 700; color: var(--brand); text-transform: uppercase; }
.card h3 { margin: 4px 0 6px; font-size: 16.5px; line-height: 1.3; }
.card .desc { color: #344054; }

.media { margin-top: 10px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
.media > * { min-width: 0; max-width: 100%; }
.media img { width: 100%; max-height: 240px; object-fit: contain; border-radius: 12px; display: block; background: #F2F4F7; cursor: zoom-in; }
.media video, .media iframe { width: 100%; aspect-ratio: 16/9; border-radius: 12px; border: 0; background: #000; display: block; }
.file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #F9FAFB; text-decoration: none; color: inherit; box-shadow: inset 0 0 0 1px var(--line); }
.file .ico { width: 34px; height: 34px; border-radius: 9px; background: #FEE4E2; color: #B42318; font-size: 11px; font-weight: 800; display: grid; place-items: center; flex: none; }
.file .ico.link { background: var(--brand-50); color: var(--brand); }
.file .meta { min-width: 0; flex: 1; display: grid; }
.file .name { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .sub { display: block; font-size: 12px; color: var(--muted); }
.file .open { font-size: 13px; color: var(--brand); font-weight: 600; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions .btn { flex: 1 1 auto; padding: 10px 12px; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { border: 1px solid #C7D7FE; background: #fff; color: var(--brand); padding: 7px 12px; border-radius: 99px; font-size: 13.5px; font-weight: 500; text-align: left; }
.chip:hover:not(:disabled) { background: var(--brand-50); }
.chip.selected { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip:disabled, .actions .btn:disabled { opacity: .45; }
.chip.esc { border-color: #FEDF89; color: #B54708; }

.fb-row { display: flex; gap: 4px; margin-top: 6px; }
.fb-btn { border: 0; background: transparent; font-size: 14px; padding: 2px 6px; border-radius: 8px; color: var(--muted); }
.fb-btn:hover { background: #F2F4F7; }
.fb-btn.on { background: var(--brand-50); }
.fb-thanks { font-size: 12px; color: var(--muted); padding: 2px 6px; }

.checklist-msg ol { margin: 8px 0 0; padding-left: 20px; }
.checklist-msg li { margin: 3px 0; }
.st-done { color: var(--green); }
.st-stuck { color: var(--amber); }

.esc-card { background: #FFFAEB; box-shadow: inset 0 0 0 1px #FEDF89; }
.esc-card .t { font-weight: 700; color: #93370D; margin-bottom: 2px; }

.rating .stars { display: flex; gap: 6px; margin: 10px 0 6px; }
.star { border: 0; background: none; font-size: 30px; line-height: 1; color: #D0D5DD; padding: 0 2px; }
.star.on { color: #FDB022; }
.rating textarea { width: 100%; min-height: 64px; resize: vertical; margin-top: 6px; }

.typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: #98A2B3; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* composer */
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 8px 10px calc(8px + var(--safe-b)); background: #fff; border-top: 1px solid var(--line); }
.composer textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 22px; padding: 10px 14px; max-height: 120px; outline: none; background: #F9FAFB; font-size: 16px; line-height: 1.35; }
.composer textarea:focus { border-color: var(--brand); background: #fff; }
.send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.send:disabled { background: #D0D5DD; }

/* sheets & popup */
.sheet { position: absolute; inset: 0; z-index: 20; display: flex; align-items: flex-end; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(16,24,40,.45); animation: fade .15s; }
.sheet-panel { position: relative; width: 100%; background: #fff; border-radius: 20px 20px 0 0; padding: 8px 16px calc(18px + var(--safe-b)); max-height: 85%; overflow: auto; animation: up .2s ease; }
.sheet-panel h2 { font-size: 18px; margin: 6px 0 4px; }
.sheet-handle { width: 40px; height: 4px; border-radius: 99px; background: #D0D5DD; margin: 4px auto 8px; }
.checklist { list-style: none; padding: 0; margin: 10px 0 0; }
.checklist li { display: flex; gap: 12px; align-items: center; padding: 11px 4px; border-bottom: 1px solid #F2F4F7; }
.checklist .n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: #F2F4F7; color: var(--muted); flex: none; }
.checklist li.done .n { background: #D1FADF; color: #027A48; }
.checklist li.doing .n { background: var(--brand); color: #fff; }
.checklist li.stuck .n { background: #FEF0C7; color: #B54708; }
.checklist .tag { margin-left: auto; font-size: 12px; color: var(--muted); }
.popup { position: absolute; inset: 0; z-index: 30; background: rgba(16,24,40,.5); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.popup-card { width: 100%; max-width: 360px; background: #fff; border-radius: 20px; padding: 22px 20px; text-align: center; }
.popup-icon { font-size: 40px; }
.popup-card h3 { margin: 8px 0 6px; }
.popup-card p#popup-text { font-size: 16px; font-weight: 600; color: var(--text); margin: 0 0 8px; }
.lightbox { position: absolute; inset: 0; z-index: 40; background: rgba(0,0,0,.92); display: grid; place-items: center; }
.lightbox img { max-width: 100%; max-height: 100%; }
.lb-close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.cite { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 12px; font-style: italic; color: var(--muted); }

/* ---------- Điện thoại nhỏ (≤ 420px) ---------- */
@media (max-width: 420px) {
  body { font-size: 15px; }
  .topbar { padding-left: 10px; padding-right: 10px; }
  .avatar { width: 32px; height: 32px; }
  .bot-name { font-size: 14.5px; }
  .call-long { display: none; }
  .call-short { display: inline; }
  .btn-call { padding: 8px 11px; }
  .progress { padding: 7px 12px 9px; }
  .ticket-banner { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 7px 12px; }
  .messages { padding: 12px 10px 8px; gap: 7px; }
  /* bỏ avatar nhỏ cạnh tin nhắn để tin nhắn rộng hơn */
  .row.bot .mini-avatar { display: none; }
  .row.bot .bubble { max-width: 92%; }
  .row.mc .bubble, .event-pill { max-width: 85%; }
  .card { width: 100%; max-width: 100%; }
  .card-body { padding: 12px; }
  .card h3 { font-size: 16px; }
  .media img { max-height: 180px; }
  .file { padding: 10px; }
  /* vùng chạm ≥ 40px */
  .chip { padding: 9px 13px; font-size: 14px; }
  .actions .btn { padding: 12px 10px; font-size: 14.5px; }
  .actions { flex-direction: column; }
  .actions .btn { width: 100%; }
  .fb-btn { padding: 6px 10px; font-size: 16px; }
  .composer { padding: 8px 8px calc(8px + var(--safe-b)); }
  .send { width: 44px; height: 44px; }
  .sheet-panel { padding: 8px 14px calc(16px + var(--safe-b)); }
  .chips .chip { flex: 1 1 auto; text-align: center; }
  .rating .stars { justify-content: space-between; }
  .star { font-size: 34px; }
  .login-card { padding: 22px 16px; border-radius: 18px; }
  .login-card h1 { font-size: 20px; }
  .callback-bar { padding: 6px 12px; gap: 8px; flex-wrap: nowrap; font-size: 12.5px; }
  .cb-info { flex: 1; }
  .cb-row span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cb-actions { flex-direction: column; gap: 4px; }
  .cb-btn { padding: 4px 9px; font-size: 12px; }
  .btn-first { font-size: 11.5px; padding: 4px 8px; }
}
@media (max-width: 340px) {
  .bot-status { display: none; }
  .bot-name { font-size: 14px; }
}
/* màn hình thấp (bàn phím bật) — thu gọn thanh tiến độ */
@media (max-height: 520px) {
  .progress-track, .step-dots, .callback-bar { display: none; }
  .progress { padding-top: 5px; padding-bottom: 5px; }
}

/* ---------- Thanh thông tin (thiết bị · trạng thái · SĐT) + các bước ---------- */
.infobar { background: #fff; border-bottom: 1px solid var(--line); padding: 8px 14px 8px; display: grid; gap: 7px; }
.ib-row { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.ib-device { flex: none; display: inline-flex; align-items: center; gap: 4px; border: 0; background: var(--brand-50); color: var(--brand); font-weight: 700; font-size: 13px; padding: 4px 9px; border-radius: 99px; }
.ib-status { flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: left; font-size: 13px; font-weight: 600; color: #344054; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-status.ok { color: var(--green); }
.ib-phone { flex: none; display: inline-flex; align-items: center; gap: 4px; color: #344054; white-space: nowrap; }
.ib-phone b { font-weight: 700; color: var(--text); }
.ib-pen { border: 0; background: none; padding: 2px 3px; font-size: 13px; line-height: 1; border-radius: 6px; }
.ib-pen:hover { background: var(--brand-50); }
.ib-steps { justify-content: space-between; }
.ib-steps .step-dots { margin: 0; flex: 1; min-width: 0; }
.step-dot { min-width: 30px; }
.ticket-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ticket-banner[hidden] { display: none !important; }
.tb-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-btn { flex: none; border: 1px solid #F7C77E; background: #fff; color: #B54708; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.tb-btn:hover { background: #FFF4E5; }
.dev-list { margin: 4px 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; font-size: 14px; align-items: center; }
.dev-list dt { color: var(--muted); }
.dev-list dd { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.link-btn { border: 0; background: none; color: var(--brand); font-weight: 600; padding: 0; font-size: 13.5px; }
#dev-name { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 16px; outline: none; }
#dev-name:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
@media (max-width: 420px) {
  .infobar { padding: 7px 12px; }
  .ib-row { font-size: 12.5px; gap: 6px; }
  .ib-device, .ib-status { font-size: 12.5px; }
  .ticket-banner { white-space: normal; padding: 6px 12px; }
  .tb-btn { font-size: 12px; padding: 4px 9px; }
}
@media (max-width: 360px) { .ib-phone > span[aria-hidden] { display: none; } }
@media (max-height: 520px) { .ib-steps { display: none; } }

/* gọn hàng các bước để đủ 7 bước + nút trên màn 360–390px */
.ib-steps { gap: 6px; }
.ib-steps .step-dots { gap: 4px; }
.ib-steps .step-dot { min-width: 0; height: 22px; padding: 0 6px; font-size: 11px; letter-spacing: -.2px; }
.ib-steps .btn-first { font-size: 11.5px; padding: 4px 8px; }
.tb-text { white-space: normal; overflow: visible; line-height: 1.35; }

@media (max-width: 420px) {
  .ib-steps .step-dot { padding: 0 5px; font-size: 10.5px; }
  .ib-steps .step-dots { gap: 3px; }
  .tb-text { font-size: 12px; }
  .tb-btn { font-size: 11.5px; padding: 3px 8px; }
}

/* ================= Màn đăng nhập — mobile-first ================= */
.login { position: absolute; inset: 0; z-index: 5; display: block; padding: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: radial-gradient(120% 60% at 50% 0%, #E3EEFF 0%, #F3F7FF 55%, #FFFFFF 100%); }
.lg-wrap { min-height: 100%; display: flex; flex-direction: column; gap: 14px;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(20px + var(--safe-b)); max-width: 480px; margin: 0 auto; }
.lg-brand { display: flex; justify-content: center; padding-top: 4px; }
.lg-logo { width: clamp(108px, 30vw, 140px); height: auto; display: block; }
.lg-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.lg-toro { width: clamp(132px, 44vw, 200px); height: auto; aspect-ratio: 560 / 553; object-fit: contain; display: block;
  filter: drop-shadow(0 10px 18px rgba(0, 51, 201, .14)); animation: lg-float 3.6s ease-in-out infinite; }
@keyframes lg-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.lg-intro { display: grid; justify-items: center; gap: 6px; }
.lg-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; color: #0033C9;
  background: #E3EBFF; padding: 4px 10px; border-radius: 99px; }
.lg-intro h1 { margin: 0; font-size: clamp(20px, 5.6vw, 24px); line-height: 1.28; font-weight: 800; color: #0B1B4D;
  text-wrap: balance; overflow-wrap: anywhere; max-width: 22ch; }
.lg-sub { margin: 0; font-size: 14.5px; color: var(--muted); max-width: 34ch; }
.lg-card { background: #fff; border-radius: 20px; padding: 18px 16px 16px; box-shadow: 0 10px 30px rgba(0, 40, 140, .10), 0 1px 2px rgba(16, 24, 40, .06); }
.lg-label { display: block; font-size: 14px; font-weight: 700; color: #344054; margin-bottom: 8px; }
.lg-input { display: flex; align-items: center; gap: 8px; height: 54px; padding: 0 14px; border: 1.5px solid #D0D5DD; border-radius: 14px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.lg-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }
.lg-prefix { color: #98A2B3; display: grid; place-items: center; flex: none; }
.lg-input input[type=tel] { flex: 1; min-width: 0; height: 100%; border: 0; padding: 0; box-shadow: none; outline: none; background: transparent;
  font-size: 18px; font-weight: 600; letter-spacing: .3px; }
.lg-input input[type=tel]:focus { box-shadow: none; }
.lg-btn { height: 54px; margin-top: 10px; font-size: 17px; border-radius: 14px; background: linear-gradient(90deg, #0033C9, #0068FF); box-shadow: 0 6px 16px rgba(0, 68, 230, .25); }
.lg-btn:active:not(:disabled) { transform: scale(.985); }
.lg-warn { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: #FFF8EB; color: #7A2E0E; font-size: 13px; line-height: 1.45; }
.lg-warn p { margin: 0; }
/* màn thấp (iPhone SE, bàn phím mở, xoay ngang): thu nhỏ linh vật */
@media (max-height: 700px) { .lg-toro { width: clamp(104px, 30vw, 150px); } .lg-sub { display: none; } .lg-wrap { gap: 10px; } }
@media (max-height: 560px) {
  .lg-hero { flex-direction: row; text-align: left; gap: 12px; }
  .lg-intro { justify-items: start; }
  .lg-toro { width: 84px; animation: none; }
  .lg-intro h1 { font-size: 18px; max-width: none; }
}
@media (max-width: 340px) { .lg-wrap { padding-left: 12px; padding-right: 12px; } .lg-card { padding: 16px 12px 14px; } }
/* tablet / desktop: mở rộng thành 2 cột, giữ nguyên trải nghiệm mobile */
@media (min-width: 860px) and (min-height: 600px) {
  .app:has(#login:not([hidden])) { max-width: none; box-shadow: none; }
  .lg-wrap { max-width: 980px; display: grid; grid-template-columns: 1.1fr 1fr; grid-template-rows: auto auto; column-gap: 48px; row-gap: 28px; align-content: center; padding: 32px; }
  .lg-brand { grid-column: 1 / -1; justify-content: flex-start; }
  .lg-logo { width: 150px; }
  .lg-hero { align-self: center; }
  .lg-toro { width: 260px; }
  .lg-card { align-self: center; padding: 28px 24px 22px; }
}
@media (prefers-reduced-motion: reduce) { .lg-toro { animation: none; } }
