/* ===== 浮动球皮肤变量 ===== */
:root {
  --skin-color: #c2bebd;
  --skin-color-dark: #a09c9b;
  --skin-color-deeper: #7a7676;
  --skin-glow: rgba(194,190,189,0.5);
  --skin-glow-strong: rgba(194,190,189,0.3);
  --skin-glow-light: rgba(194,190,189,0.15);
}

/* ===== 浮动球 + 聊天面板 ===== */
.chat-ball-wrap {
  position: fixed; z-index: 900; cursor: grab; user-select: none;
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1);
  display: flex; align-items: center; gap: 0;
}
.chat-ball-wrap:active { cursor: grabbing; }
.chat-ball-wrap:hover { transform: scale(1.05); }
.chat-ball-wrap.dragging { transform: scale(1.12); opacity: 0.9; transition: none; }

.ball-core { position: relative; flex-shrink: 0; }

.particle-halo {
  position: absolute; top: 50%; left: 50%;
  width: 130px; height: 130px; margin: -65px 0 0 -65px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, var(--skin-glow-light) 0%, transparent 70%);
  animation: haloPulse 2s ease-in-out infinite;
}
@keyframes haloPulse {
  0%,100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
}

.chat-ball {
  position: relative; width: 96px; height: 96px; border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 35% 35%, var(--skin-color), var(--skin-color-dark) 60%, var(--skin-color-deeper));
  box-shadow: 0 0 30px var(--skin-glow), 0 0 60px var(--skin-glow-strong),
              inset 0 -4px 8px rgba(0,0,0,0.2), inset 0 4px 8px rgba(255,255,255,0.15);
  animation: ballFloat 3s ease-in-out infinite;
  cursor: pointer; z-index: 1; -webkit-tap-highlight-color: transparent; border: none;
}
@keyframes ballFloat {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.chat-ball-wrap.dragging .chat-ball { animation: none; }

.chat-ball::before {
  content: ''; position: absolute; width: 200%; height: 200%; top: -50%; left: -50%;
  background: conic-gradient(from 0deg, transparent, rgba(255,255,255,0.06), transparent 40%);
  animation: techSpin 5s linear infinite;
  pointer-events: none; z-index: 3; border-radius: 0; inset: auto; box-shadow: none;
}
@keyframes techSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.ball-skin {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%; z-index: 2; transition: transform 0.3s;
}
.chat-ball-wrap:hover .ball-skin { transform: scale(1.08); }

.tooltip {
  position: absolute; right: calc(100% + 16px); top: 50%; transform: translateY(-50%);
  background: rgba(15,23,42,0.95); color: #fff; backdrop-filter: blur(12px);
  border-radius: 16px; padding: 12px 18px; white-space: nowrap; font-size: 14px;
  font-weight: 500; letter-spacing: 0.3px; pointer-events: none;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  opacity: 0; transform: translateY(-50%) translateX(10px);
  transition: all 0.35s cubic-bezier(.34,1.56,.64,1);
}
.tooltip::after {
  content: ''; position: absolute; right: -6px; top: 50%; transform: translateY(-50%);
  border: 6px solid transparent; border-left-color: rgba(15,23,42,0.95);
}
.chat-ball-wrap:hover .tooltip {
  opacity: 1; transform: translateY(-50%) translateX(0);
}

.ripple {
  position: absolute; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.7);
  animation: rippleOut 0.8s ease-out forwards; pointer-events: none;
}
@keyframes rippleOut {
  from { width: 0; height: 0; opacity: 1; top: 50%; left: 50%; transform: translate(-50%,-50%); }
  to { width: 200px; height: 200px; opacity: 0; top: 50%; left: 50%; transform: translate(-50%,-50%); }
}

