:root {
  --primary: #FF7A00;
  --primary-dark: #E65100;
  --primary-light: #FFB347;
  --primary-soft: #FFF3E8;
  --primary-muted: #FFE8D6;
  --text: #1A1A1A;
  --text-2: #6A6A6A;
  --text-3: #999999;
  --line: #F0F0F0;
  --bg: #F5F5F5;
  --white: #FFFFFF;
  --danger: #FF4B43;
  --success: #22C55E;
  --radius: 12px;
  --safe-bottom: 20px;
  --tab-h: 64px;
  --nav-h: 44px;
  --status-h: 44px;
  --phone-w: 390px;
  --phone-h: 844px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Segoe UI", sans-serif;
  background: #E8E8E8;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; border: none; background: none; outline: none; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* ========== Stage ========== */
.stage {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 16px;
}
.brand-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #333;
}
.brand-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px;
}
.brand-bar h1 { font-size: 18px; font-weight: 700; }
.brand-bar p { font-size: 12px; color: var(--text-2); }

.phone {
  width: min(100%, var(--phone-w));
  height: min(92vh, var(--phone-h));
  background: var(--white);
  border-radius: 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,.18), 0 0 0 10px #1c1c1e;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.status-bar {
  height: var(--status-h);
  padding: 12px 22px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  position: relative;
  z-index: 5;
  background: var(--white);
  flex-shrink: 0;
}
.status-bar .island {
  position: absolute;
  left: 50%; top: 8px; transform: translateX(-50%);
  width: 110px; height: 28px; border-radius: 20px; background: #111;
}
.status-icons { display: flex; gap: 5px; align-items: center; font-size: 12px; }

.app {
  flex: 1;
  min-height: 0;
  position: relative;
  background: var(--bg);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--bg);
  animation: fade .18s ease;
}
.screen.active { display: flex; }

@keyframes fade {
  from { opacity: .4; transform: translateX(8px); }
  to { opacity: 1; transform: none; }
}

.nav {
  height: var(--nav-h);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  flex-shrink: 0;
  border-bottom: 1px solid transparent;
}
.nav .title {
  position: absolute; left: 0; right: 0;
  text-align: center; font-size: 17px; font-weight: 650;
  pointer-events: none;
}
.nav-side { display: flex; align-items: center; gap: 8px; min-width: 72px; z-index: 1; }
.nav-side.right { justify-content: flex-end; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; cursor: pointer; color: var(--text);
}
.icon-btn:active { background: var(--primary-soft); color: var(--primary); }
.icon-btn img, .icon-btn svg { width: 22px; height: 22px; }

.scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.scroll::-webkit-scrollbar { display: none; }

/* ========== Tab bar ========== */
.tabbar {
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding: 6px 8px var(--safe-bottom);
  background: rgba(255,255,255,.96);
  border-top: 1px solid #EFEFEF;
  display: flex;
  justify-content: space-around;
  flex-shrink: 0;
  backdrop-filter: blur(12px);
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #8A8A8A;
  cursor: pointer;
  font-size: 10px;
  padding: 4px 0;
}
.tab-item .tab-icon {
  width: 40px; height: 28px;
  display: grid; place-items: center;
  border-radius: 14px;
  transition: .15s;
}
.tab-item img { width: 22px; height: 22px; opacity: .75; }
.tab-item.active { color: var(--primary); font-weight: 600; }
.tab-item.active .tab-icon { background: var(--primary-soft); }
.tab-item.active img { opacity: 1; filter: none; }
.tab-item:not(.active) img { filter: grayscale(1) brightness(.5); opacity: .55; }

