/* =========================================================================
   Giao diện Fluent Design (Windows 11) — nạp sau style.css để ghi đè.
   Bố cục: khung điều hướng nằm trên nền Mica, nội dung đặt trên lớp "layer"
   bo góc trên-trái như NavigationView của WinUI 3.
   ========================================================================= */
:root {
  --font: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;

  --mica: linear-gradient(160deg, #e8edf5 0%, #f3f3f3 45%, #f4eff3 100%);
  --bg: #f3f3f3;               /* nền cửa sổ (Mica) */
  --layer: #fbfbfb;            /* lớp nội dung */
  --panel: #ffffff;            /* thẻ, hộp thoại */
  --panel-2: #f6f6f6;          /* vùng phụ, chân hộp thoại */
  --subtle: rgba(0, 0, 0, 0.037);   /* nền khi rê chuột */
  --subtle-2: rgba(0, 0, 0, 0.058); /* nền mục đang chọn */
  --line: rgba(0, 0, 0, 0.0803);    /* nét viền thẻ */
  --ctl: rgba(255, 255, 255, 0.7);
  --ctl-hover: rgba(249, 249, 249, 0.5);
  --ctl-stroke: rgba(0, 0, 0, 0.0578);
  --ctl-stroke-bottom: rgba(0, 0, 0, 0.1622);
  --input-bottom: rgba(0, 0, 0, 0.4458);
  --text: #1b1b1b;
  --muted: #5d5d5d;
  --brand: #005fb8;
  --brand-hover: #1a6fc0;
  --brand-ink: #ffffff;
  --brand-soft: #e3eef9;
  --out: #005fb8;
  --out-ink: #ffffff;
  --in: #ffffff;
  --ai: #7a4fb5;
  --ai-soft: #f3eefa;
  --ok: #0f7b0f;   --ok-bg: #dff6dd;
  --warn: #9d5d00; --warn-bg: #fff4ce;
  --bad: #c42b1c;  --bad-bg: #fde7e9;
  --acrylic: rgba(252, 252, 252, 0.85);
  --smoke: rgba(0, 0, 0, 0.3);
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-flyout: 0 8px 16px rgba(0, 0, 0, 0.14);
  --shadow: 0 32px 64px rgba(0, 0, 0, 0.19), 0 2px 21px rgba(0, 0, 0, 0.15);
  --radius: 8px;
  --radius-ctl: 4px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mica: linear-gradient(160deg, #1b1f27 0%, #202020 45%, #231f23 100%);
    --bg: #202020; --layer: #272727; --panel: #2b2b2b; --panel-2: #232323;
    --subtle: rgba(255, 255, 255, 0.06); --subtle-2: rgba(255, 255, 255, 0.0837); --line: rgba(255, 255, 255, 0.0698);
    --ctl: rgba(255, 255, 255, 0.0605); --ctl-hover: rgba(255, 255, 255, 0.0837); --ctl-stroke: rgba(255, 255, 255, 0.0698); --ctl-stroke-bottom: rgba(255, 255, 255, 0.0465); --input-bottom: rgba(255, 255, 255, 0.5442);
    --text: #ffffff; --muted: #c5c5c5;
    --brand: #60cdff; --brand-hover: #5bbfee; --brand-ink: #000000; --brand-soft: #1c3647;
    --out: #0078d4; --out-ink: #ffffff; --in: #2d2d2d;
    --ai: #c3a6f0; --ai-soft: #352c45;
    --ok: #6ccb5f; --ok-bg: #393d1b; --warn: #fce100; --warn-bg: #433519; --bad: #ff99a4; --bad-bg: #442726;
    --acrylic: rgba(44, 44, 44, 0.86); --smoke: rgba(0, 0, 0, 0.45);
    --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.26); --shadow-flyout: 0 8px 16px rgba(0, 0, 0, 0.26); --shadow: 0 32px 64px rgba(0, 0, 0, 0.37), 0 2px 21px rgba(0, 0, 0, 0.37);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --mica: linear-gradient(160deg, #1b1f27 0%, #202020 45%, #231f23 100%);
  --bg: #202020; --layer: #272727; --panel: #2b2b2b; --panel-2: #232323;
  --subtle: rgba(255, 255, 255, 0.06); --subtle-2: rgba(255, 255, 255, 0.0837); --line: rgba(255, 255, 255, 0.0698);
  --ctl: rgba(255, 255, 255, 0.0605); --ctl-hover: rgba(255, 255, 255, 0.0837); --ctl-stroke: rgba(255, 255, 255, 0.0698); --ctl-stroke-bottom: rgba(255, 255, 255, 0.0465); --input-bottom: rgba(255, 255, 255, 0.5442);
  --text: #ffffff; --muted: #c5c5c5;
  --brand: #60cdff; --brand-hover: #5bbfee; --brand-ink: #000000; --brand-soft: #1c3647;
  --out: #0078d4; --out-ink: #ffffff; --in: #2d2d2d;
  --ai: #c3a6f0; --ai-soft: #352c45;
  --ok: #6ccb5f; --ok-bg: #393d1b; --warn: #fce100; --warn-bg: #433519; --bad: #ff99a4; --bad-bg: #442726;
  --acrylic: rgba(44, 44, 44, 0.86); --smoke: rgba(0, 0, 0, 0.45);
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.26); --shadow-flyout: 0 8px 16px rgba(0, 0, 0, 0.26); --shadow: 0 32px 64px rgba(0, 0, 0, 0.37), 0 2px 21px rgba(0, 0, 0, 0.37);
  color-scheme: dark;
}

/* ---------- Nền & chữ ---------- */
body { font-family: var(--font); font-size: 14px; line-height: 20px; background: var(--bg); background-image: var(--mica); background-attachment: fixed; color: var(--text); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; border-radius: var(--radius-ctl); }
::selection { background: var(--brand); color: var(--brand-ink); }
* { scrollbar-width: thin; scrollbar-color: rgba(128, 128, 128, 0.45) transparent; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 16px; }

/* ---------- Nút ---------- */
.btn {
  border-radius: var(--radius-ctl); min-height: 32px; padding: 5px 12px; font-size: 14px; line-height: 20px;
  background: var(--ctl); color: var(--text);
  border: 1px solid var(--ctl-stroke); border-bottom-color: var(--ctl-stroke-bottom);
  transition: background-color 0.08s;
}
.btn:hover { background: var(--ctl-hover); }
.btn:active { background: var(--subtle); color: var(--muted); border-bottom-color: var(--ctl-stroke); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: rgba(255, 255, 255, 0.08); border-bottom-color: rgba(0, 0, 0, 0.4); }
.btn.primary:hover { background: var(--brand-hover); filter: none; }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--subtle); }
.btn.icon { border-radius: var(--radius-ctl); width: 36px; min-height: 36px; font-size: 16px; }
.btn.sm { min-height: 24px; padding: 2px 8px; font-size: 12px; border-radius: var(--radius-ctl); }
a.btn { color: var(--text); } a.btn.primary { color: var(--brand-ink); }

