/* Web app QRlapdat.com (D135): sáng, đen trắng, xanh ở chỗ chính, giống tab Chia sẻ của plugin. Viết cho điện thoại. */
/* Chủ đề 20: màu và font Inter theo bảng thiết kế "qrlapdat giao diện mới"; biến chung giống plugin (--accent, --surface-2…). */
:root {
  --surface: #ffffff; --panel: #f4f4f3; --line: #e6e6e4; --pill: #d9d9d7; --ink: #1c1c1c; --muted: #6b6b6b; --faint: #9a9a98; --black: #141414;
  --acc: #1f8ad4; --acc-soft: #e6f3fc; --red: #e0352b; --amber: #8a5200; --amber-soft: #fff1dc; --blue: #1e5a8c; --blue-soft: #e4eef7; --unread: #fffaf2;
  --accent: #1f8ad4; --accent-soft: #e6f3fc; --surface-2: #f4f4f3; --surface-3: #fafaf9;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--surface); color: var(--ink); font: 14px/1.45 var(--font); -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
.app { height: 100%; display: flex; flex-direction: column; max-width: 1100px; margin: 0 auto;
  padding-top: env(safe-area-inset-top, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.boot { margin: auto; color: var(--faint); }
.scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: env(safe-area-inset-bottom, 0px); }

/* đăng nhập */
.login { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 28px; text-align: center; }
.logo { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 6px 18px rgba(31,138,212,.35); }
.login h1 { margin: 6px 0 0; font-size: 22px; }
.login p { margin: 0; max-width: 34ch; color: var(--muted); font-size: 13.5px; }
.gbtn { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 11px 20px; border: 1px solid var(--pill); border-radius: 999px; background: var(--surface); font-weight: 600; }
.gbtn svg { width: 18px; height: 18px; }
.gbtn:disabled { opacity: .5; }
.small { max-width: 36ch; font-size: 12px; color: var(--faint); }
.err { color: var(--red); font-size: 13px; max-width: 36ch; }
.devin { display: flex; gap: 6px; width: 100%; max-width: 320px; }
.devin input { flex: 1; min-width: 0; padding: 9px 14px; border: 1px solid var(--pill); border-radius: 999px; }
.zalo { max-width: 340px; padding: 12px 14px; border-radius: 12px; background: var(--amber-soft); color: var(--amber); font-size: 13px; text-align: left; }
.zalo code { display: block; margin-top: 6px; font: 600 12px var(--mono); word-break: break-all; color: var(--ink); }

/* đầu app */
.top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.top h1 { flex: 1; margin: 0; font-size: 18px; }
.top .me.hasav { padding: 0; background: none; overflow: hidden; }
.top .me .tk-av { width: 32px; height: 32px; font-size: 13px; }
/* 0.10.0: nút bánh răng Cài đặt (chủ đề 11, 16) */
.top .gear { width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; color: var(--muted, #767676); display: inline-flex; align-items: center; justify-content: center; }
#tk-settings { flex: 1; overflow: auto; }
.top .me { width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--black); color: #fff; font-weight: 700; font-size: 13px; }
.menu { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 58px); right: 12px; z-index: 20; width: 250px; padding: 10px; background: var(--surface); border: 1px solid var(--pill); border-radius: 12px; box-shadow: 0 10px 26px rgba(0,0,0,.18); font-size: 13px; }
.menu .who { padding: 4px 6px 8px; color: var(--muted); word-break: break-all; }
.menu button { display: block; width: 100%; padding: 8px 6px; border: 0; border-radius: 8px; background: none; text-align: left; }
.menu button:hover { background: var(--panel); }
.banner { display: flex; align-items: center; gap: 10px; margin: 8px 12px 0; padding: 10px 12px; border-radius: 12px; background: var(--acc-soft); color: var(--acc); font-size: 13px; }
.banner b { flex: 1; font-weight: 600; }
.banner button { border: 0; border-radius: 999px; background: var(--acc); color: #fff; padding: 6px 13px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.banner .x { background: none; color: var(--acc); padding: 0 4px; font-size: 18px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; padding: 10px 0; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: 13.5px; }
.tabs button.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--acc); }
.bd { display: inline-block; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center; }
.empty { padding: 40px 24px; text-align: center; color: var(--faint); }

/* danh sách chat */
.pfold { display: flex; align-items: center; gap: 8px; width: 100%; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line); background: var(--panel); text-align: left; font-size: 14px; }
.pfold .car { width: 12px; color: var(--muted); font-size: 11px; }
.pfold svg { flex: none; width: 20px; height: 20px; }
.pfold b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfold .cnt { color: var(--muted); font-size: 12px; }
.row { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px 10px 36px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); text-align: left; }
.row::before { content: ""; position: absolute; left: 22px; top: 0; bottom: 0; border-left: 1px dashed #c4c4c4; }
.row.unread { background: var(--unread); }
.av { flex: none; width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel) center / cover no-repeat; text-align: center; font: 700 15px/44px var(--mono); color: var(--red); }
.mid { flex: 1; min-width: 0; }
.l1, .l2 { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { margin-right: 5px; color: var(--red); font: 700 12.5px var(--mono); }
.tnm { font-weight: 600; }
.l2 { margin-top: 1px; font-size: 12.5px; color: var(--muted); }
.row.unread .l2 { color: var(--ink); font-weight: 600; }
.rt { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 11.5px; color: var(--muted); }
.row.unread .rt .tm { color: var(--red); font-weight: 600; }
.rt .bd { margin: 0; }
.tag { display: inline-block; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.t-thieu { background: var(--amber-soft); color: var(--amber); }
.t-hong { background: var(--blue-soft); color: var(--blue); }

/* chat */
.ch { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.back { flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--panel); font-size: 20px; line-height: 1; }
.ch .t { flex: 1; min-width: 0; }
.ch b, .ch small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch b { font-size: 14.5px; }
.ch small { font-size: 12px; color: var(--muted); }
/* khung chat dùng ChatKit (/chatkit.js) — D145–D148 */
.chips { padding: 5px 12px; border-bottom: 1px solid var(--line); font-size: 11.5px; color: var(--muted); overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips:empty { display: none; }
.wc { display: inline-flex; align-items: center; gap: 4px; margin-right: 6px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--c); font-weight: 600; }
.wc i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.ckhost { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom, 0px); }
.ckhost .ck { flex: 1; }
.ckhost .ck-bar input[type=text] { font-size: 16px; }
.send { padding: 9px 16px; border: 0; border-radius: 999px; background: var(--black); color: #fff; font-weight: 600; }
.send:disabled { opacity: .35; }
.viewer { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.92); }
.viewer img { max-width: 100%; max-height: 100%; }

/* file đã chia sẻ */
.files { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.file { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.file .h { display: flex; align-items: baseline; gap: 8px; }
.file .h b { flex: 1; }
.file small { color: var(--muted); font-size: 12.5px; }
.file code { font: 600 12px var(--mono); word-break: break-all; }
.file .btns { display: flex; gap: 6px; }
.file .btns button { padding: 6px 13px; border: 1px solid var(--pill); border-radius: 999px; background: var(--surface); font-size: 13px; }
.file .btns .pri { background: var(--acc); border-color: var(--acc); color: #fff; font-weight: 600; }
.sec { margin: 4px 2px -2px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.hint { margin: 0; padding: 0 2px; font-size: 12.5px; color: var(--faint); }

.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 40; max-width: calc(100% - 32px); transform: translateX(-50%); padding: 9px 15px; border-radius: 999px; background: var(--black); color: #fff; font-size: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }

/* hồ sơ xưởng (D139) */
.sav { flex: none; display: inline-grid; place-items: center; overflow: hidden; border-radius: 50%; color: #fff; font-weight: 700; }
.sav img { width: 100%; height: 100%; object-fit: cover; }
.shopf { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.avrow { display: flex; align-items: center; gap: 14px; }
.avb { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.btnf { padding: 7px 14px; border: 1px solid var(--pill); border-radius: 999px; background: var(--surface); font-size: 13.5px; cursor: pointer; }
.lnk { padding: 0; border: 0; background: none; color: var(--acc); font-size: 13px; }
.colors { display: flex; gap: 8px; }
.colors button { width: 28px; height: 28px; padding: 0; border: 2px solid transparent; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); }
.colors button.on { border-color: #fff; box-shadow: 0 0 0 2px var(--black); }
.fl { display: flex; justify-content: space-between; margin-top: 6px; font-size: 13px; font-weight: 600; }
.fl span { font-weight: 400; color: var(--faint); }
.shopf input { padding: 10px 12px; border: 1px solid var(--pill); border-radius: 10px; font-size: 16px; }
.shopf small.err, .shopf p.err { color: #c62828; font-size: 12.5px; margin: 0; }
.shopf small.hint { padding: 0; }
.prevw { margin-top: 8px; padding: 10px; border: 1px dashed var(--pill); border-radius: 12px; }
.prevw > span { display: block; margin-bottom: 6px; font-size: 11.5px; color: var(--muted); }
.wtop { display: flex; align-items: center; gap: 8px; }
.wtop b, .wtop small { display: block; }
.wtop small { font-size: 12px; color: var(--muted); }
.acts { display: flex; gap: 8px; margin-top: 8px; }
.btn2 { padding: 9px 16px; border: 1px solid var(--pill); border-radius: 999px; background: var(--surface); }

/* 0.9.0: app chung chủ xưởng + thợ */
.lsec { padding: 10px 14px 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; background: var(--panel); border-bottom: 1px solid var(--line); }
.addl { display: flex; gap: 6px; }
.addl input { flex: 1; min-width: 0; padding: 9px 14px; border: 1px solid var(--pill); border-radius: 999px; }
.addl button { flex: none; padding: 8px 16px; border: 0; border-radius: 999px; background: var(--acc); color: #fff; font-weight: 600; }
.files p.err { margin: 0; padding: 0 2px; }
.ch .view3d { flex: none; padding: 6px 12px; border: 1px solid var(--pill); border-radius: 999px; background: var(--surface); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
/* 0.10.0: danh sách chat chiếm phần còn lại của màn (tinnhan.js) */
#xtop { flex: none; position: relative; }
.tnhost { flex: 1; min-height: 0; }

/* Chủ đề 20 (bảng thiết kế): thanh trên kiểu máy tính, thanh dưới kiểu điện thoại. Mốc 600 px giống tinnhan.js. */
.app.xapp { max-width: none; }
.xbody { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.xbody > [hidden] { display: none !important; }
.qi { display: block; flex: none; }
.xh { gap: 0; height: 56px; padding: 0 16px; }
.xh .brand { display: flex; align-items: center; margin-right: 28px; }
.xh .blogo { width: 30px; height: 30px; margin-right: 10px; border-radius: 9px; background: var(--acc); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.xh .blogo .qi { width: 18px; height: 18px; }
.xh .brand b { font-size: 16px; font-weight: 700; }
.xtabs { flex: 1; display: flex; align-self: stretch; }
.xtab { display: flex; align-items: center; margin-right: 22px; padding: 0 4px; border: 0; border-bottom: 2px solid transparent; background: none; color: #4a4a4a; font-size: 14px; font-weight: 500; }
.xtab .qi { width: 20px; height: 20px; margin-right: 8px; color: #2b2f33; }
.xtab.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--acc); }
.xcnt { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; margin-left: 8px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 1; }
.xh .ttl { display: none; }
.xh .gear { width: 38px; height: 38px; margin-right: 6px; color: #2b2f33; }
.xh .gear:hover { background: var(--panel); }
.xnav { display: none; }
.xset-card { max-width: 520px; padding: 18px 8px 8px; }
.xset-card .tk-head { padding: 0 12px; }
#xset { padding-bottom: 12px; }
#xmodels .files { max-width: 720px; margin: 0 auto; }
@media (max-width: 599px) {
  .xh { height: auto; padding: 18px 16px 10px; border-bottom: 0; }
  .xh .brand, .xh .xtabs, .xh .gear { display: none; }
  .xh .ttl { display: block; flex: 1; margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
  .xh .me, .xh .me .tk-av { width: 34px; height: 34px; }
  .xnav { flex: none; display: flex; height: calc(64px + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); border-top: 1px solid var(--line); background: var(--surface); }
  .xnb { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 0 0; border: 0; background: none; color: var(--muted); font-size: 11.5px; }
  .xnb .xni { position: relative; margin-bottom: 3px; }
  .xnb .qi { width: 24px; height: 24px; }
  .xnb .xcnt { position: absolute; top: -5px; left: 15px; min-width: 18px; height: 18px; margin: 0; padding: 0 5px; border: 2px solid var(--surface); font-size: 10.5px; }
  .xnb.on { color: var(--acc); font-weight: 600; }
  .app.chat-open #xtop, .app.chat-open .xnav { display: none; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .app.chat-open ~ .toast { bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
}
