/* =============================================================
 * 小海 AI 教练台 · coach.css
 * 交互范式对齐 WorkBuddy / Codex：左侧会话栏 + 中间对话流 + 右侧面板
 * 底部大输入框（＋ / 分组 / 模型标识 / 发送箭头）
 * 视觉与app.css同源：清新蓝白、圆角卡片、海客橙点缀、光效绝不压字
 * ============================================================= */

.coach-shell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr) 266px;
  gap: 14px;
  align-items: start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 14px;
  min-height: 660px;
  min-width: 0;
}

/* ---------------- 左：会话栏 ---------------- */
.coach-side {
  border-right: 1px solid var(--line);
  padding-right: 12px;
  display: flex; flex-direction: column;
  min-height: 632px;
  min-width: 0;
}
.cs-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.cs-brand { display: flex; align-items: center; gap: 9px; }
.cs-brand img { width: 34px; height: 34px; object-fit: contain; border-radius: 10px; background: var(--orange-soft); }
.cs-brand span { font-size: 14px; font-weight: 800; }
.cs-new {
  width: 100%; padding: 9px; border-radius: 10px; background: var(--blue);
  color: #fff; font-size: 13px; font-weight: 700; transition: .18s;
}
.cs-new:hover { background: #2E5FE0; }
.cs-group-label {
  font-size: 10px; font-weight: 800; color: var(--ink-3);
  letter-spacing: 1px; margin: 4px 0 7px; text-transform: uppercase;
}
.cs-groups { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.cs-group {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 10px; border-radius: 10px; font-size: 13px; font-weight: 600;
  color: var(--ink-2); text-align: left; transition: .18s;
}
.cs-group span { font-size: 15px; }
.cs-group i {
  margin-left: auto; font-style: normal; font-size: 10px; color: var(--ink-3);
  background: #F1F5FC; padding: 1px 6px; border-radius: 5px;
}
.cs-group:hover { background: var(--card-soft); }
.cs-group.on { background: var(--blue-soft); color: var(--blue); font-weight: 800; }
.cs-group.on i { background: #DCE8FF; color: var(--blue); }
.cs-sessions { display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 60px; }
.cs-session {
  padding: 8px 10px; border-radius: 9px; font-size: 12px; color: var(--ink-2);
  display: flex; align-items: center; gap: 7px; transition: .18s; width: 100%; text-align: left;
}
.cs-session:hover { background: var(--card-soft); }
.cs-session.on { background: #F1F6FF; color: var(--blue); font-weight: 700; }
.cs-session .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex: 0 0 6px; }
.cs-session .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.cs-foot { margin-top: auto; padding-top: 12px; }
.cs-under { background: var(--card-soft); border: 1px solid var(--line); border-radius: var(--r-md); padding: 11px; }
.cs-under-t { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-2); margin-bottom: 7px; }
.cs-under-t b { color: var(--orange-2); font-family: var(--num); }
.cs-under p { margin: 7px 0 0; font-size: 10px; color: var(--ink-3); line-height: 1.55; }

/* ---------------- 中：对话流 ---------------- */
.coach-main {
  display: flex; flex-direction: column; min-height: 632px; min-width: 0;
  background: linear-gradient(170deg, #FBFDFF 0%, #F4F9FF 100%);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  overflow: hidden;
}
.cm-top {
  padding: 13px 16px; border-bottom: 1px solid var(--line); background: #fff;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.cm-title { display: flex; flex-direction: column; min-width: 0; }
.cm-title b { font-size: 14px; }
.cm-title span { font-size: 11px; color: var(--ink-3); }
.cm-badge {
  margin-left: auto; font-size: 10px; color: var(--green); font-weight: 700;
  background: var(--green-soft); border: 1px solid #CFF0E2; padding: 4px 9px;
  border-radius: 99px; white-space: nowrap;
}
.cm-stream {
  flex: 1; overflow-y: auto; padding: 18px 18px 8px;
  max-height: 470px; min-height: 330px;
}
.msg { display: flex; gap: 10px; margin-bottom: 16px; align-items: flex-start; }
.msg .m-av {
  width: 32px; height: 32px; border-radius: 10px; flex: 0 0 32px;
  background: #fff; border: 1px solid #FFE0C2;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.msg .m-av img { width: 28px; height: 28px; object-fit: contain; }
.msg .m-body { max-width: 88%; min-width: 0; }
.msg .m-name { font-size: 11px; color: var(--ink-3); margin-bottom: 4px; }
.msg .m-bubble {
  background: #fff; border: 1px solid var(--line); border-radius: 4px 14px 14px 14px;
  padding: 12px 14px; font-size: 13px; line-height: 1.75; color: var(--ink-2);
  box-shadow: 0 2px 8px rgba(38,78,150,.04); word-break: break-word;
}
.msg.me { flex-direction: row-reverse; }
.msg.me .m-av { background: var(--blue-soft); border-color: #CFDFFB; font-size: 14px; }
.msg.me .m-name { text-align: right; }
.msg.me .m-bubble { background: var(--blue); color: #fff; border-color: var(--blue); border-radius: 14px 4px 14px 14px; }
.m-bubble b { color: var(--ink); }
.msg.me .m-bubble b { color: #fff; }

/* 对话里的功能卡 */
.m-card {
  margin-top: 10px; background: var(--card-soft); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 13px; font-size: 12px;
}
.m-card h4 { margin: 0 0 9px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.m-card .mc-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.m-card .mc-row:last-child { border-bottom: none; }
.m-card .mc-row .mc-t { flex: 1; min-width: 0; line-height: 1.55; }
.m-card .mc-tag { font-size: 10px; padding: 2px 7px; border-radius: 99px; background: var(--orange-soft); color: var(--orange-2); font-weight: 700; white-space: nowrap; }
.m-card .mc-tag.g { background: var(--green-soft); color: var(--green); }
.m-card .mc-tag.b { background: var(--blue-soft); color: var(--blue); }
.btn-coach {
  margin-top: 9px; padding: 8px 13px; border-radius: 9px; background: var(--blue);
  color: #fff; font-size: 12px; font-weight: 700; transition: .18s;
}
.btn-coach:hover { background: #2E5FE0; }
.btn-coach.orange { background: var(--orange); }
.btn-coach.orange:hover { background: var(--orange-2); }
.btn-coach.line { background: #fff; color: var(--blue); border: 1px solid #CFDFFB; }

.cm-composer { padding: 12px 14px 14px; background: #fff; border-top: 1px solid var(--line); }
.cm-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 9px; }
.cm-chip {
  font-size: 11px; padding: 5px 10px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--card-soft); color: var(--ink-2); transition: .18s;
}
.cm-chip:hover { border-color: var(--blue-2); color: var(--blue); background: var(--blue-soft); }
.cm-inputbox {
  border: 1.5px solid #D9E5F8; border-radius: 16px; background: #fff;
  padding: 10px 12px 8px; box-shadow: 0 3px 14px rgba(38,78,150,.06); transition: .18s;
}
.cm-inputbox:focus-within { border-color: var(--blue-2); box-shadow: 0 4px 18px rgba(59,110,246,.14); }
.cm-plus {
  width: 26px; height: 26px; border-radius: 8px; background: #F1F5FC; color: var(--ink-2);
  font-size: 17px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 5px;
}
.cm-plus:hover { background: var(--blue-soft); color: var(--blue); }
.cm-inputbox textarea {
  width: 100%; border: none; outline: none; resize: none; background: transparent;
  font-size: 13px; line-height: 1.6; color: var(--ink); padding: 0 2px;
}
.cm-inputbox textarea::placeholder { color: #A6B4CB; }
.cm-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.cm-model { font-size: 11px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; }
.cm-send {
  margin-left: auto; width: 34px; height: 34px; border-radius: 50%;
  background: var(--blue); color: #fff; font-size: 15px; display: flex;
  align-items: center; justify-content: center; transition: .18s;
}
.cm-send:hover { background: #2E5FE0; transform: translateY(-1px); }
.cm-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 10px; color: var(--ink-3); }
.cm-meta span:last-child { margin-left: auto; }

/* ---------------- 右：画像 / 路线 ---------------- */
.coach-right { display: flex; flex-direction: column; gap: 12px; }
.cr-card { border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px; background: var(--card-soft); }
.cr-h { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 13px; font-weight: 800; }
.cr-edit { margin-left: auto; font-size: 11px; color: var(--blue); font-weight: 700; }
.cr-step { margin-left: auto; font-size: 11px; color: var(--ink-3); font-family: var(--num); font-weight: 700; white-space: nowrap; }
.cr-note { font-size: 11px; color: var(--ink-3); line-height: 1.65; margin: 0 0 9px; }
.p-field { margin-bottom: 9px; }
.p-field .pf-k { font-size: 10px; color: var(--ink-3); font-weight: 700; margin-bottom: 3px; }
.p-field .pf-v { font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.p-tag { display: inline-block; font-size: 10px; padding: 2px 7px; border-radius: 6px; margin: 0 4px 4px 0; background: #fff; border: 1px solid var(--line); color: var(--ink-2); }
.p-tag.good { background: var(--green-soft); border-color: #CFF0E2; color: #1E8B67; }
.p-tag.grow { background: var(--orange-soft); border-color: #FFE0C2; color: var(--orange-2); }
.p-empty { font-size: 11px; color: var(--ink-3); line-height: 1.7; }
.road-step { display: flex; gap: 9px; align-items: flex-start; padding: 6px 0; }
.road-step .rs-dot {
  width: 19px; height: 19px; border-radius: 50%; flex: 0 0 19px;
  border: 2px solid #D6E1F2; background: #fff; display: flex; align-items: center;
  justify-content: center; font-size: 10px; color: var(--ink-3); font-weight: 800;
}
.road-step.done .rs-dot { background: var(--green); border-color: var(--green); color: #fff; }
.road-step.now .rs-dot { border-color: var(--orange); color: var(--orange-2); }
.road-step .rs-t { font-size: 11px; line-height: 1.5; color: var(--ink-2); }
.road-step.done .rs-t { color: var(--green); }
.road-step.now .rs-t { font-weight: 800; color: var(--orange-2); }
.signal-row { display: flex; align-items: center; gap: 7px; font-size: 11px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.signal-row:last-child { border-bottom: none; }
.signal-row .sg-d { flex: 1; color: var(--ink-3); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signal-row .sg-n { color: var(--ink-2); font-weight: 600; }

/* 成长记录 */
.growth-item { display: flex; gap: 10px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--line); }
.growth-item:last-child { border-bottom: none; }
.growth-item .gi-ico { font-size: 18px; }
.growth-item .gi-b { flex: 1; min-width: 0; }
.growth-item .gi-b b { font-size: 13px; }
.growth-item .gi-b p { margin: 2px 0 0; font-size: 11px; color: var(--ink-3); }
.growth-item .gi-date { font-size: 11px; color: var(--ink-3); font-family: var(--num); white-space: nowrap; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1120px) {
  .coach-shell { grid-template-columns: 200px minmax(0, 1fr); }
  .coach-right { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); min-width: 0; }
}
@media (max-width: 760px) {
  .coach-shell { grid-template-columns: minmax(0, 1fr); padding: 10px; gap: 10px; }
  .coach-side { border-right: none; border-bottom: 1px solid var(--line); padding-right: 0; padding-bottom: 12px; min-height: 0; }
  /* 横向滚动容器必须封顶，否则会把 grid 的 1fr 撑破 */
  .cs-groups, .cs-sessions {
    min-width: 0; max-width: 100%; width: 100%;
    overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .cs-head, .cs-group-label, .cs-foot { min-width: 0; max-width: 100%; }
  .cs-groups { flex-direction: row; gap: 6px; padding-bottom: 4px; }
  .cs-group { width: auto; flex: 0 0 auto; padding: 7px 11px; font-size: 12px; }
  .cs-group i { display: none; }
  .cs-sessions { flex-direction: row; gap: 6px; }
  .cs-session { flex: 0 0 auto; width: auto; }
  .cs-session .t { max-width: 110px; }
  .cs-foot { margin-top: 10px; }
  .coach-main { min-height: 520px; min-width: 0; }
  .cm-stream { max-height: 340px; min-height: 260px; padding: 14px 12px 6px; }
  .cm-badge { margin-left: 0; }
  .coach-right { grid-column: auto; grid-template-columns: minmax(0, 1fr); min-width: 0; }
  .cm-meta span:last-child { margin-left: 0; }
  .cm-inputbox, .cm-chips, .cm-meta { min-width: 0; max-width: 100%; }
  .cm-stream .m-body { max-width: 82%; }
}
