/* ============ AideeHub 全局样式（微信 / iOS 风格） ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* 产品视觉固定为浅色 iCloud 风格，不跟随系统深色外观 */
:root { color-scheme: only light; }
html, body, #app { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #4D8DFF 0%, #2F6BFF 48%, #1E55E8 100%);
  color: #1a1a1a; font-size: 15px;
}
#app { width: 100%; margin: 0 auto; position: relative; background: transparent; }
/* 聊天页全屏；管理面板保留居中面板 */
.admin {
  max-width: 920px; margin: 0 auto; box-shadow: 0 0 60px rgba(9, 34, 96, .45);
}
@media (min-width: 768px) {
  .bubble { max-width: 65%; }
}
/* 手机：卡片贴边、气泡稍宽 */
@media (max-width: 420px) {
  .home-main { padding: 12px 12px 26px; }
  .user-card { padding: 12px 13px; }
  .uc-avatar { width: 46px; height: 46px; font-size: 24px; }
  .agent-grid { grid-template-columns: 1fr; }
  .chat-body, .chat-input-bar { padding-left: 8px; padding-right: 8px; }
  .bubble { max-width: 78%; }
}
button { font-family: inherit; cursor: pointer; border: none; }
input, textarea, select { font-family: inherit; font-size: 15px; outline: none; }
.hidden { display: none !important; }