/* ---------- Ô nhập ---------- */
input[type=text], input[type=password], input[type=search], input[type=tel], input[type=date], select, textarea {
  border-radius: var(--radius-ctl); background: var(--ctl); color: var(--text);
  border: 1px solid var(--ctl-stroke); border-bottom: 1px solid var(--input-bottom);
  padding: 5px 11px 6px; min-height: 32px; font-size: 14px;
}
input:hover, select:hover, textarea:hover { background: var(--ctl-hover); }
input:focus, select:focus, textarea:focus { box-shadow: none; background: var(--panel); border-color: var(--ctl-stroke); border-bottom: 2px solid var(--brand); padding-bottom: 5px; outline: none; }
label { font-size: 14px; color: var(--text); margin: 14px 0 6px; }
input[type=checkbox] { accent-color: var(--brand); width: 18px; height: 18px; vertical-align: -4px; margin-right: 6px; }

/* ---------- Khung chính: điều hướng trên Mica, nội dung trên lớp bo góc ---------- */
@media (min-width: 761px) { .shell { grid-template-columns: 76px 1fr; } }
.nav { background: transparent; border-right: none; padding: 8px 4px; gap: 2px; }
.nav .logo { width: 32px; margin: 6px 0 14px; }
.nav a {
  width: 68px; padding: 8px 0 6px; border-radius: var(--radius-ctl); color: var(--text); font-size: 11px; gap: 4px; position: relative;
}
.nav a:hover { background: var(--subtle); }
.nav a.on { background: var(--subtle-2); color: var(--text); font-weight: 600; }
.nav a.on::before { content: ""; position: absolute; left: 0; top: 50%; width: 3px; height: 16px; margin-top: -8px; border-radius: 2px; background: var(--brand); }
.nav a .i { display: grid; place-items: center; height: 22px; font-size: 18px; }
.nav a .i svg { stroke-linecap: round; stroke-linejoin: round; }
.nav a.on .i { color: var(--brand); }
.nav .badge { top: 3px; right: 12px; }
.main { background: var(--layer); border-left: 1px solid var(--line); border-top: 1px solid var(--line); border-top-left-radius: var(--radius); margin-top: 8px; box-shadow: var(--shadow-card); }
.badge { background: var(--brand); color: var(--brand-ink); border-radius: 999px; font-size: 11px; font-weight: 600; padding: 0 6px; min-width: 16px; line-height: 16px; }

