/* 猫导对话页：聊天框是主操控面，经营数据/巡店/内容都以卡片回到对话里。 */

body[data-page="chat"] { overflow: hidden; }

.chat-main {
  height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-shell {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.chat-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 0 16px;
  border-bottom: 1px solid var(--line-soft);
  flex: none;
}

.chat-kicker {
  font-size: 10px;
  letter-spacing: 2.5px;
  color: var(--muted);
}

.chat-title {
  margin-top: 5px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.5px;
}

.chat-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.chat-head-side {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
  padding-bottom: 2px;
}

.chat-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}

.chat-online .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

.chat-link {
  font-size: 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
}

.chat-link:hover { color: var(--ink); border-color: var(--ink); }

.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 4px 8px;
  scroll-behavior: smooth;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 8px;
}

.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg.user { justify-content: flex-end; }

.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--black);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  flex: none;
  margin-top: 2px;
}

.msg-body { max-width: none; min-width: 0; flex: 1; }

.msg-name {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin: 0 0 5px 2px;
}

.bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px 14px 14px 4px;
  padding: 13px 16px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.user .bubble {
  background: var(--black);
  border-color: var(--black);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
  max-width: 640px;
}

.msg-time {
  margin-top: 5px;
  font-size: 10px;
  color: var(--faint);
}

.msg.user .msg-time { text-align: right; }

/* ── 对话内卡片 ────────────────────────────────────────────────────── */
.chat-cards { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }

.chat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
}

.cc-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.cc-title { font-size: 13px; font-weight: 600; }
.cc-meta { font-size: 10px; color: var(--muted); }

.cc-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.cc-kpi {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px 12px;
}

.cc-kpi-num {
  font-size: 24px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}

.cc-kpi-lab { margin-top: 2px; font-size: 10px; color: var(--muted); }

.cc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}

.cc-row:last-child { border-bottom: 0; padding-bottom: 0; }
.cc-row:first-child { padding-top: 0; }

.cc-main { flex: 1; min-width: 0; }

.cc-t {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cc-s {
  margin-top: 1px;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cc-time { flex: none; font-size: 10px; color: var(--faint); font-variant-numeric: tabular-nums; }

.cc-chip {
  height: 20px;
  line-height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 9px;
  flex: none;
}

.cc-chip.published { background: var(--black); color: #fff; }
.cc-chip.failed { background: #f8ecea; color: var(--danger); }

.cc-sev {
  height: 20px;
  line-height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 9px;
  flex: none;
}

.cc-sev.critical { background: var(--black); color: #fff; }
.cc-sev.warn { border: 1px solid var(--ink); }
.cc-sev.info { background: var(--surface-2); color: var(--muted); }

.cc-status { font-size: 10px; color: var(--muted); flex: none; }
.cc-status.pending { color: var(--ink); }
.cc-status.resolved, .cc-status.closed { color: var(--ok); }
.cc-status.processing { color: var(--warn); }

.cc-cams {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.cc-cam { border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden; }
.cc-cam img { width: 100%; height: 86px; object-fit: cover; display: block; background: var(--surface-2); }
.cc-cam-meta { padding: 6px 8px 8px; font-size: 10px; }
.cc-cam-meta b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-cam-meta span { color: var(--muted); }

.cc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.cc-btn {
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 11px;
  transition: background .12s ease, border-color .12s ease;
}

.cc-btn:hover { background: var(--surface-2); }
.cc-btn.primary { background: var(--black); border-color: var(--black); color: #fff; }
.cc-btn.primary:hover { background: #000; }

.cc-empty { padding: 18px 0; text-align: center; font-size: 11px; color: var(--muted); }

/* ── 输入区 ────────────────────────────────────────────────────────── */
.composer-wrap {
  flex: none;
  padding: 10px 0 18px;
  border-top: 1px solid var(--line-soft);
  background: var(--bg);
}

.suggest {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0 9px;
  scrollbar-width: none;
}

.suggest::-webkit-scrollbar { display: none; }

.suggest-chip {
  flex: none;
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 11px;
  white-space: nowrap;
}

.suggest-chip:hover { background: var(--surface-2); }

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 7px 7px 7px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color .12s ease;
}

.composer:focus-within { border-color: var(--ink); }

.composer textarea {
  flex: 1;
  min-height: 30px;
  max-height: 140px;
  padding: 5px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}

.composer textarea::placeholder { color: var(--faint); }
.composer textarea:focus-visible { outline: none; }

.send-btn {
  flex: none;
  height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 9px;
  background: var(--black);
  color: #fff;
  font-size: 12px;
}

.send-btn:disabled { opacity: .35; cursor: not-allowed; }

.composer-hint {
  margin-top: 6px;
  text-align: center;
  font-size: 9px;
  letter-spacing: .4px;
  color: var(--faint);
}

/* 输入中 */
.typing { display: inline-flex; gap: 4px; align-items: center; height: 20px; }
.typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  animation: tb 1.1s infinite ease-in-out;
}
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }

@keyframes tb {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

@media (max-width: 900px) {
  .chat-shell { padding: 0 14px; }
  .chat-head { padding: 14px 0 12px; }
  .chat-title { font-size: 19px; }
  .chat-sub { display: none; }
  .chat-head-side { display: none; }
  .chat-scroll { padding: 14px 0 6px; }
  .msg-body { max-width: calc(100vw - 74px); }
  .msg.user .bubble { max-width: calc(100vw - 82px); }
  .cc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cc-cams { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .composer-wrap { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}

/* 写文案 / 检查清单 / 工具目录 */
.cc-copy-prod { font-size: 11px; color: var(--muted); }
.cc-copy-hook { margin-top: 4px; font-size: 13px; font-weight: 600; }
.cc-script { margin-top: 10px; border-top: 1px solid var(--line-soft); }

.cc-script > div {
  display: flex;
  gap: 9px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
  line-height: 1.6;
}

.cc-script > div:last-child { border-bottom: 0; }
.cc-script span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
  display: grid;
  place-items: center;
  flex: none;
  margin-top: 1px;
}

.cc-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cc-tool {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  font: inherit;
  transition: background .12s ease, border-color .12s ease;
}

.cc-tool:hover { background: var(--surface-2); border-color: var(--line); }
.cc-tool b { display: block; font-size: 12px; font-weight: 500; }
.cc-tool span { display: block; margin-top: 1px; font-size: 10px; color: var(--muted); }
