* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
body { background: #f5f7fa; color: #1f2329; overflow: hidden; }

.view { height: 100vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* ============ 登录页 - 金融科技风 ============ */
#login-view {
  align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, #1a2340 0%, #0a0e27 40%, #050814 100%);
}

/* 装饰层：SVG 金融图 */
.login-deco {
  position: absolute; inset: 0;
  z-index: 1;
  opacity: 0.9;
  animation: decoFloat 30s ease-in-out infinite;
}
.login-deco svg { width: 100%; height: 100%; display: block; }

@keyframes decoFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-1%, -1%) scale(1.02); }
}

/* 光晕层 */
.login-glow {
  position: absolute; inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(circle at 15% 25%, rgba(0, 137, 255, 0.35), transparent 35%),
    radial-gradient(circle at 85% 75%, rgba(138, 43, 226, 0.28), transparent 35%),
    radial-gradient(circle at 50% 100%, rgba(67, 233, 123, 0.18), transparent 45%),
    radial-gradient(circle at 50% 40%, rgba(0, 198, 255, 0.12), transparent 60%);
  animation: glowPulse 12s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 1; }
}

/* 玻璃卡片 */
.login-card {
  position: relative; z-index: 3;
  width: 380px;
  padding: 44px 36px 32px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 8px 24px rgba(0, 137, 255, 0.15);
  text-align: center;
  animation: cardIn .5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card .logo {
  width: 72px; height: 72px; margin: 0 auto 22px;
  background: linear-gradient(135deg, #0089ff 0%, #00c6ff 50%, #43e97b 100%);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow:
    0 12px 32px rgba(0, 137, 255, 0.4),
    0 0 0 8px rgba(0, 137, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.login-card h1 {
  font-size: 24px; font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #1a2340, #0089ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.5px;
}
.login-card .tip { font-size: 13px; color: #8a9099; margin-bottom: 30px; }

.login-card .field {
  display: flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 14px; margin-bottom: 14px;
  border: 1.5px solid #e5e6eb; border-radius: 12px;
  transition: all .25s; background: #fafbfc;
}
.login-card .field:focus-within {
  border-color: #0089ff; background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 137, 255, 0.1);
  transform: translateY(-1px);
}
.login-card .field svg { color: #8a9099; flex-shrink: 0; transition: color .2s; }
.login-card .field:focus-within svg { color: #0089ff; }
.login-card .field input {
  flex: 1; border: none; outline: none; font-size: 14px;
  background: transparent; color: #1f2329;
}
.login-card .field input::placeholder { color: #c9cdd4; }

.login-card button {
  width: 100%; height: 48px; border: none; border-radius: 12px; margin-top: 10px;
  background: linear-gradient(135deg, #0089ff 0%, #00a0ff 50%, #00c6ff 100%);
  background-size: 200% 100%;
  color: #fff;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: all .3s;
  box-shadow: 0 8px 20px rgba(0, 137, 255, 0.35);
  letter-spacing: 0.5px;
  font-family: inherit;
}
.login-card button:hover {
  background-position: 100% 0;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 137, 255, 0.45);
}
.login-card button:active { transform: translateY(0); }
.login-card button:disabled {
  background: #c9cdd4; box-shadow: none; cursor: not-allowed; transform: none;
}
.login-card .msg { margin-top: 14px; font-size: 13px; color: #f53f3f; min-height: 18px; }
.login-card .footer-tip {
  margin-top: 22px; padding-top: 18px;
  border-top: 1px dashed #eef0f3;
  font-size: 11px; color: #a8adb5; letter-spacing: 0.5px;
}

/* ============ 聊天页头部 ============ */
.chat-header {
  height: 64px; flex-shrink: 0;
  background: linear-gradient(135deg, #1a2340 0%, #0f172a 100%);
  display: flex; align-items: center;
  padding: 0 18px; gap: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.avatar-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, #0089ff, #00c6ff, #43e97b);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 137, 255, 0.4);
}
.chat-header .title { font-size: 16px; font-weight: 600; color: #fff; letter-spacing: 0.3px; }
.chat-header .status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255,255,255,0.6); margin-top: 2px; }
.chat-header .dot { width: 8px; height: 8px; border-radius: 50%; background: #6b7280; transition: all .3s; }
.chat-header .dot.online { background: #43e97b; box-shadow: 0 0 0 3px rgba(67, 233, 123, 0.25); }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.lock-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  background: rgba(67, 233, 123, 0.15);
  color: #43e97b;
  border: 1px solid rgba(67, 233, 123, 0.3);
  border-radius: 20px; font-size: 12px; font-weight: 500;
  backdrop-filter: blur(8px);
}
.logout-btn {
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.85);
  padding: 6px 14px; border-radius: 8px; font-size: 13px; cursor: pointer;
  transition: all .2s;
}
.logout-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

/* ============ 快捷业务栏 ============ */
.quick-actions {
  flex-shrink: 0; background: #fff;
  padding: 12px 18px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid #eef0f3;
  overflow-x: auto;
  box-shadow: 0 1px 4px rgba(0,0,0,.02);
}
.quick-actions::-webkit-scrollbar { display: none; }
.quick-label {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: #86909c; font-weight: 500;
  flex-shrink: 0;
}
.quick-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 20px;
  background: #f2f8ff; color: #0089ff;
  border: 1px solid transparent;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all .2s; white-space: nowrap;
  font-family: inherit;
}
.quick-btn:hover {
  background: linear-gradient(135deg, #0089ff, #00c6ff);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 137, 255, 0.25);
}
.quick-btn:active { transform: translateY(0); }
.quick-btn svg { flex-shrink: 0; }

/* ============ 消息列表 ============ */
.message-list {
  flex: 1; overflow-y: auto; padding: 20px 18px;
  display: flex; flex-direction: column; gap: 14px;
  background: #f5f7fa;
  scroll-behavior: smooth;
}
.message-list::-webkit-scrollbar { width: 6px; }
.message-list::-webkit-scrollbar-thumb { background: #d0d3d9; border-radius: 3px; }
.message-list::-webkit-scrollbar-thumb:hover { background: #b0b3b9; }

.msg-row { display: flex; gap: 10px; max-width: 78%; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.msg-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-row.other { align-self: flex-start; }

.avatar {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #0089ff, #00a0ff);
  box-shadow: 0 2px 6px rgba(0, 137, 255, 0.2);
}
.msg-row.other .avatar {
  background: linear-gradient(135deg, #ff7d00, #ff9a3d);
  box-shadow: 0 2px 6px rgba(255, 125, 0, 0.2);
}

.bubble-wrap { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.msg-row.mine .bubble-wrap { align-items: flex-end; }
.msg-row.other .bubble-wrap { align-items: flex-start; }

.bubble {
  padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.55;
  word-break: break-word; white-space: pre-wrap; position: relative;
  max-width: 100%; transition: all .15s;
}
.msg-row.other .bubble {
  background: #fff; color: #1f2329;
  border-top-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.msg-row.mine .bubble {
  background: linear-gradient(135deg, #0089ff, #00a0ff);
  color: #fff;
  border-top-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 137, 255, 0.25);
}
.bubble img { max-width: 220px; max-height: 220px; border-radius: 8px; cursor: zoom-in; display: block; }
.bubble.recalled {
  background: #f2f3f5 !important; color: #86909c !important;
  font-style: italic; font-size: 12px; box-shadow: none !important;
  display: inline-flex; align-items: center; gap: 4px;
}
.bubble.recalled::before { content: "⚠️"; }

.meta { font-size: 11px; color: #a8adb5; display: flex; gap: 8px; align-items: center; padding: 0 4px; }
.meta .status.read { color: #0089ff; font-weight: 500; }

.bubble:hover .recall-btn { display: flex; }
.recall-btn {
  display: none; position: absolute; top: -8px; right: -8px; width: 22px; height: 22px;
  background: #fff; border: 1px solid #e5e6eb; border-radius: 50%; color: #86909c;
  align-items: center; justify-content: center; font-size: 12px; cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); transition: all .15s;
}
.recall-btn:hover { color: #f53f3f; border-color: #f53f3f; transform: scale(1.1); }

/* ============ 底部输入栏 ============ */
.chat-footer {
  flex-shrink: 0; background: #fff; border-top: 1px solid #eef0f3;
  padding: 12px 18px; display: flex; align-items: flex-end; gap: 12px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.02);
}
.icon-btn {
  width: 40px; height: 40px; cursor: pointer; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #86909c; transition: all .2s; flex-shrink: 0;
}
.icon-btn:hover { background: #f2f8ff; color: #0089ff; transform: scale(1.05); }
.icon-btn:active { transform: scale(0.95); }

.chat-footer textarea {
  flex: 1; resize: none; border: none; outline: none; font-size: 14px; line-height: 1.5;
  max-height: 120px; padding: 10px 0; font-family: inherit; color: #1f2329;
  background: transparent;
}
.chat-footer textarea::placeholder { color: #c9cdd4; }

.send-btn {
  height: 40px; padding: 0 20px;
  background: linear-gradient(135deg, #0089ff, #00a0ff);
  color: #fff; border: none; border-radius: 10px;
  font-size: 14px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: all .2s; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 137, 255, 0.25);
  font-family: inherit;
}
.send-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 137, 255, 0.35); }
.send-btn:active { transform: translateY(0); }
.send-btn:disabled { background: #c9cdd4; box-shadow: none; cursor: not-allowed; transform: none; }

/* ============ 图片灯箱 ============ */
.lightbox {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.9); z-index: 999;
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
  animation: fadeIn .2s;
  backdrop-filter: blur(8px);
}
.lightbox img {
  max-width: 92%; max-height: 92%; border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

/* ============ 移动端适配 ============ */
@media (max-width: 640px) {
  .login-card { width: 92%; padding: 36px 26px 26px; }
  .login-card .logo { width: 60px; height: 60px; }
  .login-card h1 { font-size: 20px; }
  .chat-header { padding: 0 14px; height: 60px; }
  .avatar-icon { width: 36px; height: 36px; }
  .chat-header .title { font-size: 15px; }
  .lock-badge { display: none; }
  .quick-actions { padding: 10px 14px; }
  .quick-btn { padding: 6px 12px; font-size: 12px; }
  .message-list { padding: 16px 12px; }
  .chat-footer { padding: 10px 14px; }
  .send-btn { padding: 0 16px; }
  .send-btn svg { display: none; }
}

/* ============ 移动端 viewport 高度修复 ============ */
/* 1. 用 dvh 替代 vh：dvh = dynamic viewport height，会随地址栏动态调整 */
/* 2. 提供多层 fallback，兼容旧浏览器 */
.view {
  height: 100vh;                  /* 老浏览器 fallback */
  height: -webkit-fill-available; /* iOS Safari 老版本 */
  height: 100dvh;                 /* 现代浏览器（主流） */
}

/* 3. 移动端输入栏固定在底部，避免被键盘 / 地址栏顶开 */
@media (max-width: 640px) {
  .chat-footer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: #fff;
  }

  /* 消息列表增加底部 padding，避免最后一条消息被输入框压住 */
  .message-list {
    padding-bottom: 20px;
  }

  /* 快捷业务栏收紧，给消息列表更多空间 */
  .quick-actions {
    padding: 8px 14px;
  }
  .quick-label {
    display: none;   /* 手机上隐藏"快捷业务"标签，节省空间 */
  }
}