/* ---------- Trang ---------- */
.page { padding: 28px 36px; }
.page h2 { font-family: var(--font-display); font-size: 28px; line-height: 36px; font-weight: 600; margin-bottom: 20px; }
.page h3 { font-size: 20px; line-height: 28px; font-weight: 600; margin: 28px 0 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: none; }
.list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.list-item { border-bottom: 1px solid var(--line); padding: 10px 14px; }
.list-item:hover { background: var(--subtle); }
.pill { border-radius: 999px; background: var(--subtle); border: 1px solid transparent; color: var(--muted); padding: 0 8px; font-size: 12px; line-height: 20px; }
.pill.ai { background: var(--ai-soft); color: var(--ai); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.dot.online { background: var(--ok); } .dot.offline { background: var(--warn); } .dot.error { background: var(--bad); }
.av { background: var(--brand-soft); color: var(--brand); }

/* ---------- Đăng nhập ---------- */
.login form { border-radius: var(--radius); border: 1px solid var(--line); background: var(--acrylic); backdrop-filter: blur(30px) saturate(125%); -webkit-backdrop-filter: blur(30px) saturate(125%); box-shadow: var(--shadow); padding: 32px; }
.login h1 { font-family: var(--font-display); font-weight: 600; font-size: 24px; }
.login .btn { min-height: 36px; }

/* ---------- Hộp thư ---------- */
.inbox { background: transparent; }
.convs { background: transparent; border-right: 1px solid var(--line); }
.convs-head { border-bottom: none; padding: 14px 12px 8px; }
.convs-list { padding: 0 6px 8px; }
.conv { border-bottom: none; border-radius: var(--radius-ctl); margin: 1px 0; padding: 9px 10px; position: relative; }
.conv:hover { background: var(--subtle); }
.conv.on { background: var(--subtle-2); }
.conv.on::before { content: ""; position: absolute; left: 0; top: 50%; width: 3px; height: 16px; margin-top: -8px; border-radius: 2px; background: var(--brand); }
.conv .name { font-weight: 400; }
.conv.unread .name { font-weight: 600; }
.conv .last { font-size: 13px; }
.chat { background: transparent; }
.chat-head { background: transparent; border-bottom: 1px solid var(--line); min-height: 56px; }
.chat-head .title b { font-weight: 600; font-size: 15px; }
.msgs { padding: 16px 20px 8px; gap: 3px; }
.day { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; }
.bubble { border-radius: 8px; border: 1px solid var(--line); background: var(--in); box-shadow: var(--shadow-card); padding: 7px 12px; }
.m.in .bubble { border-bottom-left-radius: 2px; }
.m.out .bubble { background: var(--out); color: var(--out-ink); border-color: transparent; border-bottom-right-radius: 2px; }
.m.out .bubble a { color: inherit; text-decoration: underline; }
.m.out .bubble .t { color: currentColor; opacity: 0.75; }
.m.out.by-ai .bubble { background: var(--ai-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--ai) 35%, transparent); }
.m.out.by-ai .bubble .t { color: var(--muted); opacity: 1; }
.m .who { font-size: 12px; }
.media-img, .media-video { border-radius: 8px; border: 1px solid var(--line); }