.todo-badge {
  position: absolute; top: -2px; right: -2px; width: 8px; height: 8px;
  background: var(--red, #dc2626); border-radius: 50%; display: none; z-index: 10;
  box-shadow: 0 0 4px rgba(220,38,38,.6);
}
.todo-badge.show { display: block; }

.chat-panel {
  position: fixed; bottom: 94px; right: 28px; width: 380px; max-height: 95vh;
  background: var(--glass, rgba(255,255,255,.72)); border-radius: var(--radius-lg, 20px);
  box-shadow: var(--shadow-lg, 0 14px 44px rgba(0,0,0,.1)); z-index: 901;
  display: none; flex-direction: column; overflow: hidden;
  border: 1px solid var(--glass-border, rgba(255,255,255,.55));
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  transition: opacity .25s var(--ease-out, cubic-bezier(.16,1,.3,1)),
              transform .25s var(--ease-out, cubic-bezier(.16,1,.3,1));
}
.chat-panel.show { display: flex; }

.chat-tab-bar {
  display: flex; width: 100%;
  background: linear-gradient(135deg, #0055A4, #003d7a); flex-shrink: 0;
}
.chat-drag-handle {
  display: flex; align-items: center; justify-content: center;
  width: 26px; flex-shrink: 0; cursor: grab; user-select: none;
  color: rgba(255,255,255,.4); font-size: 16px; line-height: 1;
}
.chat-drag-handle:hover { color: rgba(255,255,255,.75); }
.chat-drag-handle:active { cursor: grabbing; color: #fff; }

.chat-tab-btn {
  flex: 1; background: transparent; border: none; color: rgba(255,255,255,.65);
  cursor: pointer; font-size: 13px; font-weight: 500; padding: 12px 6px; text-align: center;
  transition: all .25s var(--ease-out, cubic-bezier(.16,1,.3,1));
  white-space: nowrap; position: relative; border-bottom: 2px solid transparent;
}
.chat-tab-btn:hover { color: #fff; background: rgba(255,255,255,.06); }
.chat-tab-btn.active { color: #fff; font-weight: 700; background: rgba(255,255,255,.1); border-bottom-color: #fff; }

.chat-tab-content { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.chat-tab-content.active { display: flex; }

.chat-panel-header {
  padding: 14px 18px; background: linear-gradient(135deg, #0055A4, #003d7a);
  color: #fff; display: flex; align-items: center; justify-content: space-between;
  cursor: move; user-select: none; font-size: 14px; flex-shrink: 0;
}
.chat-room-name { font-weight: 700; font-size: 14px; }
.chat-retention-tip { font-size: 10px; color: rgba(255,255,255,.65); font-weight: 400; }
.chat-header-btn {
  background: rgba(255,255,255,.1); border: none; color: rgba(255,255,255,.85);
  cursor: pointer; font-size: 18px; padding: 4px 10px; border-radius: 8px; line-height: 1;
  transition: background .2s;
}
.chat-header-btn:hover { background: rgba(255,255,255,.2); }
.chat-store-sel{
  margin-left:auto;margin-right:4px;height:26px;
  background:rgba(255,255,255,.15);color:#fff;border:1px solid rgba(255,255,255,.25);
  border-radius:6px;padding:0 8px;font-size:12px;cursor:pointer;
}
.chat-store-sel option{background:#fff;color:#222;}

.chat-messages {
  flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column;
  gap: 8px; max-height: 420px;
}
.chat-msg { display: flex; flex-direction: column; max-width: 85%; }
.chat-msg.user { align-self: flex-end; }
.chat-msg.bot { align-self: flex-start; }
.chat-sender { font-size: 10px; color: var(--text-muted, #64748b); margin-bottom: 2px; padding: 0 4px; }
.chat-msg.user .chat-sender { text-align: right; }
.chat-msg.bot .chat-sender { text-align: left; }
.chat-bubble {
  padding: 9px 14px; border-radius: 16px; font-size: 13px; line-height: 1.5;
  word-break: break-word; overflow: hidden;
}
.chat-msg.user .chat-bubble {
  background: var(--brand, #0055A4); color: #fff; border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,85,164,.18);
}
.chat-msg.bot .chat-bubble {
  background: rgba(241,245,249,.9); color: var(--text, #1a202c); border-bottom-left-radius: 4px;
}

.chat-input-area {
  display: flex; align-items: center; gap: 6px; padding: 10px 14px;
  border-top: 1px solid var(--glass-border, rgba(255,255,255,.55)); position: relative;
}
.chat-input {
  flex: 1; border: 1.5px solid var(--border, #e2e8f0); border-radius: 100px;
  padding: 9px 16px; font-size: 13px; font-family: inherit; outline: none;
  background: rgba(241,245,249,.6); color: var(--text, #1a202c);
  transition: all .25s var(--ease-out, cubic-bezier(.16,1,.3,1));
}
.chat-input:focus {
  border-color: var(--brand, #0055A4); background: var(--surface, #fff);
  box-shadow: 0 0 0 3px rgba(0,85,164,.08);
}
.chat-input-btn {
  background: none; border: none; color: var(--text-muted, #64748b); cursor: pointer;
  padding: 8px; border-radius: 50%; display: flex;
  transition: all .25s var(--ease-out, cubic-bezier(.16,1,.3,1));
}
.chat-input-btn:hover { color: var(--brand, #0055A4); background: var(--blue-light, rgba(0,85,164,.08)); }
.chat-time { font-size: 10px; color: var(--text-muted, #64748b); text-align: center; margin: 6px 0; }

.emoji-picker {
  position: absolute; bottom: 48px; left: 10px; transform: none; z-index: 300;
  background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius-sm, 10px); box-shadow: var(--shadow-lg, 0 14px 44px rgba(0,0,0,.1));
  padding: 8px; width: 280px; max-height: 200px; overflow-y: auto;
  display: none; grid-template-columns: repeat(8,1fr); gap: 2px;
}
.emoji-picker.show { display: grid; }
.emoji-picker span {
  cursor: pointer; font-size: 22px; text-align: center; padding: 4px; border-radius: 6px;
  transition: background .15s;
}
.emoji-picker span:hover { background: var(--blue-light, rgba(0,85,164,.08)); }

/* 记事面板 */
.notes-input-row {
  display: flex; gap: 8px; padding: 10px 14px;
  border-bottom: 1px solid var(--glass-border, rgba(255,255,255,.55));
}
.notes-input-row textarea {
  flex: 1; border: 1.5px solid var(--border, #e2e8f0); border-radius: 8px;
  padding: 8px 12px; font-size: 13px; font-family: inherit; resize: none; min-height: 56px;
  outline: none; background: rgba(241,245,249,.6); color: var(--text, #1a202c);
  transition: all .25s;
}
.notes-input-row textarea:focus {
  border-color: var(--brand, #0055A4); box-shadow: 0 0 0 3px rgba(0,85,164,.08);
}
.notes-input-row button {
  align-self: flex-end; white-space: nowrap; height: 36px; padding: 0 16px;
  background: var(--brand, #0055A4); color: #fff; border: none; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all .2s;
}
.notes-input-row button:hover { opacity: .9; }
.notes-list { flex: 1; overflow-y: auto; padding: 8px 0; max-height: 420px; }
.note-item {
  padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--glass-border, rgba(255,255,255,.55));
  transition: background .15s;
}
.note-item:hover { background: var(--blue-light, rgba(0,85,164,.08)); }
.note-item-preview { font-size: 13px; color: var(--text, #1a202c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-item-date { font-size: 11px; color: var(--text-muted, #64748b); margin-top: 3px; }
.note-empty { text-align: center; color: var(--text-muted, #64748b); padding: 40px; font-size: 13px; }

/* 待办面板 */
.todo-input-row {
  display: flex; gap: 6px; padding: 10px 14px;
  border-bottom: 1px solid var(--glass-border, rgba(255,255,255,.55)); flex-wrap: wrap;
}
.todo-input-row input[type=text] {
  flex: 1; min-width: 120px; border: 1.5px solid var(--border, #e2e8f0); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; font-family: inherit; outline: none;
  background: rgba(241,245,249,.6); color: var(--text, #1a202c); transition: all .25s;
}
.todo-input-row input[type=text]:focus {
  border-color: var(--brand, #0055A4); box-shadow: 0 0 0 3px rgba(0,85,164,.08);
}
.todo-input-row input[type=datetime-local] {
  border: 1.5px solid var(--border, #e2e8f0); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; font-family: inherit; outline: none; min-width: 140px;
  background: rgba(241,245,249,.6); color: var(--text, #1a202c);
}
.todo-input-row button {
  white-space: nowrap; height: 36px; padding: 0 14px;
  background: var(--brand, #0055A4); color: #fff; border: none; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all .2s;
}
.todo-input-row button:hover { opacity: .9; }
.todos-list { flex: 1; overflow-y: auto; padding: 4px 0; max-height: 420px; }
.todo-section-title {
  font-size: 11px; font-weight: 700; color: var(--text-muted, #64748b); padding: 8px 14px 4px;
  text-transform: uppercase; letter-spacing: .5px;
}
.todo-item {
  display: flex; align-items: flex-start; gap: 8px; padding: 8px 14px;
  border-bottom: 1px solid var(--glass-border, rgba(255,255,255,.55)); transition: background .15s;
}
.todo-item:hover { background: var(--blue-light, rgba(0,85,164,.08)); }
.todo-item input[type=checkbox] {
  margin-top: 3px; flex-shrink: 0; width: 16px; height: 16px; cursor: pointer;
  accent-color: var(--brand, #0055A4);
}
.todo-item-content { flex: 1; min-width: 0; }
.todo-item-text { font-size: 13px; color: var(--text, #1a202c); word-break: break-word; line-height: 1.5; }
.todo-item.done .todo-item-text { text-decoration: line-through; color: var(--text-muted, #64748b); }
.todo-item-due { font-size: 10px; color: var(--orange, #ea580c); margin-top: 2px; }
.todo-item.done .todo-item-due { color: var(--text-muted, #64748b); }
.todo-item-del {
  flex-shrink: 0; background: none; border: none; color: var(--text-muted, #64748b);
  cursor: pointer; font-size: 16px; padding: 2px 4px; border-radius: 4px; line-height: 1;
  transition: color .15s;
}
.todo-item-del:hover { color: var(--red, #dc2626); }
.todo-empty { text-align: center; color: var(--text-muted, #64748b); padding: 40px; font-size: 13px; }

/* @提及下拉 */
.mention-dropdown {
  position: absolute; bottom: 100%; left: 0; right: 0; margin-bottom: 4px;
  background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius-sm, 10px); box-shadow: var(--shadow, 0 6px 24px rgba(0,0,0,.07));
  max-height: 180px; overflow-y: auto; display: none; z-index: 100;
}
.mention-dropdown .mention-item {
  padding: 8px 12px; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 8px;
  transition: background .15s;
}
.mention-dropdown .mention-item:hover,
.mention-dropdown .mention-item.active { background: var(--blue-light, rgba(0,85,164,.08)); }
.mention-dropdown .mention-item .mention-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--brand, #0055A4); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.mention-tag { color: var(--brand, #0055A4); font-weight: 600; cursor: pointer; }

/* 聊天搜索行 */
.chat-search-row {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px;
  border-bottom: 1px solid var(--glass-border, rgba(255,255,255,.55)); flex-shrink: 0;
}

/* 响应式 */
@media (max-width: 768px) {
  .chat-panel {
    width: 100vw !important; right: 0 !important; left: 0 !important;
    border-radius: 16px 16px 0 0 !important; bottom: 0 !important;
  }
}

@media (max-width: 480px) {
  .chat-ball { width: 72px; height: 72px; }
  .particle-halo { width: 96px; height: 96px; margin: -48px 0 0 -48px; }
  .tooltip { display: none !important; }
}