/* ========== Cells / lists ========== */
.section { margin-top: 10px; background: var(--white); }
.section + .section { margin-top: 10px; }
.section-label {
  padding: 10px 16px 6px;
  font-size: 13px; color: var(--text-3);
}
.cell {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--white);
  cursor: pointer; position: relative;
}
.cell:active { background: #FAFAFA; }
.cell + .cell::before,
.cell.line::before {
  content: ""; position: absolute; left: 16px; right: 0; top: 0;
  height: 1px; background: var(--line);
}
.cell.indent::before { left: 68px; }
.cell .label { flex: 1; font-size: 16px; }
.cell .value { font-size: 14px; color: var(--text-3); max-width: 55%; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .chevron { width: 16px; height: 16px; opacity: .35; flex-shrink: 0; }
.cell .avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; }
.cell .meta { flex: 1; min-width: 0; }
.cell .name { font-size: 16px; font-weight: 600; }
.cell .sub { font-size: 13px; color: var(--text-3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .right-meta { text-align: right; flex-shrink: 0; }
.cell .time { font-size: 11px; color: var(--text-3); }
.cell-desc {
  padding: 0 16px 14px;
  font-size: 12px; color: var(--text-3); line-height: 1.5;
  background: var(--white);
}

/* Switch */
.switch {
  width: 46px; height: 28px; border-radius: 14px;
  background: #E5E5EA; position: relative; flex-shrink: 0;
  transition: .2s; cursor: pointer;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: .2s;
}
.switch.on { background: var(--primary); }
.switch.on::after { left: 20px; }

/* Badge */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 1px 6px; border-radius: 4px; font-size: 10px; color: #fff;
  background: var(--primary); font-weight: 600;
}
.badge.owner { background: var(--primary); }
.badge.admin { background: #FF8A3D; }
.badge.status { background: var(--primary); border-radius: 4px; padding: 2px 8px; font-size: 11px; }
.badge.tag {
  background: var(--primary-muted); color: var(--primary-dark);
  border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 500;
}
.badge.tag.alt { background: #FFE0C2; color: #C45A00; }

/* Members grid */
.members {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 14px 8px; padding: 18px 12px 12px; background: var(--white);
}
.member {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; font-size: 11px; color: var(--text-2);
}
.member .ava-wrap { position: relative; width: 52px; height: 52px; }
.member .ava-wrap img { width: 52px; height: 52px; border-radius: 50%; }
.member .online {
  position: absolute; top: 0; right: 0; width: 10px; height: 10px;
  border: 2px solid #fff; border-radius: 50%; background: var(--success);
}
.member .role { margin-top: -2px; }
.member-action {
  width: 52px; height: 52px; border-radius: 50%;
  border: 1.5px dashed #C7C7C7; display: grid; place-items: center;
  color: #999; font-size: 28px; line-height: 1;
}

/* Conversation / Messages */
.page-nav {
  height: auto;
  min-height: 52px;
  padding: 10px 12px 8px;
  background: linear-gradient(180deg, #FFF6EC 0%, #FFFFFF 100%);
  border-bottom: 1px solid var(--primary-muted);
  gap: 8px;
}
.page-nav .nav-brand {
  display: flex; align-items: center; gap: 10px; z-index: 1;
}
.page-nav .brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff; font-size: 14px; font-weight: 800;
  display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(255,122,0,.28);
}
.page-nav .brand-title { font-size: 18px; font-weight: 750; line-height: 1.1; }
.page-nav .brand-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.page-nav .icon-btn.accent {
  background: var(--primary); color: #fff;
  box-shadow: 0 4px 12px rgba(255,122,0,.3);
}
.page-nav .icon-btn.accent img { filter: brightness(0) invert(1); width: 18px; height: 18px; }
.page-nav .icon-btn.accent:active { background: var(--primary-dark); }

.filter-chips {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 12px 16px 4px;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 6px 14px; border-radius: 999px;
  background: var(--white); color: var(--text-2); font-size: 13px;
  border: 1px solid #EEE; cursor: pointer; font-weight: 500;
}
.chip.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(255,122,0,.25);
}

.msg-scroll { background: var(--bg); }
.msg-list {
  margin: 8px 12px 16px;
  background: var(--white);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.03);
}
.conv-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px; cursor: pointer; position: relative;
}
.conv-row + .conv-row::before {
  content: ""; position: absolute; left: 70px; right: 14px; top: 0;
  height: 1px; background: var(--line);
}
.conv-row:active { background: #FFFCFA; }
.conv-row.hide { display: none; }
.ava-box {
  width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0;
  position: relative; background: var(--primary-soft);
  overflow: visible;
}
.ava-box img { width: 48px; height: 48px; border-radius: 14px; display: block; }
.ava-box.group img { border-radius: 14px; }
.ava-box.sys { background: #FFF0E4; }
.ava-box .dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 10px; height: 10px; border-radius: 50%;
  background: #C7C7C7; border: 2px solid #fff;
}
.ava-box .dot.online { background: var(--success); }
.conv-row .meta { flex: 1; min-width: 0; }
.conv-row .top,
.conv-row .bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.conv-row .name { font-size: 16px; font-weight: 650; }
.conv-row .time { font-size: 11px; color: var(--text-3); flex-shrink: 0; }
.conv-row .preview {
  font-size: 13px; color: var(--text-3); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0;
}
.conv-row .tag-img { color: var(--primary); }
.conv-row .unread {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 700;
  display: inline-grid; place-items: center; flex-shrink: 0;
}
.conv-row .check { width: 14px; height: 14px; flex-shrink: 0; margin-top: 4px; }

/* Contacts */
.contacts-scroll { position: relative; background: var(--bg); padding-bottom: 12px; }
.contacts-search {
  margin: 12px 16px 0; padding: 11px 14px;
  background: #fff; border-radius: 12px;
  display: flex; align-items: center; gap: 8px;
  color: var(--text-3); font-size: 14px; cursor: pointer;
  border: 1px solid #F0F0F0;
}
.contacts-search img { width: 16px; height: 16px; opacity: .45; }
.contacts-entries {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 12px 16px;
}
.entry-card {
  background: #fff; border-radius: 14px; padding: 14px 12px;
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  border: 1px solid #F2F2F2;
  box-shadow: 0 1px 3px rgba(0,0,0,.02);
}
.entry-card:active { background: var(--primary-soft); border-color: var(--primary-muted); }
.entry-card img { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; }
.entry-card .en { font-size: 14px; font-weight: 650; }
.entry-card .es { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.contacts-list {
  margin: 0 12px 16px; background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.03);
}
.index-letter {
  padding: 8px 14px 4px;
  font-size: 12px; color: var(--primary); font-weight: 700;
  background: #fff;
}
.contact-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; cursor: pointer; position: relative;
}
.contact-row + .contact-row::before,
.index-letter + .contact-row::before { display: none; }
.contact-row:active { background: #FFFCFA; }
.contact-row .ava-box { width: 44px; height: 44px; border-radius: 12px; }
.contact-row .ava-box img { width: 44px; height: 44px; border-radius: 12px; }
.contact-row .meta { flex: 1; min-width: 0; }
.contact-row .name { font-size: 15px; font-weight: 650; }
.contact-row .sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.side-index {
  position: absolute; right: 4px; top: 46%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 1px;
  z-index: 3; font-size: 11px; color: var(--primary);
  font-weight: 650; text-align: center;
  padding: 6px 2px; line-height: 1.35;
}
.side-index span {
  display: block; min-width: 16px; padding: 1px 0;
  cursor: pointer; border-radius: 4px;
}
.side-index span:active { background: var(--primary-soft); }

/* Follow */
.follow-scroll { background: var(--bg); padding-bottom: 16px; }
.follow-card {
  margin: 10px 12px; background: var(--white); border-radius: 16px;
  padding: 16px; box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
.follow-card.hide { display: none; }
.follow-head { display: flex; gap: 12px; align-items: flex-start; }
.follow-head .ava.letter {
  width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff; font-size: 18px; font-weight: 700;
  display: grid; place-items: center;
}
.follow-head .ava.letter.alt {
  background: linear-gradient(135deg, #FFB74D, #FF8A3D);
}
.follow-head .ava.letter.done {
  background: linear-gradient(135deg, #C8C8C8, #9E9E9E);
}
.follow-head .info { flex: 1; min-width: 0; }
.follow-head .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.follow-head .name { font-size: 17px; font-weight: 700; }
.badge.status.done { background: #9E9E9E; }
.follow-call {
  flex-shrink: 0; height: 30px; padding: 0 12px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
  font-size: 12px; font-weight: 650; cursor: pointer;
}
.follow-call:active { background: var(--primary-muted); }
.tags { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.follow-stats {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 8px; margin-top: 14px;
  background: var(--primary-soft); border-radius: 12px; padding: 10px 8px;
}
.follow-stats div { text-align: center; }
.follow-stats b { display: block; font-size: 14px; color: var(--primary-dark); }
.follow-stats span { font-size: 11px; color: var(--text-3); }
.timeline { margin-top: 16px; padding-left: 4px; }
.timeline-date { font-size: 13px; color: var(--text-2); margin-bottom: 12px; font-weight: 600; }
.tl-item { display: flex; gap: 12px; position: relative; padding-bottom: 8px; }
.tl-ava { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.tl-body { flex: 1; }
.tl-top { display: flex; justify-content: space-between; align-items: center; }
.tl-name { font-weight: 600; font-size: 14px; }
.tl-time { font-size: 12px; color: var(--text-3); }
.tl-type { margin: 6px 0; }
.tl-text { font-size: 13px; color: var(--text-2); line-height: 1.55; }
.follow-more {
  text-align: center; margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13px; color: var(--primary); font-weight: 600; cursor: pointer;
}

/* ========== Folder page ========== */
.folder-nav {
  background: linear-gradient(180deg, #FFF8F0 0%, #fff 100%);
  border-bottom: 1px solid var(--primary-muted);
}
.folder-nav .upload-btn {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--primary); color: #fff;
}
.folder-nav .upload-btn img {
  filter: brightness(0) invert(1);
  width: 18px; height: 18px;
}
.folder-nav .upload-btn:active { background: var(--primary-dark); }

.folder-scroll {
  background: var(--bg);
  padding: 12px 16px 24px;
}

.folder-block {
  background: var(--white);
  border-radius: 16px;
  padding: 14px 14px 12px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.03);
}
.folder-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.folder-hd > span {
  font-size: 15px; font-weight: 650; color: var(--text);
}
.folder-clear,
.folder-sort {
  font-size: 13px; color: var(--primary); font-weight: 560;
  padding: 4px 8px; border-radius: 8px; cursor: pointer;
}
.folder-clear:active,
.folder-sort:active { background: var(--primary-soft); }

.recent-strip {
  display: flex; gap: 10px; overflow-x: auto; padding-bottom: 2px;
}
.recent-strip::-webkit-scrollbar { display: none; }
.recent-card {
  flex: 0 0 140px; background: var(--primary-soft);
  border: 1px solid var(--primary-muted);
  border-radius: 12px; padding: 12px; cursor: pointer;
}
.recent-card:active { background: #FFE8D6; }
.recent-card .rc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.recent-card .rc-top img { width: 28px; height: auto; flex-shrink: 0; }
.recent-card .rc-name {
  font-size: 12px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.recent-card .rc-sub { font-size: 11px; color: var(--text-3); }

.recent-empty {
  font-size: 12px; color: var(--text-3); line-height: 1.5;
  padding: 8px 4px 4px;
}

.file-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.file-item {
  background: #FAFAFA;
  border: 1px solid #F0F0F0;
  border-radius: 14px;
  padding: 14px 12px 12px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 8px;
  transition: .15s;
}
.file-item:active {
  transform: scale(.98);
  background: var(--primary-soft);
  border-color: var(--primary-muted);
}
.file-thumb {
  width: 56px; height: 64px;
  display: grid; place-items: center;
}
.file-thumb img { width: 48px; height: auto; }
.file-name {
  font-size: 13px; font-weight: 560; color: var(--text); line-height: 1.35;
  word-break: break-all;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  width: 100%;
}
.file-meta { font-size: 11px; color: var(--text-3); }

/* Me page */
.me-scroll { background: var(--bg); }
.me-hero {
  background: linear-gradient(165deg, #FF9A3D 0%, #FF7A00 48%, #E65100 100%);
  padding: 16px 16px 18px;
  color: #fff;
  border-radius: 0 0 24px 24px;
  box-shadow: 0 10px 28px rgba(255,122,0,.28);
}
.me-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.me-brand { font-size: 15px; font-weight: 750; letter-spacing: .5px; opacity: .95; }
.me-top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn.light {
  background: rgba(255,255,255,.18); color: #fff;
}
.icon-btn.light img { filter: brightness(0) invert(1); width: 18px; height: 18px; }
.me-edit {
  height: 30px; padding: 0 12px; border-radius: 999px;
  background: rgba(255,255,255,.95); color: var(--primary);
  font-size: 12px; font-weight: 700; cursor: pointer;
}
.me-card {
  display: flex; gap: 12px; align-items: center;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 18px; padding: 14px;
  backdrop-filter: blur(6px);
}
.me-card .ava {
  width: 64px; height: 64px; border-radius: 18px;
  background: #fff; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.me-info .name { font-size: 20px; font-weight: 750; }
.me-info .id { font-size: 13px; opacity: .9; margin-top: 4px; }
.me-info .verify {
  display: inline-block; margin-top: 8px;
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: rgba(255,255,255,.2);
}
.me-quick {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin-top: 14px;
}
.me-quick button {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: #fff; font-size: 11px; cursor: pointer; padding: 8px 4px;
  border-radius: 12px;
}
.me-quick button:active { background: rgba(255,255,255,.12); }
.me-quick img {
  width: 22px; height: 22px;
  filter: brightness(0) invert(1);
}
.me-group {
  margin: 12px 12px 0; background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.03);
}
.me-group-title {
  padding: 12px 14px 4px; font-size: 12px; color: var(--text-3); font-weight: 600;
}
.me-cell {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; cursor: pointer; position: relative;
}
.me-cell + .me-cell::before {
  content: ""; position: absolute; left: 62px; right: 14px; top: 0;
  height: 1px; background: var(--line);
}
.me-cell:active { background: #FFFCFA; }
.me-cell .label { flex: 1; font-size: 15px; font-weight: 560; }
.me-cell .hint-right { font-size: 12px; color: var(--text-3); }
.me-cell .chevron { width: 16px; height: 16px; opacity: .35; }
.menu-icon {
  width: 36px; height: 36px; border-radius: 11px;
  background: var(--primary-soft);
  display: grid; place-items: center; flex-shrink: 0;
}
.menu-icon img { width: 20px; height: 20px; }

/* Chat — orange theme */
.chat-nav {
  height: auto;
  min-height: 56px;
  padding: 8px 10px 10px;
  gap: 6px;
  background: linear-gradient(180deg, #FFF5EB 0%, #FFFFFF 100%);
  border-bottom: 1px solid var(--primary-muted);
  position: relative;
}
.chat-nav::after {
  content: "";
  position: absolute; left: 16px; right: 16px; bottom: 0;
  height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), transparent 70%);
  opacity: .35;
}
.chat-back {
  flex-shrink: 0;
  color: var(--text);
  z-index: 1;
}
.chat-head {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  z-index: 1; cursor: pointer;
  padding: 2px 4px;
  border-radius: 12px;
}
.chat-head:active { background: var(--primary-soft); }
.chat-head .ava-wrap {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  padding: 2px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  box-shadow: 0 2px 8px rgba(255,122,0,.25);
}
.chat-head .ava {
  width: 100%; height: 100%; border-radius: 10px;
  display: block; background: #fff;
}
.chat-head .meta { min-width: 0; }
.chat-head .meta .n {
  font-size: 16px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-head .meta .s {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text-3); margin-top: 2px;
}
.chat-head .online-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success); flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(34,197,94,.2);
}
.chat-actions {
  display: flex; align-items: center; gap: 2px;
  flex-shrink: 0; z-index: 1;
}
.chat-actions .icon-btn {
  width: 36px; height: 36px;
  color: var(--primary);
}
.chat-actions .icon-btn img { width: 20px; height: 20px; }

.chat-bg {
  flex: 1; overflow-y: auto; padding: 8px 12px 12px;
  background: #F2F2F2;
}
.date-pill {
  width: fit-content; margin: 10px auto;
  background: #E8E8E8; color: #8A8A8A;
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
}
.sys-tip {
  width: fit-content; max-width: 86%; margin: 10px auto;
  background: rgba(0,0,0,.06); color: #8A8A8A;
  font-size: 12px; padding: 6px 12px; border-radius: 8px; text-align: center; line-height: 1.4;
}
.bubble-row {
  display: flex; gap: 8px; margin: 8px 0; align-items: flex-end;
}
.bubble-row.out { flex-direction: row-reverse; }
.bubble-row .ava { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; }
.bubble {
  max-width: 72%; border-radius: 12px; position: relative;
  font-size: 15px; line-height: 1.45; color: var(--text);
}
.bubble.text {
  background: #fff;
  padding: 10px 12px;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.bubble-row.out .bubble.text {
  background: var(--primary-muted);
  border-radius: 12px 4px 12px 12px;
}
.bubble-row:not(.out) .bubble.text {
  border-radius: 4px 12px 12px 12px;
}
.bubble .txt { flex: 1; min-width: 0; word-break: break-word; }
.bubble .meta-inline {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; color: var(--text-3); white-space: nowrap; margin-left: auto;
}
.bubble .meta-inline img { width: 12px; height: 12px; }
.bubble.media-wrap {
  padding: 0; overflow: hidden; background: #fff;
  border: 2px solid var(--primary); border-radius: 12px 4px 12px 12px;
}
.bubble .img-msg {
  width: 180px; height: 130px;
  background: linear-gradient(160deg, #FFE0C2, #FFB347 45%, #FF7A00);
  color: #fff; font-size: 13px; font-weight: 600;
  display: grid; place-items: center;
}
.bubble .stamp {
  position: absolute; right: 8px; bottom: 6px;
  font-size: 10px; color: #fff;
  display: flex; align-items: center; gap: 3px;
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.chat-input {
  background: #fff; padding: 8px 12px calc(8px + var(--safe-bottom));
  border-top: 1px solid #EEE;
}
.composer {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.composer .field {
  flex: 1; background: #F5F5F5; border-radius: 22px;
  padding: 11px 16px; font-size: 15px; color: var(--text-3); cursor: text;
}
.send-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary); display: grid; place-items: center;
  cursor: pointer; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(255,122,0,.35);
}
.send-btn:active { transform: scale(.96); background: var(--primary-dark); }
.send-btn img { width: 18px; height: 18px; }
.tools.line {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 4px;
}
.tools.line button {
  width: 40px; height: 36px; display: grid; place-items: center;
  cursor: pointer; border-radius: 10px; color: var(--primary);
}
.tools.line button:active { background: var(--primary-soft); }
.tools.line img { width: 26px; height: 26px; }
.tools.line button img[src*="more"] { width: 18px; height: 18px; }

/* Toast */
.toast {
  position: absolute; left: 50%; bottom: 100px; transform: translateX(-50%);
  background: rgba(0,0,0,.78); color: #fff; padding: 8px 14px;
  border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none;
  transition: .2s; z-index: 20; white-space: nowrap;
}
.toast.show { opacity: 1; }

.hint {
  font-size: 12px; color: #666; text-align: center; max-width: 390px; line-height: 1.5;
}
.hint code { background: #fff; padding: 1px 6px; border-radius: 4px; }

@media (max-width: 480px) {
  .stage { padding: 0; justify-content: stretch; }
  .brand-bar, .hint { display: none; }
  .phone {
    width: 100%; height: 100vh; height: 100dvh;
    border-radius: 0; box-shadow: none;
  }
}