/* Khung AI gợi ý: kiểu thẻ Copilot với viền chuyển màu */
.suggest {
  border: 1px solid transparent; border-radius: var(--radius); padding: 12px 14px;
  background: linear-gradient(var(--panel), var(--panel)) padding-box, linear-gradient(120deg, #2d7ff9, #a35cf2 55%, #f25c9a) border-box;
  box-shadow: var(--shadow-card);
}
.suggest .head { color: var(--ai); font-weight: 600; font-size: 12px; }
/* Thanh thông báo kiểu InfoBar */
.banner { border-radius: var(--radius-ctl); background: var(--warn-bg); color: var(--text); border: 1px solid var(--line); font-size: 13px; }

.composer { background: transparent; border-top: 1px solid var(--line); padding: 10px 12px; }
.composer textarea { border-radius: var(--radius-ctl); min-height: 36px; padding: 7px 12px; }
.composer .btn.icon.primary { border-radius: var(--radius-ctl); }
.att { border-radius: var(--radius-ctl); border: 1px solid var(--line); background: var(--panel-2); }
.drop { border-radius: var(--radius); border: 2px dashed var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); }

.info { background: transparent; border-left: 1px solid var(--line); padding: 16px 18px; }
.info h4 { font-size: 14px; font-weight: 600; margin: 20px 0 8px; }
.seg { background: var(--subtle); border: 1px solid var(--line); border-radius: var(--radius-ctl); padding: 3px; gap: 2px; }
.seg button { border-radius: 3px; font-size: 13px; color: var(--muted); position: relative; padding: 5px 2px; }
.seg button:hover { background: var(--subtle); color: var(--text); }
.seg button.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); }
.seg button.on::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 16px; height: 3px; margin-left: -8px; border-radius: 2px; background: var(--brand); }

/* ---------- Hộp thoại kiểu ContentDialog ---------- */
.overlay { background: var(--smoke); }
.modal { border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); padding: 24px 24px 0; }
.modal h3 { font-family: var(--font-display); font-size: 20px; line-height: 28px; font-weight: 600; margin-bottom: 12px; }
.modal .actions { margin: 24px -24px 0; padding: 20px 24px 24px; background: var(--panel-2); border-top: 1px solid var(--line); position: sticky; bottom: 0; }
.modal .actions .btn { min-width: 96px; }
.qr { border-radius: var(--radius); border: 1px solid var(--line); }

