/* 飞梦中台 · AI 助手浮层样式（浅色，前缀 fma- 避免与 gz.css 冲突） */
.fma-fab {
  position: fixed; right: 22px; bottom: 26px; z-index: 9900;
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: grab;
  background: linear-gradient(135deg, #0f766e, #0d9488); color: #fff;
  box-shadow: 0 10px 26px rgba(13, 148, 136, .34), 0 2px 6px rgba(0,0,0,.12);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  transition: transform .15s ease, box-shadow .15s ease; touch-action: none; user-select: none;
}
.fma-fab:hover { transform: translateY(-2px) scale(1.03); }
.fma-fab:active { cursor: grabbing; }
.fma-fab .dot { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: #f59e0b; border: 2px solid #fff; display: none; }
.fma-fab.has-task .dot { display: block; }

.fma-panel {
  position: fixed; z-index: 9901; right: 22px; bottom: 94px;
  width: 440px; height: 620px; max-height: calc(100vh - 120px);
  background: #fff; border-radius: 16px; display: none; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .22), 0 2px 8px rgba(15,23,42,.08);
  border: 1px solid #e6ebf1; font-size: 13px; color: #1f2937;
}
.fma-panel.open { display: flex; }
.fma-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: move;
  background: linear-gradient(135deg, #0f766e, #14b8a6); color: #fff; flex: 0 0 auto;
}
.fma-head .t { font-weight: 700; font-size: 14px; }
.fma-head .m { font-size: 11px; opacity: .85; margin-left: 2px; }
.fma-head .sp { flex: 1; }
.fma-head button {
  border: 0; background: rgba(255,255,255,.16); color: #fff; width: 26px; height: 26px; border-radius: 8px;
  cursor: pointer; font-size: 14px; line-height: 1;
}
.fma-head button:hover { background: rgba(255,255,255,.3); }
.fma-tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid #eef2f6; flex: 0 0 auto; overflow-x: auto; }
.fma-tabs button {
  border: 0; background: transparent; padding: 7px 9px; border-radius: 8px 8px 0 0; cursor: pointer;
  font-size: 12px; color: #64748b; white-space: nowrap;
}
.fma-tabs button.on { background: #f0fdfa; color: #0f766e; font-weight: 700; box-shadow: inset 0 -2px 0 #14b8a6; }
.fma-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 12px; background: #fbfcfd; }
.fma-body::-webkit-scrollbar { width: 8px; }
.fma-body::-webkit-scrollbar-thumb { background: #d7dee7; border-radius: 4px; }

/* 对话 */
.fma-msgs { display: flex; flex-direction: column; gap: 10px; }
.fma-msg { display: flex; gap: 8px; }
.fma-msg .who { flex: 0 0 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.fma-msg.u .who { background: #e0f2fe; color: #0369a1; }
.fma-msg.a .who { background: #ccfbf1; color: #0f766e; }
.fma-bubble { background: #fff; border: 1px solid #e8eef4; border-radius: 12px; padding: 8px 10px; max-width: 100%; line-height: 1.6; word-break: break-word; }
.fma-msg.u .fma-bubble { background: #f1f8ff; border-color: #dbeafe; }
.fma-bubble p { margin: 0 0 6px; }
.fma-bubble p:last-child { margin-bottom: 0; }
.fma-bubble table { border-collapse: collapse; width: 100%; font-size: 12px; margin: 4px 0; }
.fma-bubble th, .fma-bubble td { border: 1px solid #e6ebf1; padding: 4px 6px; text-align: left; }
.fma-bubble th { background: #f7fafc; font-weight: 600; }
.fma-bubble code { background: #f1f5f9; padding: 1px 4px; border-radius: 4px; }
.fma-tool { font-size: 11px; color: #0f766e; background: #f0fdfa; border: 1px dashed #99f6e4; border-radius: 8px; padding: 3px 8px; display: inline-block; margin: 2px 4px 2px 0; }
.fma-tool.err { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
.fma-composer { display: flex; gap: 8px; padding: 8px 10px; border-top: 1px solid #eef2f6; background: #fff; flex: 0 0 auto; }
.fma-composer textarea {
  flex: 1; resize: none; height: 40px; max-height: 110px; border: 1px solid #dfe6ee; border-radius: 10px;
  padding: 9px 10px; font-size: 13px; font-family: inherit; outline: none; line-height: 1.4;
}
.fma-composer textarea:focus { border-color: #14b8a6; box-shadow: 0 0 0 3px rgba(20,184,166,.12); }
.fma-composer button {
  flex: 0 0 auto; border: 0; border-radius: 10px; background: #0f766e; color: #fff; padding: 0 16px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.fma-composer button[disabled] { background: #b6c2cf; cursor: not-allowed; }
.fma-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.fma-quick button { border: 1px solid #dbe7ef; background: #fff; color: #475569; border-radius: 999px; padding: 4px 10px; font-size: 11px; cursor: pointer; }
.fma-quick button:hover { border-color: #14b8a6; color: #0f766e; }

/* 通用卡片 / 表格 */
.fma-sec { background: #fff; border: 1px solid #e8eef4; border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.fma-sec h4 { margin: 0 0 8px; font-size: 13px; color: #0f172a; display: flex; align-items: center; gap: 6px; }
.fma-sec h4 .sub { font-weight: 400; color: #94a3b8; font-size: 11px; }
.fma-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fma-kpi .k { background: #f8fafc; border-radius: 10px; padding: 8px; text-align: center; }
.fma-kpi .k b { display: block; font-size: 15px; color: #0f766e; }
.fma-kpi .k span { font-size: 11px; color: #64748b; }
.fma-tb { width: 100%; border-collapse: collapse; font-size: 12px; }
.fma-tb th, .fma-tb td { padding: 5px 4px; border-bottom: 1px solid #f1f5f9; text-align: right; }
.fma-tb th:first-child, .fma-tb td:first-child { text-align: left; }
.fma-tb th { color: #64748b; font-weight: 600; background: #fafcfe; position: sticky; top: 0; }
.fma-tb tr:hover td { background: #f8fbfd; }
.fma-tb .bar { height: 5px; border-radius: 3px; background: #e6f6f2; overflow: hidden; min-width: 40px; }
.fma-tb .bar i { display: block; height: 100%; background: linear-gradient(90deg, #14b8a6, #0f766e); }
.fma-tb .nm { font-weight: 600; color: #0f172a; }
.fma-pill { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 10px; background: #f1f5f9; color: #475569; margin: 1px 3px 1px 0; }
.fma-pill.hot { background: #fef3c7; color: #92400e; }
.fma-pill.bad { background: #fee2e2; color: #b91c1c; }
.fma-pill.good { background: #dcfce7; color: #166534; }
.fma-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.fma-row .grow { flex: 1; }
.fma-inp, .fma-sel {
  border: 1px solid #dfe6ee; border-radius: 8px; padding: 6px 8px; font-size: 12px; outline: none; background: #fff; color: #1f2937;
}
.fma-inp:focus, .fma-sel:focus { border-color: #14b8a6; }
.fma-btn { border: 1px solid #dbe7ef; background: #fff; border-radius: 8px; padding: 6px 10px; font-size: 12px; cursor: pointer; color: #0f172a; }
.fma-btn:hover { border-color: #14b8a6; color: #0f766e; }
.fma-btn.pri { background: #0f766e; border-color: #0f766e; color: #fff; }
.fma-btn.pri:hover { background: #115e59; color: #fff; }
.fma-btn.ghost { border-color: transparent; color: #64748b; }
.fma-list { display: flex; flex-direction: column; gap: 6px; }
.fma-item { border: 1px solid #eef2f6; border-radius: 10px; padding: 8px; cursor: pointer; background: #fff; }
.fma-item:hover { border-color: #99f6e4; background: #f7fefc; }
.fma-item .t1 { font-weight: 600; font-size: 12px; color: #0f172a; display: flex; gap: 6px; align-items: center; }
.fma-item .t2 { font-size: 11px; color: #64748b; margin-top: 3px; line-height: 1.5; }
.fma-empty { text-align: center; color: #94a3b8; font-size: 12px; padding: 26px 10px; }
.fma-mask { position: fixed; inset: 0; background: rgba(15,23,42,.28); z-index: 9902; display: none; }
.fma-mask.on { display: block; }
.fma-modal { position: fixed; z-index: 9903; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 520px; max-width: 94vw; max-height: 84vh; background: #fff; border-radius: 14px; box-shadow: 0 24px 60px rgba(15,23,42,.28); display: none; flex-direction: column; overflow: hidden; }
.fma-modal.on { display: flex; }
.fma-modal .hd { padding: 10px 14px; border-bottom: 1px solid #eef2f6; font-weight: 700; display: flex; align-items: center; }
.fma-modal .bd { padding: 12px 14px; overflow-y: auto; }
.fma-modal .ft { padding: 10px 14px; border-top: 1px solid #eef2f6; display: flex; justify-content: flex-end; gap: 8px; }
.fma-modal textarea.fma-inp { width: 100%; min-height: 130px; resize: vertical; line-height: 1.55; }
.fma-fld { margin-bottom: 10px; }
.fma-fld label { display: block; font-size: 11px; color: #64748b; margin-bottom: 4px; }
.fma-fld .fma-inp, .fma-fld .fma-sel { width: 100%; }
.fma-hint { font-size: 11px; color: #94a3b8; line-height: 1.5; }

@media (max-width: 560px) {
  .fma-panel { width: calc(100vw - 16px); height: calc(100vh - 110px); right: 8px; bottom: 84px; }
  .fma-fab { right: 14px; bottom: 18px; }
  .fma-kpi { grid-template-columns: repeat(2, 1fr); }
}
