body {
  margin: 0; background: #F3F7F6; color: #1C2423;
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
button, textarea { font: inherit; }
.bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; min-height: 48px;
  padding: 0 4px; background: rgba(243,247,246,.92);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.bar-back, .bar-send {
  width: 40px; height: 40px; border: 0; background: none; color: inherit; cursor: pointer;
  display: grid; place-items: center;
}
.bar-back svg, .bar-send svg { width: 24px; height: 24px; }
.bar strong { flex: 1; min-width: 0; font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page { width: min(720px, 100%); margin: 0 auto; padding: 8px 12px 24px; }
.guest, .empty, .error {
  margin: 48px auto; max-width: 420px; padding: 24px; border-radius: 16px; background: #fff; text-align: center;
}
.guest h1, .empty h1 { margin: 12px 0 8px; font-size: 18px; }
.guest p, .empty p, .error p { margin: 0; color: rgba(28,36,35,.62); }
.guest button, .error button, .invite button, .composer button {
  height: 44px; border: 0; border-radius: 12px; background: #0B6E6E; color: #fff; font-weight: 700; cursor: pointer;
}
.guest button { margin-top: 16px; padding: 0 18px; }
.list {
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 14px; border: 1px solid rgba(28,36,35,.06);
}
.row {
  display: flex; gap: 10px; align-items: center; padding: 10px 12px;
  border-bottom: 1px solid rgba(28,36,35,.05);
}
.row:last-child { border-bottom: 0; }
.row:active { background: rgba(28,36,35,.03); }
.list .avatar, .list .avatar img { width: 42px; height: 42px; background: #E6F0ED; color: #0B6E6E; }
.avatar, .avatar img {
  width: 48px; height: 48px; border-radius: 999px; flex: none; object-fit: cover; background: rgba(47,128,237,.12); color: #2F80ED;
}
.avatar { display: grid; place-items: center; font-weight: 800; overflow: hidden; }
.avatar.app-icon {
  border-radius: 12px; background: #fff;
  box-shadow: 0 0 0 1px rgba(28,36,35,.08);
}
.avatar.app-icon img { border-radius: 12px; }
.row-main { flex: 1; min-width: 0; }
.row-top, .row-sub { display: flex; gap: 8px; align-items: center; }
.row-top strong, .row-sub span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-top { align-items: baseline; }
.row-top strong { flex: 1; font-size: 14px; font-weight: 700; }
.row.unread .row-sub span { color: #1C2423; font-weight: 700; }
.row-sub { margin-top: 2px; color: rgba(28,36,35,.55); font-size: 12px; }
.row-sub span { flex: 1; }
.row time { flex: none; color: rgba(28,36,35,.45); font-size: 11px; }
.badge {
  flex: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #2F80ED; color: #fff;
  font-style: normal; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
}
.thread { display: flex; flex-direction: column; gap: 8px; min-height: calc(100vh - 148px); padding-bottom: 8px; }
.bubble { display: flex; align-items: flex-end; gap: 8px; }
.bubble.first:not(:first-child) { margin-top: 6px; }
.bubble-ava { flex: none; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; }
.bubble-ava img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bubble-name {
  padding-left: 4px; font-size: 12px; font-weight: 700; color: rgba(28,36,35,.72);
  max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.bubble.mine { justify-content: flex-end; }
.bubble .body { max-width: 78%; display: flex; flex-direction: column; gap: 6px; }
.bubble.mine .body { align-items: flex-end; }
.text {
  padding: 8px 12px; border-radius: 16px; background: #fff; white-space: pre-wrap; word-break: break-word;
}
.bubble.mine .text { background: #0B6E6E; color: #fff; border-bottom-right-radius: 4px; }
.bubble:not(.mine) .text { border-bottom-left-radius: 4px; }
.text time { display: block; margin-top: 4px; font-size: 10px; opacity: .7; }
.shot { display: block; max-width: 220px; border-radius: 12px; overflow: hidden; background: #E6F0ED; }
.shot img { width: 100%; display: block; }
.product, .place {
  display: flex; gap: 8px; width: min(280px, 78vw); padding: 8px; border-radius: 12px; background: #fff;
  border: 1px solid rgba(28,36,35,.08);
}
.product img, .product .ph { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: #E6F0ED; flex: none; }
.product strong { display: block; font-size: 13px; }
.product em { color: #E53935; font-style: normal; font-weight: 800; }
.invite, .composer {
  position: sticky; bottom: 0; display: flex; gap: 8px; padding: 12px; background: rgba(243,247,246,.96);
}
.invite { justify-content: center; }
.invite .no { background: #fff; color: #1C2423; border: 1px solid rgba(28,36,35,.12); }
.composer textarea {
  flex: 1; min-height: 44px; max-height: 120px; resize: none; border: 0; border-radius: 12px;
  padding: 10px 12px; background: #fff;
}
.composer button { width: 44px; }
.status { padding: 24px; text-align: center; color: rgba(28,36,35,.55); }
.bar-text {
  height: 40px; padding: 0 14px; border: 0; background: none; color: #0B6E6E; font-weight: 700; cursor: pointer;
}
.bar-text:disabled { opacity: .45; cursor: default; }
.bar-text[hidden], .bar-send[hidden] { display: none; }
body.g-white { background: #fff; }
body.g-white .bar { background: rgba(255,255,255,.94); }
.page.g-mode { padding: 0; }
.g-page { padding: 8px 0 96px; }
.g-card { margin: 0 12px; padding: 14px; border-radius: 16px; background: #fff; }
body.g-plain .g-card { box-shadow: 0 1px 0 rgba(28,36,35,.04); }
.g-field { display: block; position: relative; }
.g-field > span { display: block; margin: 0 0 6px 2px; font-size: 12px; font-weight: 600; color: rgba(28,36,35,.6); }
.g-input {
  width: 100%; height: 48px; border: 0; border-radius: 14px; padding: 0 14px; background: #F3F7F6; color: inherit; font: inherit; outline: none;
}
.g-input:focus { box-shadow: inset 0 0 0 1.5px #0B6E6E; }
.g-search { display: block; position: relative; margin-top: 12px; }
.g-search svg { position: absolute; left: 12px; top: 14px; width: 20px; height: 20px; color: rgba(28,36,35,.45); }
.g-search .g-input { padding-left: 40px; }
.g-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.g-chips:empty { display: none; }
.g-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 6px 0 4px; border-radius: 999px;
  border: 0; background: rgba(11,110,110,.1); color: #0B6E6E; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.g-chip img { width: 24px; height: 24px; border-radius: 999px; object-fit: cover; }
.g-chip svg { width: 16px; height: 16px; }
.g-label { margin: 16px 16px 8px; font-size: 14px; font-weight: 700; }
.g-list { background: #fff; }
.g-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; border: 0; background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer; border-bottom: 1px solid rgba(28,36,35,.08);
}
.g-row:last-child { border-bottom: 0; }
.g-row .avatar, .g-row .avatar img { width: 44px; height: 44px; }
.g-row-main { flex: 1; min-width: 0; }
.g-row-main strong { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-row-main span { display: block; margin-top: 2px; font-size: 13px; color: rgba(28,36,35,.55); }
.g-tick { width: 24px; height: 24px; flex: none; color: rgba(28,36,35,.35); }
.g-tick.on { color: #0B6E6E; }
.g-center { display: grid; place-items: center; min-height: 200px; padding: 24px; text-align: center; color: rgba(28,36,35,.55); }
.g-center button, .g-fill {
  height: 44px; padding: 0 18px; border: 0; border-radius: 12px; background: #0B6E6E; color: #fff; font: inherit; font-weight: 700; cursor: pointer;
}
.g-fill { width: 100%; height: 48px; }
.g-fill:disabled { opacity: .6; cursor: default; }
.g-spin {
  width: 26px; height: 26px; border-radius: 999px; border: 2.4px solid rgba(11,110,110,.2); border-top-color: #0B6E6E;
  animation: g-spin .8s linear infinite;
}
@keyframes g-spin { to { transform: rotate(360deg); } }
.g-invite { display: flex; gap: 12px; padding: 14px; margin: 0 12px 10px; border-radius: 16px; background: #fff; }
.g-invite .avatar, .g-invite .avatar img { width: 48px; height: 48px; }
.g-invite-main { flex: 1; min-width: 0; }
.g-invite-main strong { display: block; font-size: 15px; font-weight: 800; }
.g-invite-main p { margin: 2px 0 10px; font-size: 13px; color: rgba(28,36,35,.6); }
.g-invite-actions { display: flex; gap: 8px; }
.g-invite-actions button {
  flex: 1; height: 38px; border-radius: 10px; font: inherit; font-weight: 700; cursor: pointer;
  border: 1px solid #0B6E6E; background: #0B6E6E; color: #fff;
}
.g-invite-actions .no { background: #fff; color: #0B6E6E; }
.g-invite-actions button:disabled { opacity: .55; cursor: default; }
.g-empty { margin: 64px 24px; text-align: center; }
.g-empty .ico {
  width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 999px; display: grid; place-items: center;
  background: rgba(11,110,110,.1); color: #0B6E6E;
}
.g-empty .ico svg { width: 34px; height: 34px; }
.g-empty h2 { margin: 0 0 6px; font-size: 17px; font-weight: 800; }
.g-empty p { margin: 0; color: rgba(28,36,35,.6); font-size: 14px; }
.g-stack { display: flex; flex-direction: column; gap: 12px; padding: 16px 16px 28px; }
.g-stack .g-card { margin: 0; }
.g-hero { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 20px 16px; }
.g-ava { position: relative; width: 88px; height: 88px; border: 0; padding: 0; background: none; cursor: default; }
.g-ava.edit { cursor: pointer; }
.g-ava > img, .g-ava > span.ph {
  width: 88px; height: 88px; border-radius: 999px; object-fit: cover; display: grid; place-items: center;
  background: rgba(11,110,110,.12); color: #0B6E6E;
}
.g-ava > span.ph svg { width: 40px; height: 40px; }
.g-ava i {
  position: absolute; right: 0; bottom: 0; width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center;
  background: #0B6E6E; color: #fff;
}
.g-ava i svg { width: 14px; height: 14px; }
.g-hero h1 { margin: 0; font-size: 20px; font-weight: 800; text-align: center; }
.g-hero .sub { margin-top: -8px; color: rgba(28,36,35,.55); font-weight: 600; }
.g-hero .g-field { width: 100%; }
.g-info { display: flex; flex-direction: column; gap: 10px; }
.g-info-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: #F3F7F6; }
.g-info-row svg { width: 20px; height: 20px; color: #0B6E6E; flex: none; }
.g-info-row span { flex: 1; color: rgba(28,36,35,.65); font-weight: 600; }
.g-info-row b { font-weight: 800; text-align: right; }
.g-switch-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.g-switch-row div { flex: 1; }
.g-switch-row strong { display: block; font-weight: 700; }
.g-switch-row span { display: block; margin-top: 2px; font-size: 13px; color: rgba(28,36,35,.6); }
.g-switch-row .chat-menu-switch { width: 46px; height: 28px; padding: 3px; }
.g-switch-row .chat-menu-switch.on { background: #0B6E6E; }
.g-switch-row .chat-menu-switch i { width: 22px; height: 22px; }
.g-switch-row .chat-menu-switch.on i { transform: translateX(18px); }
.g-card h3 { margin: 0 0 6px; font-size: 14px; font-weight: 800; }
.g-radio { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.g-radio input { margin: 3px 0 0; width: 18px; height: 18px; accent-color: #0B6E6E; }
.g-radio strong { display: block; font-weight: 700; font-size: 14px; }
.g-radio span { display: block; font-size: 13px; color: rgba(28,36,35,.6); }
.g-tabs { position: sticky; top: 48px; z-index: 4; display: flex; background: #fff; border-bottom: 1px solid rgba(28,36,35,.08); }
.g-tabs button {
  flex: 1; height: 46px; border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  color: rgba(28,36,35,.45); border-bottom: 2px solid transparent;
}
.g-tabs button.on { color: #0B6E6E; font-weight: 800; border-bottom-color: #0B6E6E; }
.g-more { width: 36px; height: 36px; border: 0; border-radius: 999px; background: none; color: rgba(28,36,35,.45); cursor: pointer; display: grid; place-items: center; flex: none; }
.g-more svg, .g-chev { width: 22px; height: 22px; }
.g-chev { color: rgba(28,36,35,.35); flex: none; }
.g-pop {
  position: fixed; z-index: 40; min-width: 180px; padding: 6px 0; border-radius: 12px; background: #fff;
  box-shadow: 0 10px 30px rgba(16,24,23,.18);
}
.g-pop button { display: block; width: 100%; padding: 12px 16px; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.g-pop button:hover { background: rgba(28,36,35,.05); }
.g-fab {
  position: fixed; right: max(16px, calc(50% - 344px)); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 6;
  display: inline-flex; align-items: center; gap: 8px; height: 52px; padding: 0 20px; border: 0; border-radius: 16px;
  background: #0B6E6E; color: #fff; font: inherit; font-weight: 700; cursor: pointer; box-shadow: 0 6px 18px rgba(11,110,110,.35);
}
.g-fab svg { width: 22px; height: 22px; }

/* Khung nhắn tin desktop: cùng shell 3 cột (điều hướng · nội dung · hội thoại); bấm hội thoại mở cửa sổ chat nổi. */
@media (min-width: 1100px) and (hover: hover) and (pointer: fine) {
  body.chat-shell, body.chat-shell.g-white { background: #F3F7F6; }
  body.chat-shell .php-col {
    position: relative; display: flex; flex-direction: column;
    background: #fff; border-radius: 14px; border: 1px solid rgba(28,36,35,.06);
  }
  body.chat-mode-inbox .inbox-head a { display: none; }
  body.chat-shell .inbox-row:hover, body.chat-shell .list .row:hover { background: rgba(28,36,35,.03); }
  body.chat-shell .inbox-row.on { background: #E7F6F3; }
  body.chat-shell .inbox-row.on .inbox-top strong { color: #0B6E6E; }

  body.chat-shell .bar {
    flex: none; min-height: 56px; padding: 0 8px 0 12px; gap: 4px;
    background: #fff; border-bottom: 1px solid rgba(28,36,35,.06);
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  body.chat-mode-inbox .bar-back, body.chat-mode-thread .bar-back, body.chat-mode-peer .bar-back { display: none; }
  body.chat-shell .page { flex: 1 0 auto; width: 100%; max-width: 760px; padding: 12px 16px 0; }
  body.chat-mode-inbox .page { max-width: none; padding: 0; }
  body.chat-mode-inbox .list { border: 0; border-radius: 0; }
  body.chat-shell .page.g-mode { max-width: none; padding: 0; }
  body.chat-shell .g-tabs { top: 56px; }
  body.chat-shell .thread { min-height: 0; }
  body.chat-shell .composer, body.chat-shell .invite {
    margin: 0 -16px; padding: 12px 16px; background: #fff; border-top: 1px solid rgba(28,36,35,.06);
  }
  body.chat-shell .composer textarea { background: #F3F7F6; }
  body.chat-shell .text { background: #F3F7F6; }
  body.chat-shell .bubble.mine .text { background: #0B6E6E; }
  body.chat-shell .product, body.chat-shell .place { background: #fff; }
  body.chat-shell .g-fab { right: 348px; bottom: 28px; }
}