/* ---------- Thông báo kiểu Windows (góc dưới phải) ---------- */
#toasts { left: auto; right: 16px; bottom: 16px; transform: none; align-items: flex-end; }
.toast {
  background: var(--acrylic); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(30px) saturate(125%); -webkit-backdrop-filter: blur(30px) saturate(125%);
  box-shadow: var(--shadow-flyout); padding: 12px 16px; max-width: 360px; animation: toastIn 0.25s cubic-bezier(0, 0, 0, 1);
}
.toast::before { content: "ℹ"; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: 700; margin-right: 10px; vertical-align: -2px; }
.toast.error::before { content: "!"; background: var(--bad); color: #fff; }
.toast.error { background: var(--acrylic); color: var(--text); }
@keyframes toastIn { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ---------- Sản phẩm, bài đăng ---------- */
.pcard { border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); transition: box-shadow 0.15s, transform 0.15s; }
.pcard:hover { box-shadow: var(--shadow-flyout); transform: translateY(-1px); }
.pcard .pp { color: var(--text); font-weight: 600; font-size: 15px; }
.chip { border-radius: 999px; background: var(--subtle); border: 1px solid var(--line); }
.att.pick.on { border: 2px solid var(--brand); }
code.copy { border-radius: var(--radius-ctl); background: var(--subtle); border: 1px solid var(--line); }

/* ---------- Lịch phòng ---------- */
.cal-wrap { border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
table.cal { border-collapse: separate; border-spacing: 2px; }
table.cal th { font-weight: 400; }
table.cal th.we { color: var(--bad); }
table.cal th.today { background: var(--brand-soft); color: var(--brand); border-radius: var(--radius-ctl); font-weight: 600; }
table.cal th.rn { background: var(--panel); border-right: 1px solid var(--line); font-weight: 400; }
table.cal td { border: none; border-radius: 3px; height: 40px; }
.cell.free { background: var(--ok-bg); }
.cell.free:hover { outline: 2px solid var(--ok); outline-offset: -2px; }
.cell.ical { background: var(--bad-bg); box-shadow: inset 0 -3px 0 var(--bad); }
.cell.manual { background: repeating-linear-gradient(45deg, var(--warn-bg), var(--warn-bg) 4px, transparent 4px, transparent 8px); box-shadow: inset 0 -3px 0 var(--warn); }
.legend .cell { border-radius: 3px; }

/* ---------- Điện thoại ---------- */
@media (max-width: 760px) {
  .main { margin-top: 0; border-radius: 0; border: none; box-shadow: none; }
  .nav { background: var(--acrylic); backdrop-filter: blur(30px) saturate(125%); -webkit-backdrop-filter: blur(30px) saturate(125%); border-top: 1px solid var(--line); padding: 4px 2px; padding-bottom: max(4px, env(safe-area-inset-bottom)); }
  .shell { grid-template-columns: 1fr; }
  .nav a { width: auto; flex: 1; min-width: 0; font-size: 10px; padding: 6px 0 4px; white-space: nowrap; }
  .nav a .t { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .nav a.on::before { left: 50%; top: auto; bottom: 1px; width: 16px; height: 3px; margin: 0 0 0 -8px; }
  .page { padding: 18px 16px; }
  .page h2 { font-size: 24px; line-height: 32px; }
  #toasts { right: 12px; left: 12px; bottom: 76px; align-items: stretch; }
  .toast { max-width: none; }
  .modal { padding: 20px 20px 0; }
  .modal .actions { margin: 20px -20px 0; padding: 16px 20px 20px; }
}

/* v5: KiotViet trong hồ sơ khách, ô chọn */
.kvbox { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: var(--radius-ctl); border: 1px solid var(--line); margin-bottom: 6px; }
.kvbox.ok { background: var(--ok-bg); }
.kvbox.bad { background: var(--bad-bg); }
.check-row { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 0; }
.check-row input { margin-top: 1px; }

/* Gửi nhanh sản phẩm (gõ "/" trong ô chat) */
.composer { position: relative; }
.qp { position: absolute; left: 12px; right: 12px; bottom: calc(100% - 4px); z-index: 30; max-height: 340px; overflow-y: auto;
  background: var(--panel, #fff); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 4px; }
.qp.hidden { display: none; }
.qp-head { font-size: 12px; color: var(--muted, #666); padding: 6px 8px; }
.qp-item { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 6px; cursor: pointer; min-width: 0; }
.qp-item:hover, .qp-item.on { background: var(--hover, rgba(0,0,0,.05)); }
.qp-item.on { box-shadow: inset 3px 0 0 var(--accent, #0067c0); }
.qp-item img, .qp-noimg { width: 40px; height: 40px; flex: none; border-radius: 6px; object-fit: cover; background: var(--line); display: grid; place-items: center; }
.qp-item .grow { min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Lịch sử mua hàng KiotViet */
.hist { display: flex; flex-direction: column; gap: 6px; }
.hist-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 4px; }
.hist-sum > div { border: 1px solid var(--line); border-radius: 6px; padding: 6px; text-align: center; min-width: 0; }
.hist-sum b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-sum span { font-size: 11px; color: var(--muted, #666); }
.hist-item { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.hist-item.off { opacity: .6; }
.hist-item summary { display: flex; gap: 8px; align-items: center; cursor: pointer; list-style: none; }
.hist-item summary::-webkit-details-marker { display: none; }
.hist-item[open] summary { margin-bottom: 6px; }
.hist-item .row { gap: 8px; padding: 2px 0; }

/* Vận đơn SuperAI */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h2 { margin-bottom: 0; }
.ship { border: 1px solid var(--line); border-radius: 6px; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.card > .ship { border: 0; padding: 0; }
.ship .sel { user-select: all; }
.ship-act { gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.ship-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
@media (max-width: 600px) { .page-head input[type=search] { width: 100% !important; } }

/* Phản hồi nội bộ cho tin nhắn AI */
.m .fb-bar { display: flex; gap: 2px; margin-top: 2px; opacity: 0; transition: opacity .15s; justify-content: flex-end; }
.m:hover .fb-bar, .m .fb-bar:focus-within { opacity: 1; }
@media (hover: none) { .m .fb-bar { opacity: .75; } }
.fb-bar button { border: 0; background: transparent; cursor: pointer; font-size: 12px; padding: 2px 6px; border-radius: 4px; color: var(--muted); }
.fb-bar button:hover { background: var(--hover, rgba(0,0,0,.06)); }
.fb-note { position: relative; max-width: 420px; margin: 4px 0 0 auto; font-size: 12px; background: var(--warn-bg, #fff4ce); border: 1px dashed var(--line); border-radius: 6px; padding: 5px 22px 5px 8px; }
.fb-lesson { color: var(--muted); margin-top: 2px; }
.fb-x { position: absolute; top: 2px; right: 4px; border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 11px; }
.fb-quote { background: var(--panel-2, #f6f6f6); border-left: 3px solid var(--line); padding: 6px 10px; margin: 8px 0; font-size: 13px; white-space: pre-wrap; max-height: 160px; overflow: auto; }
.sq-text { white-space: pre-wrap; font-family: inherit; margin: 0; }

/* Đào tạo AI */
.train-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .train-grid { grid-template-columns: 1fr; } }
.train-chat { display: flex; flex-direction: column; gap: 8px; }
.train-msgs { height: min(60vh, 560px); overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 6px 2px; }
.train-msgs .m { display: flex; flex-direction: column; max-width: 85%; }
.train-msgs .m.out { align-self: flex-end; }
.train-msgs .m.in { align-self: flex-start; }
.train-msgs .bubble { white-space: pre-wrap; }
.train-hint { line-height: 1.7; padding: 8px; }
.train-input { display: flex; gap: 6px; align-items: flex-end; }
.train-input textarea { flex: 1; min-width: 0; resize: vertical; }
.k-item { border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin-bottom: 6px; }
.k-item.off { opacity: .55; }
.k-item .k-text { white-space: pre-wrap; cursor: pointer; margin-bottom: 4px; }
.train-know #kList { max-height: min(62vh, 600px); overflow-y: auto; }
.banner.bad { background: var(--bad-bg); border-color: var(--bad); }

/* Khung "Thông tin khách" trên điện thoại / máy tính bảng: phủ toàn màn hình, nền đặc (không nhìn xuyên khung chat) */
@media (max-width: 900px) {
  .inbox.with-info .info {
    position: fixed; inset: 0; z-index: 45; border: none;
    background: var(--bg);
    padding: 0 16px max(24px, calc(env(safe-area-inset-bottom) + 16px));
    overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  }
  .inbox.with-info .info .info-head {
    position: sticky; top: 0; z-index: 2; margin: 0 -16px; padding: max(10px, env(safe-area-inset-top)) 16px 10px;
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .inbox.with-info .info .info-head b { font-size: 17px; }
  .inbox.with-info .info .seg button { min-width: 0; white-space: nowrap; }
}

/* Cài đặt: mỗi mục thu gọn, bấm tiêu đề để mở */
details.set-sec { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin: 10px 0; overflow: hidden; }
details.set-sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-size: 16px; font-weight: 600; line-height: 22px; user-select: none; }
details.set-sec > summary::-webkit-details-marker { display: none; }
details.set-sec > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; flex: none; }
details.set-sec[open] > summary::after { transform: rotate(-135deg); }
details.set-sec > summary:hover { background: var(--subtle); }
details.set-sec[open] > summary { border-bottom: 1px solid var(--line); }
details.set-sec > .card { border: 0; border-radius: 0; box-shadow: none; margin: 0; }
details.set-sec > .list, details.set-sec > .toolbar { margin: 12px 16px; }
@media (prefers-reduced-motion: reduce) { details.set-sec > summary::after { transition: none; } }
/* Ô tích + chữ dài: chữ chảy liền một khối, không bị tách cột */
.check-row { display: block; position: relative; padding-left: 26px; }
.check-row > input[type=checkbox], .check-row > input[type=radio] { position: absolute; left: 0; top: 1px; margin: 0; }
.row > .check-row { margin-top: 0; }

/* Thẻ con trong mục Dịch vụ vận chuyển */
.ship-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 12px 16px 0; border-top: 1px solid var(--line); }
.ship-tabs button { border: 1px solid var(--line); background: var(--panel-2); border-radius: var(--radius-ctl) var(--radius-ctl) 0 0; padding: 8px 6px; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.ship-tabs button span { font-weight: 400; font-size: 12px; }
.ship-tabs button.on { background: var(--panel); color: var(--text); border-bottom-color: var(--panel); box-shadow: inset 0 3px 0 var(--brand); }
details.set-sec > .ship-pane { border-top: 1px solid var(--line); margin-top: -1px; }
@media (max-width: 600px) { .ship-tabs { padding: 10px 10px 0; gap: 4px; } .ship-tabs button { font-size: 12px; padding: 6px 2px; } }
.login-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 12px 0 2px; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login form .btn { width: 100%; margin-top: 10px; }
