:root {
  --primary: #ee4d2d;
  --primary-dark: #d73211;
  --primary-light: #fff1ed;
  --accent: #ffa53d;
  --bg: #f5f5f5;
  --card: #ffffff;
  --text: #222;
  --text-2: #666;
  --text-3: #999;
  --border: #ebebeb;
  --green: #00a651;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.06);
  --shadow-lg: 0 6px 24px rgba(0,0,0,.1);
  --header-h: 56px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 14px; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ===== 顶部栏 ===== */
.topbar { background: #fff; border-bottom: 1px solid var(--border); }
.topbar-inner { height: var(--header-h); display: flex; align-items: center; gap: 20px; }
.logo { font-size: 22px; font-weight: 800; color: var(--primary); letter-spacing: -.5px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.logo .dot { color: var(--accent); }
.searchbar { flex: 1; display: flex; align-items: center; background: var(--bg); border-radius: 6px; overflow: hidden; max-width: 560px; }
.searchbar input { flex: 1; border: none; outline: none; padding: 9px 14px; background: transparent; font-size: 14px; }
.searchbar button { padding: 9px 16px; background: var(--primary); color: #fff; font-size: 15px; }
.searchbar button:hover { background: var(--primary-dark); }
.nav-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-btn { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 10px; color: var(--text-2); border-radius: 6px; font-size: 11px; }
.nav-btn:hover { color: var(--primary); background: var(--primary-light); }
.nav-btn .ico { font-size: 20px; line-height: 1; }
.nav-btn .badge { position: relative; }
.nav-btn .badge::after { content: attr(data-n); position: absolute; top: -8px; right: -10px; background: var(--primary); color: #fff; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.nav-btn .badge[data-n="0"]::after, .nav-btn .badge:not([data-n])::after { display: none; }

/* ===== 站点切换 ===== */
.site-switcher { position: relative; }
.site-btn { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 20px; background: #fff; font-size: 13px; color: var(--text); }
.site-btn:hover { border-color: var(--primary); color: var(--primary); }
.site-menu { position: absolute; top: calc(100% + 6px); right: 0; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 190px; overflow: hidden; z-index: 100; display: none; }
.site-menu.open { display: block; }
.site-menu .item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; }
.site-menu .item:hover { background: var(--primary-light); }
.site-menu .item.active { background: #fff7f5; }
.site-menu .item.active::after { content: "✓"; margin-left: auto; color: var(--primary); font-weight: 700; }
.site-menu .flag { font-size: 20px; }
.site-menu .meta { display: flex; flex-direction: column; }
.site-menu .meta b { font-size: 13px; }
.site-menu .meta span { font-size: 11px; color: var(--text-3); }

/* ===== 分类条 ===== */
.catbar { background: #fff; border-bottom: 1px solid var(--border); }
.catbar-inner { display: flex; gap: 4px; overflow-x: auto; padding: 10px 0; }
.cat-chip { white-space: nowrap; padding: 7px 16px; border-radius: 20px; font-size: 13px; color: var(--text-2); }
.cat-chip:hover { color: var(--primary); }
.cat-chip.active { background: var(--primary); color: #fff; font-weight: 600; }

/* ===== 首页横幅 ===== */
.hero { padding: 18px 0 6px; }
.hero-card { background: linear-gradient(120deg,#ff7a45 0%, #ee4d2d 55%, #ffb347 100%); border-radius: 14px; color: #fff; padding: 30px 34px; display: flex; align-items: center; justify-content: space-between; overflow: hidden; position: relative; }
.hero-card h1 { font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.hero-card p { font-size: 14px; opacity: .95; max-width: 460px; }
.hero-card .hero-emoji { font-size: 72px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.2)); animation: float 3s ease-in-out infinite; }
.hero-card .hero-logo { height: 150px; width: auto; filter: drop-shadow(0 4px 10px rgba(0,0,0,.25)); animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }

/* ===== 区块标题 ===== */
.section { padding: 18px 0; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 18px; font-weight: 700; }
.section-head span { color: var(--text-3); font-size: 13px; }

/* ===== 商品网格 ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 12px; }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card .thumb { width: 100%; aspect-ratio: 1 / 1; height: auto; display: flex; align-items: center; justify-content: center; font-size: 56px; position: relative; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb .soldout { position: absolute; inset: 0; background: rgba(255,255,255,.7); display: flex; align-items: center; justify-content: center; color: var(--text-2); font-weight: 700; font-size: 14px; }
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.card .name { font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px; color: var(--text); }
.card .price { color: var(--primary); font-size: 16px; font-weight: 700; }
.card .price small { font-size: 11px; font-weight: 600; }
.card .meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3); }
.card .meta .sold { margin-left: auto; }
.star { color: #ffb400; font-size: 12px; }
.tag { position: absolute; top: 8px; left: 8px; background: var(--primary); color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 4px; font-weight: 600; }

/* ===== 工具栏 ===== */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .sort { margin-left: auto; display: flex; gap: 2px; background: #fff; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.toolbar .sort button { padding: 8px 14px; font-size: 13px; color: var(--text-2); }
.toolbar .sort button.active { background: var(--primary); color: #fff; }
.toolbar .count { color: var(--text-3); font-size: 13px; }

/* ===== 按钮 ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600; transition: opacity .15s; }
.btn:hover { opacity: .88; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-ghost { background: var(--primary-light); color: var(--primary); }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 24px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== 商品详情 ===== */
.pd { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; background: #fff; border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.pd .gallery { border-radius: 10px; width: 100%; max-width: 800px; aspect-ratio: 1 / 1; height: auto; margin: 0 auto; display: flex; align-items: center; justify-content: center; font-size: 120px; }
.pd .info h1 { font-size: 22px; line-height: 1.3; margin-bottom: 10px; }
.pd .rate-row { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.pd .price-box { background: var(--primary-light); border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; }
.pd .price-box .cur { color: var(--primary); font-size: 26px; font-weight: 800; }
.pd .price-box .orig { text-decoration: line-through; color: var(--text-3); font-size: 13px; margin-left: 10px; }
.pd .desc { color: var(--text-2); font-size: 14px; line-height: 1.7; margin-bottom: 20px; }
.pd .qty-row { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.qty { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.qty button { width: 34px; height: 34px; font-size: 16px; color: var(--text-2); }
.qty button:hover { background: var(--bg); }
.qty input { width: 46px; height: 34px; border: none; text-align: center; outline: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.pd .actions { display: flex; gap: 12px; }
.stock-info { color: var(--text-3); font-size: 12px; }

/* ===== 购物车 ===== */
.cart-table { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cart-head { display: grid; grid-template-columns: 1fr 120px 120px 120px 60px; padding: 12px 16px; background: #fafafa; color: var(--text-3); font-size: 12px; border-bottom: 1px solid var(--border); }
.cart-row { display: grid; grid-template-columns: 1fr 120px 120px 120px 60px; padding: 14px 16px; align-items: center; border-bottom: 1px solid var(--border); }
.cart-row:last-child { border-bottom: none; }
.cart-row .pinfo { display: flex; align-items: center; gap: 12px; }
.cart-row .pthumb { width: 60px; height: 60px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 30px; flex-shrink: 0; }
.cart-row .pname { font-size: 13px; }
.cart-row .del { color: var(--text-3); font-size: 18px; }
.cart-row .del:hover { color: var(--primary); }
.cart-foot { display: flex; align-items: center; justify-content: flex-end; gap: 20px; padding: 16px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-top: 14px; }
.cart-foot .tot { font-size: 15px; color: var(--text-2); }
.cart-foot .tot b { color: var(--primary); font-size: 24px; }
.empty { text-align: center; padding: 70px 0; color: var(--text-3); }
.empty .big { font-size: 70px; margin-bottom: 16px; }

/* ===== 结算 ===== */
.checkout { display: grid; grid-template-columns: 1fr 380px; gap: 18px; align-items: start; }
.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.panel h3 { font-size: 16px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.panel h3 .num { width: 22px; height: 22px; background: var(--primary); color: #fff; border-radius: 50%; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 12px; color: var(--text-2); }
.form-field input, .form-field textarea, .form-field select { padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; outline: none; }
.form-field input:focus, .form-field textarea:focus { border-color: var(--primary); }
.pay-opt { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; cursor: pointer; }
.pay-opt:hover { border-color: var(--primary); }
.pay-opt.active { border-color: var(--primary); background: var(--primary-light); }
.pay-opt .pico { font-size: 26px; }
.pay-opt .pt { font-weight: 600; }
.pay-opt .pdesc { font-size: 12px; color: var(--text-3); }
.pay-opt input[type=radio] { accent-color: var(--primary); }
.summary-line { display: flex; justify-content: space-between; padding: 8px 0; color: var(--text-2); }
.summary-line.total { font-size: 17px; font-weight: 700; color: var(--text); border-top: 1px dashed var(--border); margin-top: 8px; padding-top: 14px; }
.summary-line.total b { color: var(--primary); font-size: 22px; }
.summary-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.summary-item .st { width: 44px; height: 44px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.summary-item .si-name { font-size: 12px; flex: 1; }
.summary-item .si-price { font-size: 12px; color: var(--text-2); white-space: nowrap; }

/* ===== 成功页 ===== */
.success { max-width: 640px; margin: 40px auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 40px; text-align: center; }
.success .check { width: 72px; height: 72px; border-radius: 50%; background: var(--green); color: #fff; font-size: 38px; display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; }
.success h1 { font-size: 22px; margin-bottom: 8px; }
.success .no { color: var(--primary); font-weight: 700; font-size: 16px; }
.success .detail { text-align: left; margin-top: 22px; background: var(--bg); border-radius: 8px; padding: 18px; }
.success .detail .row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }

/* ===== 后台 ===== */
.admin-head { display: flex; align-items: center; justify-content: space-between; margin: 20px 0; }
.admin-head h1 { font-size: 20px; }
.tabs { display: flex; gap: 4px; background: #fff; border-radius: 8px; border: 1px solid var(--border); padding: 4px; width: fit-content; margin-bottom: 16px; }
.tabs button { padding: 8px 18px; border-radius: 6px; font-size: 13px; color: var(--text-2); }
.tabs button.active { background: var(--primary); color: #fff; }
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: 12px 14px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--border); }
.table th { background: #fafafa; color: var(--text-2); font-weight: 600; font-size: 12px; }
.table tr:last-child td { border-bottom: none; }
.table .temoji { font-size: 26px; }
.status { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.status.paid { background: #e6f7ee; color: var(--green); }
.status.pending { background: #fff4e6; color: #e67e22; }
.status.shipped { background: #e8f1ff; color: #2f6fdb; }
.status.completed { background: #efe9ff; color: #7a5af8; }
.status.cancelled { background: #f5f5f5; color: #999; }
.status.refunded { background: #fff4e6; color: #e67e22; }
.trend-toggle { padding: 5px 14px; border-radius: 5px; font-size: 12px; color: var(--text-2); }
.trend-toggle.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: var(--shadow); }
.of-select, .of-input { padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; outline: none; font-size: 13px; background: #fff; }
.of-select:focus, .of-input:focus { border-color: var(--primary); }
.of-input { width: 190px; }
.small-btn { padding: 5px 10px; font-size: 12px; border-radius: 6px; }

/* ===== 弹窗 / Toast ===== */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.modal-mask.open { display: flex; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 620px; max-height: 90vh; overflow: auto; padding: 24px; }
.modal h3 { font-size: 18px; margin-bottom: 18px; }
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.82); color: #fff; padding: 11px 20px; border-radius: 8px; font-size: 14px; z-index: 300; opacity: 0; pointer-events: none; transition: opacity .25s; }
.toast.show { opacity: 1; }

@media (max-width: 860px) {
  .pd { grid-template-columns: 1fr; }
  .checkout { grid-template-columns: 1fr; }
  .cart-head { display: none; }
  .cart-row { grid-template-columns: 1fr auto; gap: 8px; }
  .hero-card { padding: 22px; }
  .hero-card h1 { font-size: 20px; }
}

/* ===== 订单时间线 ===== */
.timeline { display: flex; margin: 6px 0 16px; }
.tl-step { flex: 1; text-align: center; position: relative; }
.tl-step:not(:last-child)::after { content: ''; position: absolute; top: 7px; left: 50%; width: 100%; height: 2px; background: var(--border); }
.tl-step.done:not(:last-child)::after { background: var(--green); }
.tl-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--border); margin: 0 auto 6px; position: relative; z-index: 1; }
.tl-step.done .tl-dot { background: var(--green); }
.tl-step.cur .tl-dot { background: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); }
.tl-label { font-size: 12px; color: var(--text-2); }
.tl-step.done .tl-label, .tl-step.cur .tl-label { color: var(--text); font-weight: 600; }
.tl-time { font-size: 10px; color: var(--text-3); margin-top: 2px; }
.tracking { background: #eef6ff; border: 1px solid #cfe3fb; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 12px; }

/* ===== 优惠券卡片 ===== */
.coupon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.coupon { display: flex; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.coupon .c-left { background: linear-gradient(135deg,var(--primary),var(--accent)); color: #fff; padding: 18px 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 104px; text-align: center; }
.coupon .c-left .amt { font-size: 22px; font-weight: 800; line-height: 1; }
.coupon .c-left .cond { font-size: 11px; opacity: .92; margin-top: 4px; }
.coupon .c-right { padding: 14px 16px; flex: 1; min-width: 0; }
.coupon .c-right .code { font-weight: 700; font-size: 15px; letter-spacing: .5px; color: var(--primary); }
.coupon .c-right .desc { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.coupon .c-right .site { font-size: 11px; color: var(--text-2); margin-top: 8px; }

/* ===== 商品图片/视频上传 ===== */
#imgUploadArea { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; cursor: pointer; }
#videoUploadArea { display: flex; flex-direction: column; gap: 8px; align-items: stretch; cursor: pointer; }
.up-thumb { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); flex-shrink: 0; }
.up-thumb img { width: 100%; height: 100%; object-fit: cover; }
.up-main { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(238,77,45,.88); color: #fff; font-size: 10px; text-align: center; padding: 2px 0; }
.up-del { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.up-add { width: 72px; height: 72px; border-radius: 8px; border: 1px dashed var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-3); flex-shrink: 0; }
.up-add:hover { border-color: var(--primary); color: var(--primary); }
.up-add span { font-size: 22px; line-height: 1; }
.up-add em { font-style: normal; font-size: 11px; }
.up-empty { color: var(--text-3); font-size: 12px; width: 100%; }

/* ===== 商品属性表 ===== */
.attr-table { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 18px; }
.attr-row { display: flex; border-bottom: 1px solid var(--border); }
.attr-row:last-child { border-bottom: none; }
.attr-row .attr-k { width: 130px; flex-shrink: 0; background: #fafafa; color: var(--text-2); font-size: 13px; padding: 10px 14px; }
.attr-row .attr-v { flex: 1; font-size: 13px; padding: 10px 14px; color: var(--text); }

/* ===== 买卖双方聊天界面 ===== */
.chat-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 14px; margin: 20px 0; height: calc(100vh - 150px); min-height: 520px; }
.chat-side { display: flex; flex-direction: column; overflow: hidden; }
.chat-side-head { font-weight: 700; font-size: 15px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.conv-list { flex: 1; overflow-y: auto; }
.conv-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; border-bottom: 1px solid var(--border); }
.conv-item:hover { background: #fafafa; }
.conv-item.active { background: var(--primary-light); }
.conv-emoji { width: 40px; height: 40px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.conv-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conv-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-last { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread-badge { background: var(--primary); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; font-weight: 700; flex-shrink: 0; }
.conv-empty { padding: 30px; text-align: center; color: var(--text-3); font-size: 13px; }
.seller-search { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.seller-search input { flex: 1; min-width: 0; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; outline: none; background: var(--bg); color: var(--text); }
.seller-search input:focus { border-color: var(--primary); }
#sellerSearchResult { max-height: 260px; overflow-y: auto; border-bottom: 1px solid var(--border); }
#sellerSearchResult .conv-item { background: #fffdf3; }

.chat-main { display: flex; flex-direction: column; overflow: hidden; }
.chat-main .chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-3); gap: 10px; }
.chat-empty .big { font-size: 56px; line-height: 1; }
#chatBody, #sellerChatBody { flex: 1; flex-direction: column; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat-head-emoji { width: 38px; height: 38px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.chat-head-meta { display: flex; flex-direction: column; }
.chat-head-meta b { font-size: 14px; }
.chat-head-meta em { font-style: normal; font-size: 12px; color: var(--text-3); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; background: var(--bg); display: flex; flex-direction: column; gap: 10px; }
.chat-msgs-empty { margin: auto; color: var(--text-3); font-size: 13px; }
.msg { display: flex; flex-direction: column; max-width: 70%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.msg .bubble { padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; word-break: break-word; }
.msg.mine .bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.theirs .bubble { background: #fff; color: var(--text); border-bottom-left-radius: 4px; box-shadow: var(--shadow); }
.msg-time { font-size: 10px; color: var(--text-3); margin-top: 4px; }
.chat-input { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); background: #fff; }
.emoji-toggle { font-size: 22px; padding: 4px 6px; border-radius: 8px; line-height: 1; }
.emoji-toggle:hover { background: var(--bg); }
.chat-input input { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; outline: none; font-size: 14px; }
.chat-input input:focus { border-color: var(--primary); }
.emoji-panel { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; padding: 12px 16px; border-top: 1px solid var(--border); background: #fff; max-height: 180px; overflow-y: auto; }
.emoji-panel button { font-size: 22px; padding: 4px; border-radius: 6px; line-height: 1; }
.emoji-panel button:hover { background: var(--bg); }

@media (max-width: 860px) {
  .chat-wrap { grid-template-columns: 1fr; height: auto; }
  .chat-side { max-height: 220px; }
}