/* ============ 登录页（星空渐变 + 白卡片，多设备自适应） ============ */
.login-wrap {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 32px 20px;
  position: relative; overflow: hidden;
  color: #1d1d1f;
}
/* 星空粒子 */
.login-stars, .login-particles { position: absolute; inset: 0; pointer-events: none; }
.login-stars i {
  position: absolute; width: 3px; height: 3px; border-radius: 50%;
  background: rgba(255,255,255,.8); animation: twinkle 3s infinite;
}
.login-stars i:nth-child(1) { left:12%; top:18%; animation-delay:.2s; }
.login-stars i:nth-child(2) { left:30%; top:70%; width:2px; height:2px; animation-delay:1.1s; }
.login-stars i:nth-child(3) { left:55%; top:12%; animation-delay:.6s; }
.login-stars i:nth-child(4) { left:70%; top:55%; width:2px; height:2px; animation-delay:1.8s; }
.login-stars i:nth-child(5) { left:85%; top:25%; animation-delay:.9s; }
.login-stars i:nth-child(6) { left:22%; top:40%; width:2px; height:2px; animation-delay:2.4s; }
.login-stars i:nth-child(7) { left:44%; top:85%; animation-delay:1.4s; }
.login-stars i:nth-child(8) { left:88%; top:78%; width:2px; height:2px; animation-delay:.4s; }
@keyframes twinkle { 0%,100% { opacity:.15; } 50% { opacity:.9; } }
/* 彩色漂浮光斑 */
.login-particles i {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  filter: blur(1px); opacity: .55; animation: floaty 9s ease-in-out infinite;
}
.login-particles i:nth-child(1) { left:16%; top:30%; background:#0A69F6; }
.login-particles i:nth-child(2) { left:74%; top:22%; background:#14B47D; animation-delay:2s; }
.login-particles i:nth-child(3) { left:62%; top:76%; background:#0A69F6; animation-delay:4s; }
.login-particles i:nth-child(4) { left:34%; top:82%; background:#F5B14C; animation-delay:1s; }
@keyframes floaty { 0%,100% { transform:translateY(0); } 50% { transform:translateY(-18px); } }

.login-icon {
  width: 74px; height: 74px; border-radius: 18px; margin-bottom: 22px;
  background: #fff center / 86% no-repeat padding-box;
  background-image: url("/assets/logo_icon.svg");
  box-shadow: 0 8px 28px rgba(0,0,0,.35); position: relative; z-index: 1;
}
.login-card {
  width: 100%; max-width: 420px; background: #fff; border-radius: 24px;
  padding: 30px 28px 26px; position: relative; z-index: 1;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-title { font-size: 24px; font-weight: 700; text-align: center; color: #1d1d1f; }
.login-sub { font-size: 14px; color: #86868B; text-align: center; margin: 6px 0 22px; }
.input-group { border: 1px solid #D2D2D7; border-radius: 14px; overflow: hidden; margin-bottom: 16px; }
.input-group .ig-row { display: flex; align-items: center; }
.input-group .ig-row + .ig-row { border-top: 1px solid #E5E5EA; }
.input-group label { width: 72px; flex-shrink: 0; font-size: 15px; color: #1d1d1f; padding-left: 16px; }
.input-group input { flex: 1; border: none; padding: 14px 14px 14px 6px; background: transparent; color: inherit; }
.input-group input:focus { background: rgba(10,105,246,.05); }
.login-opts { display: flex; align-items: center; font-size: 14px; color: #555; margin-bottom: 18px; }
.login-opts label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.login-opts input { width: 16px; height: 16px; accent-color: #1E6FEB; }
.btn-primary {
  width: 100%; padding: 13px; color: #fff; border-radius: 14px;
  font-size: 16px; font-weight: 600; letter-spacing: 4px; text-indent: 4px;
  background: linear-gradient(135deg, #3D7BFF 0%, #1E6FEB 60%, #1557C8 100%);
  box-shadow: 0 6px 18px rgba(30,111,235,.4); transition: transform .15s, box-shadow .15s;
}
.btn-primary:hover { box-shadow: 0 8px 22px rgba(30,111,235,.5); }
.btn-primary:active { transform: scale(.98); }
.login-err { color: #E30000; font-size: 13px; text-align: center; min-height: 18px; margin-top: 12px; }
.login-foot { position: relative; z-index: 1; margin-top: 26px; font-size: 12px; line-height: 1.7;
  color: rgba(255,255,255,.75); text-align: center; }

/* 小屏手机：卡片更贴边、内边距收紧 */
@media (max-width: 420px) {
  .login-wrap { padding: 20px 14px; }
  .login-card { padding: 24px 18px 20px; border-radius: 20px; }
  .login-title { font-size: 21px; }
  .input-group label { width: 60px; font-size: 14px; }
  .login-icon { width: 64px; height: 64px; }
}
/* 登录卡片保持 iCloud 式浅色，不随系统外观变暗 */

/* ============ 启动页（iPadOS 仪表盘风格） ============ */
.home { height: 100%; display: flex; flex-direction: column; }
.home-topbar {
  flex-shrink: 0; height: 54px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: rgba(255,255,255,.92); backdrop-filter: blur(20px);
  box-shadow: 0 1px 0 rgba(0,0,0,.08); z-index: 5;
}
.home-topbar .tb-left { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; color: #1d1d1f; min-width: 0; }
.home-topbar .tb-left span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-topbar .tb-logo {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: #fff center / 88% no-repeat; background-image: url("/assets/logo_icon.svg");
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.home-topbar .tb-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tb-iconbtn { width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.05); font-size: 16px; }
.home-main {
  flex: 1; overflow-y: auto; position: relative; padding: 18px 18px 34px;
}
/* 宽屏下内容居中收窄，背景仍铺满 */
.home-main > .user-card, .home-main > .sec-title, .home-main > .agent-grid {
  width: 100%; max-width: 1080px; margin-left: auto; margin-right: auto;
}
.home-stars { position: absolute; inset: 0; pointer-events: none; }
.home-stars i {
  position: absolute; width: 3px; height: 3px; border-radius: 50%;
  background: rgba(255,255,255,.8); animation: twinkle 3s infinite;
}
.home-stars i:nth-child(1) { left: 8%; top: 12%; }
.home-stars i:nth-child(2) { left: 30%; top: 6%; width: 2px; height: 2px; animation-delay: 1s; }
.home-stars i:nth-child(3) { left: 58%; top: 18%; animation-delay: .5s; }
.home-stars i:nth-child(4) { left: 80%; top: 9%; width: 2px; height: 2px; animation-delay: 1.6s; }
.home-stars i:nth-child(5) { left: 90%; top: 40%; animation-delay: .8s; }
.home-stars i:nth-child(6) { left: 15%; top: 55%; width: 2px; height: 2px; animation-delay: 2.2s; }
.user-card {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 13px;
  background: rgba(255,255,255,.96); border-radius: 18px; padding: 14px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); margin-bottom: 18px;
}
.uc-avatar {
  width: 54px; height: 54px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 28px; color: #fff;
  background-size: cover; background-position: center;
}
.uc-main { flex: 1; min-width: 0; }
.uc-name { font-size: 17px; font-weight: 700; color: #1d1d1f; }
.uc-sub { font-size: 12.5px; color: #86868B; margin-top: 2px; }
.sec-title {
  position: relative; z-index: 1; color: rgba(255,255,255,.92); font-size: 13px;
  font-weight: 600; margin: 0 auto 10px; letter-spacing: .5px;
}
.agent-grid {
  position: relative; z-index: 1; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.agent-card {
  display: flex; align-items: center; gap: 13px; cursor: pointer;
  background: rgba(255,255,255,.97); border-radius: 16px; padding: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,.16); transition: transform .15s, box-shadow .15s;
}
.agent-card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,.22); }
.agent-card:active { transform: scale(.98); }
.ag-icon {
  width: 52px; height: 52px; border-radius: 13px; flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-size: 28px; color: #fff;
  background-size: cover; background-position: center; box-shadow: inset 0 0 0 1px rgba(0,0,0,.04);
}
.ag-main { flex: 1; min-width: 0; }
.ag-name { font-size: 15px; font-weight: 700; color: #1d1d1f; }
.ag-desc { font-size: 12.5px; color: #86868B; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-go { font-size: 22px; color: #C7C7CC; font-weight: 600; }
.home-main .empty { color: rgba(255,255,255,.75); padding: 40px 0; }

/* ============ 微信风格聊天页 ============ */
.chat {
  height: 100%; display: flex; background: #EDEDED;
  position: relative; overflow: hidden;
}
.chat-main {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
  transition: margin-left .25s ease;
}
/* 抽屉式对话记录侧栏（仿智谱清言） */
.conv-sidebar {
  position: absolute; top: 0; bottom: 0; left: 0; width: 300px; max-width: 82%;
  background: #fff; z-index: 20; display: flex; flex-direction: column;
  transform: translateX(-102%); transition: transform .25s ease;
  box-shadow: 8px 0 30px rgba(9, 34, 96, .18);
}
.chat.sidebar-open .conv-sidebar { transform: none; }
.chat.sidebar-open .chat-main { margin-left: 300px; }
@media (max-width: 640px) {
  .conv-sidebar { width: 80%; }
  .chat.sidebar-open .chat-main { margin-left: 0; }
}
.cs-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 10px; flex-shrink: 0;
}
.cs-head span { font-size: 15px; font-weight: 700; color: #1d1d1f; }
.cs-list { flex: 1; overflow-y: auto; padding: 0 8px 14px; }
.conv-item {
  display: flex; align-items: center; gap: 8px; padding: 10px 10px;
  border-radius: 10px; cursor: pointer; margin-bottom: 2px;
}
.conv-item:hover { background: #F2F3F7; }
.conv-item.on { background: #E8F0FF; }
.conv-item .ci-main { flex: 1; min-width: 0; }
.conv-item .ci-title { font-size: 14px; color: #1d1d1f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .ci-time { font-size: 11px; color: #999; margin-top: 2px; }
.conv-item .ci-del {
  visibility: hidden; background: none; color: #999; font-size: 13px;
  padding: 2px 5px; flex-shrink: 0;
}
.conv-item:hover .ci-del { visibility: visible; }
.conv-item .ci-del:hover { color: #E64340; }
.hdr-btn {
  width: 32px; height: 32px; border-radius: 50%; background: rgba(0,0,0,.05);
  font-size: 15px; margin-left: 6px; flex-shrink: 0; line-height: 1;
}
.chat-header {
  flex-shrink: 0; height: 50px; background: #EDEDED; border-bottom: 1px solid #DCDCDC;
  display: flex; align-items: center; padding: 0 12px; gap: 10px;
  position: sticky; top: 0; z-index: 5;
}
.chat-header .back { font-size: 20px; color: #1a1a1a; background: none; padding: 4px 8px 4px 0; }
.chat-header .chat-avatar { width: 32px; height: 32px; border-radius: 6px; display: flex;
  align-items: center; justify-content: center; font-size: 18px; color: #fff;
  background-size: cover; background-position: center; flex-shrink: 0; }
.chat-header .chat-title { flex: 1; font-size: 16px; font-weight: 600; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.chat-body { flex: 1; overflow-y: auto; padding: 14px 12px 20px; }
.chat-body .time-tip { text-align: center; color: #B2B2B2; font-size: 12px; margin: 10px 0; }
.msg-row { display: flex; margin-bottom: 16px; align-items: flex-start; gap: 10px; }
.msg-row.self { flex-direction: row-reverse; }
.msg-avatar { width: 40px; height: 40px; border-radius: 5px; flex-shrink: 0; display: flex;
  align-items: center; justify-content: center; font-size: 22px; color: #fff;
  background-size: cover; background-position: center; }
.bubble {
  max-width: 72%; padding: 10px 13px; border-radius: 6px; line-height: 1.55;
  word-break: break-word; font-size: 15px; position: relative; text-align: left;
}
.msg-row.other .bubble { background: #fff; }
.msg-row.self .bubble { background: #95EC69; }
.bubble .corner {
  position: absolute; top: 13px; width: 0; height: 0;
  border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.msg-row.other .corner { left: -5px; border-right: 6px solid #fff; }
.msg-row.self .corner { right: -5px; border-left: 6px solid #95EC69; }
.chat-input-bar {
  flex-shrink: 0; background: #F7F7F7; border-top: 1px solid #DCDCDC;
  padding: 8px 10px; display: flex; gap: 8px; align-items: flex-end;
}
.chat-input-bar textarea {
  flex: 1; resize: none; border: 1px solid #e0e0e0; border-radius: 6px;
  padding: 9px 10px; max-height: 100px; line-height: 1.4; background: #fff;
}
.btn-send {
  padding: 9px 16px; color: #fff; border-radius: 8px; font-size: 15px; flex-shrink: 0;
  background: linear-gradient(135deg, #3D7BFF, #1E6FEB); font-weight: 600;
}
.btn-send:disabled { background: #c4c4c4; box-shadow: none; }
.btn-attach {
  width: 38px; height: 38px; border-radius: 8px; background: #fff; border: 1px solid #e0e0e0;
  font-size: 19px; color: #555; flex-shrink: 0; line-height: 1;
}
.chat-attach-bar { display: flex; gap: 8px; flex-wrap: wrap; padding: 6px 10px 0; }
.chat-attach-bar .thumb { position: relative; width: 58px; height: 58px; border-radius: 8px; overflow: hidden; }
.chat-attach-bar .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-attach-bar .thumb .rm {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}
.bubble img.msg-img {
  max-width: 100%; max-height: 220px; border-radius: 6px; display: block; margin: 4px 0; cursor: zoom-in;
}
.typing-text { color: #999; font-size: 14px; display: inline-flex; align-items: center; gap: 5px; }
.typing-text .d { animation: blink 1.2s infinite; }
.typing-text .d:nth-child(2) { animation-delay: .2s; }
.typing-text .d:nth-child(3) { animation-delay: .4s; }
.img-viewer {
  position: absolute; inset: 0; z-index: 80; background: rgba(0,0,0,.88);
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
}
.img-viewer img { max-width: 96%; max-height: 96%; border-radius: 4px; }
.typing-dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing-dots i { width: 6px; height: 6px; background: #bbb; border-radius: 50%; animation: blink 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .2s; }
.typing-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .25; } 40% { opacity: 1; } }

/* 气泡内 Markdown */
.bubble h1, .bubble h2, .bubble h3 { margin: 8px 0 6px; line-height: 1.3; }
.bubble h1 { font-size: 17px; } .bubble h2 { font-size: 16px; } .bubble h3 { font-size: 15px; }
.bubble p { margin: 4px 0; }
.bubble ul, .bubble ol { margin: 4px 0; padding-left: 20px; }
.bubble blockquote { border-left: 3px solid #ccc; margin: 6px 0; padding: 2px 10px; color: #666; background: rgba(0,0,0,.03); }
.bubble code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; font-size: 13px;
  font-family: "SF Mono", Menlo, Consolas, monospace; }
.bubble pre { background: #2b2b2b; color: #f0f0f0; border-radius: 8px; padding: 10px 12px;
  margin: 6px 0; overflow-x: auto; }
.bubble pre code { background: none; color: inherit; padding: 0; }
.bubble table { border-collapse: collapse; margin: 6px 0; font-size: 13px; }
.bubble th, .bubble td { border: 1px solid #ddd; padding: 4px 8px; }
.bubble a { color: #576B95; }
.bubble hr { border: none; border-top: 1px solid #ddd; margin: 8px 0; }

/* ============ 通用弹层 / 管理面板 ============ */
.modal-mask {
  position: absolute; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: #fff; width: 100%; max-height: 86%; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 18px 18px 30px; animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.modal h3 { font-size: 17px; margin-bottom: 14px; text-align: center; }
.modal .close-x { float: right; color: #999; background: none; font-size: 18px; padding: 0 4px; }
.form-row { margin-bottom: 13px; }
.form-row label { display: block; font-size: 13px; color: #666; margin-bottom: 5px; }
.form-row input, .form-row textarea, .form-row select {
  width: 100%; padding: 9px 11px; border: 1px solid #e0e0e0; border-radius: 8px; background: #F8F8F8;
}
.form-row textarea { resize: vertical; min-height: 70px; }
.form-row input:focus, .form-row textarea:focus { border-color: #1E6FEB; background: #fff; }
.avatar-picker { display: flex; gap: 14px; align-items: center; }
/* 单选/复选框不被 .form-row input 的 width:100% 拉伸 */
.form-row input[type="radio"], .form-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: #1E6FEB; }
.type-toggle { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.type-toggle label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: #333; margin: 0; width: auto; }
.avatar-preview { width: 56px; height: 56px; border-radius: 13px; display: flex; align-items: center;
  justify-content: center; font-size: 30px; color: #fff; background-size: cover; flex-shrink: 0; }
.avatar-preview .emoji-pick { font-size: 30px; display: flex; gap: 6px; flex-wrap: wrap; }
.btn-ghost { padding: 8px 14px; border-radius: 8px; background: #F0F0F0; font-size: 14px; color: #333; }
.btn-danger { padding: 8px 14px; border-radius: 8px; background: #e64340; color: #fff; font-size: 14px; }
.btn-sm { padding: 5px 12px; border-radius: 6px; font-size: 13px; }

/* 管理面板 */
.admin { height: 100%; display: flex; flex-direction: column; background: #F2F3F7; }
.admin-body { flex: 1; overflow-y: auto; padding: 14px 16px 40px; }
.admin .seg { display: flex; background: rgba(0,0,0,.05); border-radius: 9px; padding: 2px; margin: 10px 0 4px; }
.admin .seg button { flex: 1; padding: 7px 0; border-radius: 8px; background: none; font-size: 14px; color: #666; }
.admin .seg button.on { background: #fff; color: #1a1a1a; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.card { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.card .card-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid #F2F2F2; }
.list-item:last-child { border-bottom: none; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 15px; font-weight: 500; }
.list-item .li-sub { font-size: 12px; color: #999; margin-top: 2px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: #E8F0FF; color: #1E6FEB; }
.tag.off { background: #F2F2F2; color: #999; }
.empty { text-align: center; color: #B2B2B2; padding: 50px 0; font-size: 14px; }
.toast {
  position: absolute; left: 50%; top: 45%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,.75); color: #fff; padding: 10px 22px; border-radius: 10px;
  font-size: 14px; z-index: 99; animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
