/* BrainsGauge Care · 用户端
   设计系统与商城首页 (deploy/mall/index.html) 对齐：
   纸白底 #F6F8FB、墨蓝文字 #16233B、咨询绿 #2E9E77 主色、Inter/Space Grotesk 字族。 */

:root{
  --bg:#F6F8FB;
  --surface:#FFFFFF;
  --surface-2:#EEF1F6;
  --bubble-user:#2E9E77;
  --bubble-user-text:#FFFFFF;
  --accent:#2E9E77;
  --accent-soft:#E6F5EE;
  --text:#16233B;
  --text-2:#4A5872;
  --text-dim:#93A0B5;
  --line:#E4E9F1;
  --live:#3ECF8E;
  --danger:#D14343;

  --r-lg:22px;
  --r-md:16px;
  --shadow-card:0 2px 10px rgba(22,35,59,.05), 0 12px 34px rgba(22,35,59,.06);
  --shadow-bubble:0 1px 3px rgba(22,35,59,.05), 0 6px 18px rgba(22,35,59,.045);
  --font:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI','Noto Sans Thai','Malgun Gothic',
         'PingFang SC','Microsoft YaHei',system-ui,sans-serif;
  --font-disp:'Space Grotesk','Inter',system-ui,sans-serif;
}

*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{
  font-family:var(--font);
  background:var(--bg);
  color:var(--text);
  font-size:16px;
  line-height:1.62;
  -webkit-font-smoothing:antialiased;
  overflow:hidden;
}
button{font-family:inherit;cursor:pointer;border:none;background:none;color:inherit}
input,textarea{font-family:inherit;font-size:inherit;color:inherit;border:none;
  outline:none;background:none}
svg{width:100%;height:100%;display:block}
[hidden]{display:none !important}

/* ══════════════════════ 邮箱门槛 ══════════════════════ */

