/* Roster web client — 骨架照抄 design/mockup.html，取色与度量保持一致。
   桌面上套一个 390×844 的手机壳，窄屏（真手机）直接全屏铺满。 */
:root {
  --wx-bg:        #EDEDED;   /* 聊天背景 & 导航栏，同色是微信的关键特征 */
  --wx-outgoing:  #95EC69;
  --wx-incoming:  #FFFFFF;
  --wx-sep:       #D9D9D9;
  --wx-gray:      #B2B2B2;   /* 微信的次要文字比通用 iOS 更浅 */
  --wx-red:       #FA5151;
  --wx-green:     #07C160;
  --wx-navline:   #D4D4D4;
  --wx-bar:       #F7F7F7;
  --wx-tab-off:   #7F7F7F;
  --safe-b:       env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: #1c1c1e; color: #000;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC", sans-serif;
  overscroll-behavior: none;
}
input, textarea, button { font: inherit; color: inherit; background: none; border: none; outline: none; }
/* UA 样式表的 [hidden] 只作用于 HTML 元素；输入栏里的加号/停止键是 <svg>，
   不补这条就永远藏不住（实测停止键在非流式状态下也一直亮着）。 */
[hidden] { display: none !important; }
input::placeholder, textarea::placeholder { color: #C7C7CC; }

.stage { height: 100%; display: flex; align-items: center; justify-content: center; }
.phone {
  width: 390px; height: 844px; background: #fff; border-radius: 44px; overflow: hidden;
  position: relative; box-shadow: 0 0 0 10px #2c2c2e, 0 18px 40px rgba(0,0,0,.5);
}
@media (max-width: 480px), (max-height: 860px) {
  .stage { align-items: stretch; }
  .phone { width: 100%; height: 100%; border-radius: 0; box-shadow: none; }
}

/* 状态栏：真机上系统自己有一条，这里只在桌面手机壳里显示 */
.status {
  height: 54px; display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 30px 5px; font-size: 14px; font-weight: 600; background: var(--wx-bg);
  position: absolute; inset: 0 0 auto 0; z-index: 5; transition: background .18s;
}
.status.white { background: #fff; }
@media (max-width: 480px) { .status { display: none; } }

/* 屏：堆叠，slide 的那几层从右边推进来 */
.screen {
  position: absolute; inset: 0; padding-top: 54px; display: flex; flex-direction: column;
  background: #fff; visibility: hidden;
}
.screen.on { visibility: visible; }
/* 推进来的屏必须盖住底座屏。靠 DOM 顺序不够：底座屏里 position:relative 的导航栏会
   抢到命中测试（实测新建页的 Save 被 Agents 页的 + 挡住），所以显式给 z-index。 */
.screen.slide { z-index: 10; transform: translateX(100%); transition: transform .26s cubic-bezier(.3,.7,.3,1), visibility .26s; }
.screen.slide.on { transform: translateX(0); }
@media (max-width: 480px) { .screen { padding-top: 0; } }

.nav {
  flex: 0 0 44px; background: var(--wx-bg); border-bottom: .5px solid var(--wx-navline);
  display: flex; align-items: center; padding: 0 14px; position: relative;
}
.nav.white { background: #fff; }
.nav-t { position: absolute; left: 60px; right: 60px; text-align: center; font-size: 17px; font-weight: 600;
         pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-l, .nav-r { font-size: 17px; z-index: 1; display: flex; align-items: center; gap: 4px; }
.nav-r { margin-left: auto; }
.nav-sub { font-size: 11px; color: #8A8A8E; font-weight: 400; display: block; margin-top: -2px; }
.back-t { font-size: 16px; }
.chev-l { width: 9px; height: 9px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor;
          transform: rotate(45deg); display: inline-block; margin-right: 1px; }
.strong { font-weight: 600; }
.green { color: var(--wx-green); }
.red { color: var(--wx-red); }
.tap { cursor: pointer; }
.tap:active { opacity: .55; }

.body { flex: 1; min-height: 0; position: relative; }
.tabview { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: none; }
.tabview.on { display: block; }

/* Tab bar */
.tabs {
  flex: 0 0 auto; background: var(--wx-bar); border-top: .5px solid var(--wx-sep);
  display: flex; padding: 6px 0 calc(6px + var(--safe-b));
}
.tab { flex: 1; text-align: center; font-size: 10px; color: var(--wx-tab-off); position: relative; cursor: pointer; padding-bottom: 4px; }
.tab svg { display: block; margin: 0 auto 2px; width: 27px; height: 27px; }
.tab svg .f { fill: var(--wx-tab-off); }
.tab svg .s { stroke: var(--wx-tab-off); }
.tab.on { color: var(--wx-green); }
.tab.on svg .f { fill: var(--wx-green); }
.tab.on svg .s { stroke: var(--wx-green); }
.tab .dot { position: absolute; top: 0; left: 50%; margin-left: 8px; width: 9px; height: 9px;
            border-radius: 50%; background: var(--wx-red); }

/* 头像：微信是近乎方的小圆角 */
.av { background: #D8D8D8; display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
      position: relative; user-select: none; }
.av48 { width: 48px; height: 48px; border-radius: 5px; font-size: 26px; }
.av40 { width: 40px; height: 40px; border-radius: 4px; font-size: 22px; }
.av64 { width: 64px; height: 64px; border-radius: 6px; font-size: 34px; }
.av .ub {
  position: absolute; top: -6px; right: -7px; background: var(--wx-red); color: #fff; font-size: 12px;
  font-weight: 600; border-radius: 10px; min-width: 20px; height: 20px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}

/* 会话列表：平铺白行 + 从头像右缘开始的缩进分割线 */
.rows { background: #fff; min-height: 100%; }
.row { display: flex; gap: 12px; padding: 10px 16px; position: relative; align-items: center; cursor: pointer; }
.row:active { background: #E5E5E5; }
.row::after { content:''; position: absolute; left: 76px; right: 0; bottom: 0; height: .5px; background: var(--wx-sep); }
.row:last-child::after { display: none; }
.rmid { flex: 1; min-width: 0; }
.rname { font-size: 17px; line-height: 1.25; }
.rprev { font-size: 14px; color: var(--wx-gray); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rtime { font-size: 12px; color: var(--wx-gray); align-self: flex-start; margin-top: 3px; white-space: nowrap; }

/* 聊天页 */
.chat { background: var(--wx-bg); height: 100%; display: flex; flex-direction: column; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 12px;
        display: flex; flex-direction: column; gap: 16px; }
.msgs > .pad { margin-top: auto; }  /* 消息少时贴底堆叠 */
.m { display: flex; gap: 10px; align-items: flex-start; }
.m.out { flex-direction: row-reverse; }
.bwrap { position: relative; max-width: 240px; }
.b { padding: 10px 12px; border-radius: 5px; font-size: 17px; line-height: 1.35; word-break: break-word; white-space: pre-wrap; }
.b.in  { background: var(--wx-incoming); }
.b.out { background: var(--wx-outgoing); }
.b.dim { color: #9B9B9B; }
/* 气泡尖角——微信最醒目的识别特征 */
.bwrap.in::before {
  content:''; position: absolute; left: -5px; top: 13px;
  border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-right: 6px solid var(--wx-incoming);
}
.bwrap.out::before {
  content:''; position: absolute; right: -5px; top: 13px;
  border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 6px solid var(--wx-outgoing);
}
.tstamp { text-align: center; font-size: 12px; color: #A6A6A6; margin: 2px 0; }
.cursor { display: inline-block; width: 8px; height: 18px; background: #000; vertical-align: -3px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.dots { display: flex; gap: 5px; padding: 4px 2px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: #B9B9B9; display: block; animation: hop 1.1s infinite; }
.dots i:nth-child(2) { animation-delay: .18s; }
.dots i:nth-child(3) { animation-delay: .36s; }
@keyframes hop { 0%,60%,100% { background: #B9B9B9; } 30% { background: #7D7D7D; } }
.tool { display: flex; align-items: center; gap: 5px; font-size: 13px; color: #9B9B9B; margin-bottom: 7px; cursor: pointer; }
.tool svg { flex: 0 0 auto; }
.toolist { font-size: 13px; color: #9B9B9B; line-height: 1.65; margin-bottom: 7px; white-space: normal; }
.warn { font-size: 12px; color: var(--wx-red); margin-top: 5px; cursor: pointer; }
.redot {
  width: 19px; height: 19px; border-radius: 50%; background: var(--wx-red); color: #fff; font-size: 14px;
  font-weight: 700; display: flex; align-items: center; justify-content: center; align-self: center; margin: 0 2px;
}

/* 富文本（markdown-lite） */
.b .md-code {
  background: #F4F4F4; border-radius: 4px; padding: 8px 10px; margin: 7px 0; overflow-x: auto;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13.5px; line-height: 1.5; color: #333;
  white-space: pre;
}
.b.out .md-code { background: rgba(255,255,255,.55); }
.b .md-ic { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14.5px;
            background: rgba(0,0,0,.055); border-radius: 3px; padding: 0 3px; }
.b .md-li { display: block; padding-left: 15px; text-indent: -15px; }
.b .md-h { font-weight: 600; display: block; margin: 4px 0 2px; }
.b .md-hr { border: none; border-top: .5px solid rgba(0,0,0,.15); margin: 8px 0; }
.b a { color: #576B95; text-decoration: none; }

/* 输入栏：左麦克风 / 右表情 + 加号，有字时加号变发送 */
.input {
  flex: 0 0 auto; background: var(--wx-bar); border-top: .5px solid var(--wx-sep);
  padding: 8px 10px calc(8px + var(--safe-b)); display: flex; gap: 10px; align-items: flex-end;
}
.ibtn { width: 28px; height: 28px; flex: 0 0 auto; margin-bottom: 4px; }
#btn-plus, #btn-stop { cursor: pointer; }
.field { flex: 1; background: #fff; border-radius: 5px; min-height: 36px; display: flex; align-items: center; padding: 6px 10px; }
.field textarea { width: 100%; font-size: 17px; line-height: 1.3; resize: none; max-height: 110px; overflow-y: auto; }
.sendbtn { background: var(--wx-green); color: #fff; font-size: 15px; font-weight: 500; padding: 7px 13px;
           border-radius: 5px; margin-bottom: 2px; flex: 0 0 auto; }

/* 分组表单（设置类页面） */
.grouped { background: #EFEFF4; min-height: 100%; padding: 16px 0 40px; position: absolute; inset: 0; overflow-y: auto; }
.sh { font-size: 13px; color: #8A8A8E; padding: 0 16px 7px; }
.sf { font-size: 13px; color: #8A8A8E; padding: 8px 16px 0; line-height: 1.5; }
.card { background: #fff; border-top: .5px solid var(--wx-sep); border-bottom: .5px solid var(--wx-sep); margin-bottom: 24px; }
.cell { padding: 13px 16px; font-size: 17px; display: flex; align-items: center; gap: 12px; position: relative; min-height: 50px; }
.cell + .cell::before { content:''; position: absolute; left: 16px; right: 0; top: 0; height: .5px; background: var(--wx-sep); }
.cell.agent + .cell.agent::before { left: 68px; }
.cell input { flex: 1; min-width: 0; }
.cell.center { justify-content: center; }
.val { margin-left: auto; color: var(--wx-gray); font-size: 16px; }
.val-left { color: #3B3B3B; font-size: 16px; }
.mid { flex: 1; min-width: 0; }
.nm { font-size: 17px; }
.tg { font-size: 13px; color: var(--wx-gray); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { margin-left: auto; width: 9px; height: 9px; flex: 0 0 auto; }
.signup-only { display: none; }
.mode-up .signup-only { display: flex; }

.seg { background: #E4E4E6; border-radius: 9px; padding: 2px; display: flex; margin: 0 16px 24px; }
.seg div { flex: 1; text-align: center; font-size: 13px; font-weight: 500; padding: 6px 0; border-radius: 7px; cursor: pointer; }
.seg div.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.erow { display: flex; gap: 11px; padding: 13px 16px; flex-wrap: wrap; }
.em { width: 46px; height: 46px; border-radius: 5px; background: #ECECEC; display: flex; align-items: center;
      justify-content: center; font-size: 27px; flex: 0 0 auto; cursor: pointer; }
.em.on { background: rgba(7,193,96,.16); box-shadow: inset 0 0 0 2px var(--wx-green); }
textarea.persona { padding: 13px 16px; font-size: 17px; line-height: 1.55; min-height: 200px; width: 100%;
                   resize: none; display: block; }

.empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
         gap: 12px; background: #fff; padding: 0 50px; text-align: center; }
.empty .t { font-size: 17px; font-weight: 500; }
.empty .s { font-size: 15px; color: var(--wx-gray); line-height: 1.5; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #DADADA; border-top-color: #9B9B9B;
        animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); z-index: 40;
  background: rgba(0,0,0,.76); color: #fff; font-size: 15px; line-height: 1.45; padding: 12px 16px;
  border-radius: 8px; max-width: 74%; text-align: center;
}
.sheet-mask { position: absolute; inset: 0; background: rgba(0,0,0,.4); z-index: 30; }
.sheet {
  position: absolute; left: 8px; right: 8px; bottom: calc(8px + var(--safe-b)); z-index: 31;
  display: flex; flex-direction: column; gap: 8px;
}
.sheet .grp { background: #fff; border-radius: 13px; overflow: hidden; }
.sheet .it { padding: 16px; text-align: center; font-size: 18px; cursor: pointer; position: relative; }
.sheet .it + .it::before { content:''; position: absolute; left: 0; right: 0; top: 0; height: .5px; background: var(--wx-sep); }
.sheet .it:active { background: #EDEDED; }
.sheet .cap { padding: 12px; text-align: center; font-size: 13px; color: #8A8A8E; }
