* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f3f5f9;
  color: #1f2937;
}
a { color: inherit; text-decoration: none; }

/* ---- 顶栏 ---- */
.topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid #e5e9f2;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #0052d9, #2778ff);
  color: #fff; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.brand .name { font-weight: 600; color: #0f172a; }
.user { display: flex; align-items: center; gap: 10px; }
.user .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #0052d9; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.uname { font-size: 14px; font-weight: 600; }
.urole { font-size: 12px; color: #6b7280; }

/* ---- 工作台 ---- */
.workbench { max-width: 1180px; margin: 0 auto; padding: 28px; }
.hero {
  background: linear-gradient(135deg, #0052d9 0%, #2778ff 100%);
  color: #fff; border-radius: 14px;
  padding: 28px 32px;
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  box-shadow: 0 10px 24px rgba(0,82,217,.18);
  margin-bottom: 24px;
}
.hero h1 { font-size: 24px; margin-bottom: 6px; }
.hero p { opacity: .92; max-width: 600px; }
.hint {
  background: rgba(255,255,255,.16);
  border-radius: 10px;
  padding: 14px 18px;
  max-width: 360px;
}
.hint-title { font-size: 13px; opacity: .8; margin-bottom: 6px; }
.hint-quote { font-size: 14px; line-height: 1.5; }

.grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px;
  margin-bottom: 24px;
}
.tile {
  position: relative;
  background: #fff; border: 1px solid #e5e9f2;
  border-radius: 12px; padding: 18px;
  cursor: pointer; transition: .15s;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.06); }
.tile .ico { font-size: 28px; margin-bottom: 8px; }
.tile .t { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.tile .d { font-size: 12px; color: #6b7280; }
.tile .badge {
  position: absolute; top: 10px; right: 10px;
  background: #ef4444; color: #fff;
  font-size: 11px; font-weight: 600;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(239,68,68,.4);
}
.tile .badge.show { display: inline-flex; }

.bizboard {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.bcol {
  background: #fff; border: 1px solid #e5e9f2;
  border-radius: 12px; padding: 20px 24px;
}
.bcol h3 { font-size: 15px; margin-bottom: 10px; color: #0f172a; }
.todo li {
  list-style: none; padding: 8px 0;
  border-bottom: 1px dashed #eef0f6; font-size: 13px;
}
.todo li:last-child { border-bottom: none; }
.muted { color: #94a3b8; font-size: 12px; }

@media (max-width: 920px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .bizboard { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: flex-start; }
  .hint { max-width: 100%; }
}

/* ---- Agent 对话挂件 ---- */
.fab {
  position: fixed; right: 28px; bottom: 28px; z-index: 50;
  background: linear-gradient(135deg, #0052d9, #2778ff);
  color: #fff; border: none; border-radius: 999px;
  padding: 12px 20px;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 24px rgba(0,82,217,.36);
  cursor: pointer; font-size: 14px; font-weight: 600;
}
.fab-icon { font-size: 18px; }

.agent-panel {
  position: fixed; right: 28px; bottom: 92px; z-index: 50;
  width: 420px; height: 620px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 16px 36px rgba(0,0,0,.18);
  display: flex; flex-direction: column;
  overflow: hidden;
  border: 1px solid #e5e9f2;
}
.agent-panel.hidden { display: none; }

.agent-header {
  background: linear-gradient(135deg, #0052d9, #2778ff);
  color: #fff;
  padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.ah-left { display: flex; align-items: center; gap: 10px; }
.ah-title { font-size: 14px; font-weight: 600; }
.ah-status { font-size: 11px; opacity: .85; }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 8px rgba(255,255,255,.5);
}
.dot.connected { background: #22c55e; }
.dot.connecting { background: #fbbf24; animation: pulse 1.5s infinite; }
.dot.error { background: #ef4444; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .4 } }

.ah-actions button {
  background: rgba(255,255,255,.18);
  color: #fff; border: none;
  width: 28px; height: 28px; border-radius: 6px;
  margin-left: 6px; cursor: pointer; font-size: 14px;
}
.ah-actions button:hover { background: rgba(255,255,255,.32); }

.messages {
  flex: 1; overflow-y: auto; padding: 16px;
  background: #f7f9fc;
}
.msg { margin-bottom: 12px; display: flex; }
.msg-bot .bubble {
  background: #fff; border: 1px solid #e5e9f2;
  border-radius: 12px 12px 12px 4px;
  padding: 10px 14px; max-width: 88%;
  font-size: 13px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word;
}
.msg-user { justify-content: flex-end; }
.msg-user .bubble {
  background: #0052d9; color: #fff;
  border-radius: 12px 12px 4px 12px;
  padding: 10px 14px; max-width: 80%;
  font-size: 13px; line-height: 1.6;
}
.msg-tool { justify-content: center; }
.msg-tool .bubble {
  background: #fef3c7; color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 6px 12px; font-size: 12px;
  font-family: "SF Mono", Consolas, monospace;
}
.msg-tool.ok .bubble { background: #dcfce7; border-color: #bbf7d0; color: #166534; }
.msg-tool.err .bubble { background: #fee2e2; border-color: #fecaca; color: #991b1b; }

.bubble code {
  background: rgba(0,0,0,.06);
  padding: 1px 5px; border-radius: 3px;
  font-family: "SF Mono", Consolas, monospace; font-size: 12px;
}
.bubble pre {
  background: #0f172a; color: #e2e8f0;
  padding: 8px 10px; border-radius: 6px;
  font-size: 12px; overflow-x: auto;
  margin: 6px 0;
}
.bubble strong { color: #0f172a; }
.msg-bot .bubble h1, .msg-bot .bubble h2, .msg-bot .bubble h3 {
  margin: 8px 0 4px; font-size: 14px;
}

.composer {
  border-top: 1px solid #e5e9f2;
  padding: 10px;
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 8px; align-items: flex-end;
  background: #fff;
}
.composer textarea {
  resize: none; height: 56px; padding: 8px 10px;
  border: 1px solid #d1d9e6; border-radius: 8px;
  font-size: 13px; font-family: inherit;
}
.composer textarea:disabled { background: #f4f5f8; color: #9ca3af; }
.composer button {
  border: none; cursor: pointer;
  padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
}
.composer .primary {
  background: #0052d9; color: #fff;
}
.composer .primary:hover { background: #003eaf; }
.composer .primary:disabled { background: #94a3b8; cursor: not-allowed; }
.composer button:not(.primary) {
  background: #f1f5f9; color: #0f172a;
}
.composer button:not(.primary):disabled { color: #94a3b8; cursor: not-allowed; }

.agent-footer {
  text-align: center; font-size: 11px; color: #94a3b8;
  padding: 6px 0; border-top: 1px solid #f1f5f9;
}