.gate{position:fixed;inset:0;z-index:100;display:grid;place-items:center;padding:24px}
.gate-bg{
  position:absolute;inset:0;
  background:
    radial-gradient(60% 45% at 18% 12%, #E9EDF4 0%, transparent 60%),
    radial-gradient(55% 45% at 85% 82%, #E2F2EB 0%, transparent 62%),
    var(--bg);
}
.gate-card{
  position:relative;width:100%;max-width:420px;
  background:var(--surface);border-radius:26px;
  padding:56px 34px 30px;text-align:center;
  box-shadow:var(--shadow-card);
  animation:rise .5s cubic-bezier(.22,.9,.3,1) both;
}
@keyframes rise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}

.gate-avatar{
  position:absolute;top:-38px;left:50%;transform:translateX(-50%);
  width:76px;height:76px;border-radius:50%;overflow:hidden;
  border:4px solid var(--surface);background:var(--surface-2);
  box-shadow:0 6px 18px rgba(22,35,59,.10);
}
.gate-avatar img{width:100%;height:100%;object-fit:cover}
.gate-title{font-size:24px;font-weight:600;letter-spacing:.4px}
.gate-sub{margin-top:10px;font-size:15px;color:var(--text-dim);line-height:1.7}

.field{
  display:flex;align-items:center;gap:11px;
  margin-top:28px;padding:0 16px;height:54px;
  background:var(--surface-2);border-radius:var(--r-md);
  border:1.5px solid transparent;transition:border-color .18s, background .18s;
}
.field:focus-within{border-color:var(--bubble-user);background:#FAFBFD}
.field.err{border-color:var(--danger);background:#F0FAF5}
.field-icon{width:19px;height:19px;color:var(--text-dim);flex:none}
.field input{flex:1;font-size:16px;min-width:0}
.field input::placeholder{color:#B4BFCE}
.field-error{
  min-height:20px;margin-top:7px;font-size:13.5px;color:var(--danger);
  text-align:left;padding-left:2px;
}

.btn-primary{
  width:100%;height:54px;margin-top:4px;
  background:var(--accent);color:#fff;
  border-radius:var(--r-md);font-size:16.5px;font-weight:500;letter-spacing:1px;
  display:flex;align-items:center;justify-content:center;gap:10px;
  box-shadow:0 6px 16px rgba(200,125,90,.24);
  transition:transform .14s, box-shadow .18s, opacity .18s;
}
.btn-primary:hover{box-shadow:0 8px 22px rgba(200,125,90,.3)}
.btn-primary:active{transform:translateY(1px)}
.btn-primary[disabled]{opacity:.6;cursor:default}
.btn-spin{
  width:17px;height:17px;border:2px solid rgba(255,255,255,.35);
  border-top-color:#fff;border-radius:50%;animation:spin .7s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg)}}
.gate-foot{margin-top:16px;font-size:12.5px;color:#A7B2C4}

/* 语言选择：低调地放在门槛页底部。
   进房之后不再提供 —— 咨询师是谁在建会话时就定了，不该聊到一半换人。 */
.lang-pick{
  margin-top:18px;display:inline-flex;align-items:center;gap:6px;
  color:#A7B2C4;
}
.lang-pick[hidden]{display:none}
.lang-pick svg{width:15px;height:15px;flex:none;opacity:.85}
.lang-pick select{
  appearance:none;-webkit-appearance:none;
  background:transparent;border:none;outline:none;
  font-family:inherit;font-size:12.5px;color:#7A88A0;
  padding:4px 18px 4px 2px;cursor:pointer;border-radius:6px;
  background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23BDB5AA' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 2px center;
  background-size:11px;
}
.lang-pick select:hover{color:#3C4A66}
.lang-pick select:focus-visible{outline:2px solid #2E9E77;outline-offset:2px}

/* ══════════════════════ 主布局 ══════════════════════ */

.app{height:100%;display:flex;flex-direction:column;position:relative}

.side{display:none}

/* ── 对话区 ── */
.chat{flex:1;display:flex;flex-direction:column;min-height:0;min-width:0}

.chat-head{
  display:flex;align-items:center;gap:12px;flex:none;
  padding:10px 14px;padding-top:calc(10px + env(safe-area-inset-top));
  background:rgba(255,255,255,.86);backdrop-filter:blur(14px);
  border-bottom:1px solid var(--line);z-index:5;
}
.icon-btn{
  width:38px;height:38px;flex:none;padding:9px;border-radius:12px;
  color:var(--text-2);transition:background .16s;
}
.icon-btn:hover{background:var(--surface-2)}
.head-avatar{
  width:42px;height:42px;border-radius:50%;object-fit:cover;flex:none;
  background:var(--surface-2);
}
.head-meta{flex:1;min-width:0}
.head-name{font-size:16.5px;font-weight:600;letter-spacing:.3px}
.head-status{
  display:flex;align-items:center;gap:6px;
  font-size:13px;color:var(--text-dim);margin-top:1px;
}
.dot-live{
  width:7px;height:7px;border-radius:50%;background:var(--live);flex:none;
  box-shadow:0 0 0 3px rgba(111,168,107,.16);
}

/* ── 消息流 ── */
.stream{
  flex:1;overflow-y:auto;overscroll-behavior:contain;
  padding:20px 16px 8px;
  display:flex;flex-direction:column;gap:4px;
  scroll-behavior:smooth;
}
.stream::-webkit-scrollbar{width:7px}
.stream::-webkit-scrollbar-thumb{background:#D8DFEA;border-radius:4px}
.stream::-webkit-scrollbar-track{background:transparent}

.row{display:flex;gap:9px;align-items:flex-end;max-width:100%}
.row.me{flex-direction:row-reverse}
.row + .row{margin-top:9px}
.row.same{margin-top:3px}

.row-avatar{
  width:32px;height:32px;border-radius:50%;object-fit:cover;flex:none;
  background:var(--surface-2);margin-bottom:2px;
}
.row-avatar.ghost{visibility:hidden}

.bubble{
  max-width:min(76%, 560px);
  padding:11px 15px;
  border-radius:var(--r-lg);
  font-size:16px;line-height:1.66;
  word-break:break-word;white-space:pre-wrap;
  animation:pop .34s cubic-bezier(.22,.9,.3,1) both;
}
@keyframes pop{from{opacity:0;transform:translateY(8px) scale(.985)}to{opacity:1;transform:none}}

.row.them .bubble{
  background:var(--surface);color:var(--text);
  border-bottom-left-radius:7px;
  box-shadow:var(--shadow-bubble);
}
.row.them.same .bubble{border-bottom-left-radius:var(--r-lg)}
.row.me .bubble{
  background:var(--bubble-user);color:var(--bubble-user-text);
  border-bottom-right-radius:7px;
}
.row.crisis .bubble{
  background:#F0FAF5;color:#A83232;
  border:1px solid #F0D6CC;box-shadow:none;
}

.stamp{
  font-size:11.5px;color:#A7B2C4;margin:5px 0 0 41px;
  letter-spacing:.3px;
}
.row.me + .stamp{text-align:right;margin:5px 0 0 0}

/* 正在输入 */
/* 等待时只改顶栏那行状态字（微信式）。
   原来那个「聊天流里跳三个点的气泡」已删除 —— 那是 AI 聊天产品的标志，
   真人 IM 和电商客服都不会在对话区伪造一条对方的气泡。 */
.head-status .is-typing{color:var(--accent,#2E9E77);animation:statusFade 1.6s ease-in-out infinite}
@keyframes statusFade{0%,100%{opacity:1}50%{opacity:.45}}
@keyframes blink{
  0%,72%,100%{opacity:.32;transform:translateY(0)}
  36%{opacity:1;transform:translateY(-3.5px)}
}

.day-sep{
  align-self:center;margin:6px 0 14px;
  font-size:12.5px;color:var(--text-dim);
  background:rgba(255,255,255,.7);padding:4px 13px;border-radius:20px;
}

/* ── 输入区 ── */
.composer{
  flex:none;padding:10px 14px;
  padding-bottom:calc(12px + env(safe-area-inset-bottom));
  background:rgba(255,255,255,.9);backdrop-filter:blur(14px);
  border-top:1px solid var(--line);
}
.composer-box{
  display:flex;align-items:flex-end;gap:9px;
  background:var(--surface-2);border-radius:24px;
  padding:6px 6px 6px 18px;
  border:1.5px solid transparent;transition:border-color .18s;
}
.composer-box:focus-within{border-color:#CBD4E2;background:#FAFBFD}
.composer textarea{
  flex:1;resize:none;max-height:120px;font-size:16px;line-height:1.55;
  padding:9px 0;min-width:0;
}
.composer textarea::placeholder{color:#A7B2C4}
.send-btn{
  width:42px;height:42px;flex:none;padding:11px;border-radius:50%;
  background:var(--accent);color:#fff;
  box-shadow:0 4px 12px rgba(200,125,90,.26);
  transition:transform .14s, opacity .18s;
}
.send-btn:active{transform:scale(.93)}
/* 禁用态保持品牌色，只降透明度 —— 灰块会让整条输入栏失焦 */
.send-btn[disabled]{opacity:.38;box-shadow:none;cursor:default}
.composer-hint{
  min-height:17px;margin-top:6px;padding-left:4px;
  font-size:12.5px;color:var(--text-dim);
}

/* ══════════════════════ 报告面板 ══════════════════════ */

.report-head{display:flex;align-items:center;justify-content:space-between}
.side-block-title{font-size:15.5px;font-weight:600;letter-spacing:.3px}

.report-card{
  background:var(--surface);border-radius:var(--r-lg);
  padding:20px;margin-top:14px;box-shadow:var(--shadow-bubble);
}
.report-meta{font-size:13.5px;color:var(--text-dim);line-height:1.9}
.report-meta b{color:var(--text-2);font-weight:500}

.ring-wrap{display:grid;place-items:center;margin:18px 0 14px}
.ring{position:relative;width:150px;height:150px}
.ring svg{transform:rotate(-90deg)}
/* 数字必须**自己**落在圆心上。
   原来是两行一起居中，整体中心对上了，但那个大数字被顶高 33px ——
   人眼看的是数字，读出来就是"没对准"。
   办法：两个子元素叠在同一个网格单元里，数字正中，标签用位移压到下方。 */
.ring-core{
  position:absolute;inset:0;display:grid;place-items:center;text-align:center;
}
.ring-core > *{grid-area:1 / 1}
.ring-score{
  font-size:38px;font-weight:600;line-height:1;
  /* letter-spacing 会在最后一个字符后面也留一格，把整体推向左边。
     补一个等量的左内边距抵消掉。 */
  letter-spacing:-.5px;padding-left:.5px;
}
.ring-pct{font-size:19px;font-weight:500;margin-left:1px;opacity:.65}
.ring-label{
  font-size:12.5px;color:var(--text-dim);
  transform:translateY(32px);white-space:nowrap;
}

.conclusion{
  background:var(--accent-soft);border-radius:14px;
  padding:13px 15px;font-size:14px;line-height:1.72;color:#1F7A5A;
}
.dims{margin-top:18px;display:flex;flex-direction:column;gap:14px}
.dim-top{display:flex;justify-content:space-between;align-items:baseline;
  font-size:14px;margin-bottom:6px}
.dim-name{color:var(--text-2)}
.dim-val{font-weight:600;font-size:14.5px}
.bar{height:7px;background:var(--surface-2);border-radius:4px;overflow:hidden}
.bar span{display:block;height:100%;border-radius:4px;
  background:var(--bubble-user);transition:width .8s cubic-bezier(.2,.8,.3,1)}
.bar.warn span{background:var(--accent)}

.report-empty{
  margin-top:16px;padding:26px 18px;text-align:center;
  background:var(--surface);border-radius:var(--r-lg);
  font-size:14px;color:var(--text-dim);line-height:1.8;
  box-shadow:var(--shadow-bubble);
}
.report-foot{margin-top:16px;font-size:12px;color:#A7B2C4;text-align:center}

.scrim{
  position:fixed;inset:0;background:rgba(22,35,59,.34);
  opacity:0;pointer-events:none;transition:opacity .26s;z-index:8;
}
.scrim.on{opacity:1;pointer-events:auto}

/* ══════════════════════ 移动端：报告抽屉 ══════════════════════ */

@media (max-width:1023px){
  .side-right{
    display:block;position:fixed;top:0;right:0;bottom:0;z-index:9;
    width:min(86vw,380px);padding:22px 20px;
    padding-top:calc(22px + env(safe-area-inset-top));
    background:var(--bg);overflow-y:auto;
    transform:translateX(100%);transition:transform .3s cubic-bezier(.3,.9,.3,1);
    box-shadow:-8px 0 30px rgba(22,35,59,.1);
  }
  .side-right.open{transform:none}
}

/* ══════════════════════ PC：三栏 ══════════════════════ */

@media (min-width:1024px){
  body{padding:22px;background:
    radial-gradient(70% 50% at 10% 0%, #EDF0F6 0%, transparent 55%),
    radial-gradient(60% 50% at 95% 100%, #E6F5EE 0%, transparent 58%), var(--bg);}
  .only-mobile{display:none !important}
  .scrim{display:none}

  .app{
    flex-direction:row;gap:18px;
    max-width:1720px;margin:0 auto;height:100%;
  }
  .side{
    display:flex;flex-direction:column;flex:none;
    background:var(--surface);border-radius:26px;
    box-shadow:var(--shadow-card);overflow-y:auto;
  }
  .side-left{width:clamp(258px, 19vw, 320px);padding:24px 20px}
  .side-right{width:clamp(292px, 22vw, 372px);padding:24px 22px;
    background:var(--surface);transform:none}

  .chat{
    background:var(--surface);border-radius:26px;
    box-shadow:var(--shadow-card);overflow:hidden;
  }
  .chat-head{padding:18px 26px;background:transparent;border-bottom:1px solid var(--line)}
  .head-avatar{width:44px;height:44px}
  .stream{padding:26px 30px 10px;gap:5px}
  .bubble{max-width:min(70%,620px)}
  .composer{padding:14px 26px 22px;background:transparent}
  .composer-box{border-radius:20px}

  /* 左栏 */
  .brand{display:flex;align-items:center;gap:11px;padding:2px 4px 22px}
  .brand-mark{
    width:38px;height:38px;flex:none;padding:8px;border-radius:12px;
    background:var(--surface-2);color:var(--bubble-user);
  }
  .brand-name{font-size:16.5px;font-weight:600;letter-spacing:.5px}
  .brand-sub{font-size:11.5px;color:var(--text-dim);margin-top:1px}

  .counselor-card{
    text-align:center;padding:22px 16px;
    background:var(--surface-2);border-radius:20px;
  }
  .counselor-avatar{
    width:92px;height:92px;border-radius:50%;object-fit:cover;
    border:4px solid var(--surface);box-shadow:0 4px 14px rgba(22,35,59,.09);
  }
  .counselor-name{font-size:19px;font-weight:600;margin-top:12px;letter-spacing:.5px}
  .counselor-title{font-size:13px;color:var(--text-dim);margin-top:3px}
  .tags{display:flex;flex-wrap:wrap;gap:6px;justify-content:center;margin-top:13px}
  .tag{
    font-size:12px;padding:4px 11px;border-radius:20px;
    background:var(--surface);color:var(--text-2);
  }
  .counselor-note{
    font-size:13px;color:var(--text-dim);line-height:1.75;
    margin-top:13px;text-align:left;
  }

  .side-block{margin-top:24px}
  .session-item{
    display:flex;align-items:center;gap:10px;
    padding:12px 13px;border-radius:14px;margin-top:10px;
    background:var(--surface-2);
  }
  .session-item.active{background:#E8F5EF}
  .session-item-name{font-size:14px;font-weight:500}
  .session-item-time{font-size:12px;color:var(--text-dim);margin-top:1px}
}

@media (min-width:1600px){
  .stream{padding:30px 44px 12px}
  .bubble{font-size:16.5px}
}

/* ══════════════ 未解锁报告引导 ══════════════ */

.locked{animation:rise .34s cubic-bezier(.22,.9,.3,1) both}
.locked-icon{
  width:56px;height:56px;margin:6px auto 16px;padding:14px;
  border-radius:50%;background:var(--accent-soft);color:var(--accent);
}
.locked-title{font-size:19px;font-weight:600;letter-spacing:.3px}
.locked-desc{
  margin:10px 0 24px;font-size:14.5px;color:var(--text-dim);line-height:1.75;
}
.locked .btn-primary{text-decoration:none}
.btn-text{
  display:block;width:100%;margin-top:14px;padding:8px;
  font-size:14px;color:var(--text-dim);transition:color .16s;
}
.btn-text:hover{color:var(--text-2)}


/* ══════════════ 进入咨询室的系统提示 ══════════════
   不是聊天气泡 —— 这是系统状态。咨询师不主动开口，等来访者先说。 */

.room-notice{
  align-self:center;text-align:center;
  padding:22px 24px;max-width:min(90%,420px);
  animation:pop .4s cubic-bezier(.22,.9,.3,1) both;
}
/* 有消息之后收窄，让它退回成一条普通的分隔提示 */
.stream.started .room-notice{padding:6px 24px 14px}
.rn-main{
  display:inline-flex;align-items:center;gap:8px;
  font-size:14px;color:var(--text-2);letter-spacing:.2px;
}
.rn-dot{
  width:6px;height:6px;border-radius:50%;background:var(--live);flex:none;
  box-shadow:0 0 0 3px rgba(111,168,107,.16);
}
.rn-hint{
  margin-top:7px;font-size:13px;color:var(--text-dim);line-height:1.7;
}
/* 空对话时整个流垂直居中；第一条消息一发出就切回顶部对齐。
   不能给 .room-notice 用 margin:auto —— 那样它会一直把自己推到中间，
   把后面的消息全挤到下面去。 */
.stream.empty{justify-content:center}


/* ---- BrainsGauge 融入补丁 ---- */
.brand-name, .gate-title, .counselor-name, .head-name{font-family:var(--font-disp);letter-spacing:-.01em}
