/* ============ 全局 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: linear-gradient(135deg, #eef2ff 0%, #f5f0ff 100%);
  color: #2c3e50;
  height: 100vh;
}
a { color: #4a7cff; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ============ 登录/注册卡片 ============ */
.auth-wrap {
  height: 100vh; display: flex; align-items: center; justify-content: center;
}
.auth-card {
  background: #fff; width: 380px; padding: 36px 34px;
  border-radius: 14px; box-shadow: 0 10px 40px rgba(80, 100, 200, .15);
}
.auth-card h1 { font-size: 22px; text-align: center; margin-bottom: 6px; color: #333; }
.auth-card .sub { text-align: center; color: #888; font-size: 13px; margin-bottom: 24px; }
.tabs { display: flex; margin-bottom: 20px; border-bottom: 1px solid #eee; }
.tabs span {
  flex: 1; text-align: center; padding: 10px 0; cursor: pointer;
  color: #888; font-size: 15px;
}
.tabs span.active { color: #4a7cff; border-bottom: 2px solid #4a7cff; font-weight: 600; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: #666; margin-bottom: 5px; }
.field input {
  width: 100%; padding: 10px 12px; border: 1px solid #dde1ec; border-radius: 7px;
  font-size: 14px; outline: none; transition: .2s;
}
.field input:focus { border-color: #4a7cff; box-shadow: 0 0 0 3px rgba(74,124,255,.12); }
.captcha-row { display: flex; gap: 10px; }
.captcha-row input { flex: 1; }
.captcha-row img {
  height: 42px; width: 130px; border-radius: 7px; cursor: pointer;
  border: 1px solid #dde1ec;
}
.btn-primary {
  width: 100%; padding: 11px; background: #4a7cff; color: #fff; border: 0;
  border-radius: 7px; font-size: 15px; margin-top: 6px;
}
.btn-primary:hover { background: #3b6ae6; }
.tip { margin-top: 12px; font-size: 13px; color: #c0392b; text-align: center; min-height: 18px; }
.clock { text-align: center; font-size: 12px; color: #aaa; margin-top: 14px; }

/* ============ 聊天主界面 ============ */
.app { display: flex; height: 100vh; }
.sidebar {
  width: 240px; background: #1f2a48; color: #cfd6e6; display: flex;
  flex-direction: column;
}
.side-header { padding: 16px; border-bottom: 1px solid #2c3a5e; }
.side-header .name { font-size: 16px; color: #fff; font-weight: 600; }
.side-header .meta { font-size: 12px; color: #8a95b5; margin-top: 3px; }
.side-clock { font-size: 12px; color: #8a95b5; margin-top: 6px; }
.side-nav { flex: 1; overflow-y: auto; padding: 8px; }
.room-item {
  padding: 10px 12px; border-radius: 7px; cursor: pointer; margin-bottom: 3px;
  font-size: 14px; display: flex; align-items: center; justify-content: space-between;
}
.room-item:hover { background: #2c3a5e; }
.room-item.active { background: #4a7cff; color: #fff; }
.room-item .badge {
  background: #ff4d4f; color: #fff; border-radius: 10px;
  font-size: 11px; padding: 1px 7px; display: none;
}
.side-footer { padding: 10px; border-top: 1px solid #2c3a5e; }
.side-footer button {
  width: 100%; padding: 8px; background: transparent; color: #cfd6e6;
  border: 1px solid #3a4a75; border-radius: 6px; margin-bottom: 5px;
}
.side-footer button:hover { background: #2c3a5e; }

.main { flex: 1; display: flex; flex-direction: column; background: #f5f7fb; }
.main-header {
  background: #fff; padding: 12px 20px; border-bottom: 1px solid #e6e9f2;
  display: flex; align-items: center; justify-content: space-between;
}
.main-header h2 { font-size: 16px; color: #333; }
.main-header .h-time { font-size: 13px; color: #888; }
.messages { flex: 1; overflow-y: auto; padding: 20px; }
.msg { margin-bottom: 14px; display: flex; }
.msg.mine { justify-content: flex-end; }
.bubble {
  max-width: 60%; padding: 9px 13px; border-radius: 10px; font-size: 14px;
  line-height: 1.5; word-break: break-word;
}
.msg.mine .bubble { background: #4a7cff; color: #fff; border-bottom-right-radius: 3px; }
.msg.their .bubble { background: #fff; border: 1px solid #e6e9f2; border-bottom-left-radius: 3px; }
.msg .meta { font-size: 11px; color: #999; margin-bottom: 3px; }
.msg.mine .meta { text-align: right; }
.bubble img, .bubble audio { max-width: 100%; border-radius: 6px; display: block; }
.bubble audio { height: 36px; }

.input-bar {
  background: #fff; border-top: 1px solid #e6e9f2; padding: 10px 14px;
}
.input-tools { display: flex; gap: 10px; margin-bottom: 8px; }
.input-tools label, .input-tools button {
  font-size: 13px; color: #4a7cff; cursor: pointer;
  padding: 4px 10px; border: 1px solid #cdd9ff; border-radius: 5px; background: #f0f4ff;
}
.input-row { display: flex; gap: 8px; }
.input-row textarea {
  flex: 1; resize: none; border: 1px solid #dde1ec; border-radius: 7px;
  padding: 9px 11px; font-size: 14px; font-family: inherit; height: 42px; outline: none;
}
.input-row textarea:focus { border-color: #4a7cff; }
.input-row button.send {
  padding: 0 22px; background: #4a7cff; color: #fff; border: 0; border-radius: 7px; font-size: 14px;
}

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: none; align-items: center; justify-content: center; z-index: 99;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 10px; padding: 24px; width: 420px; max-width: 92%;
}
.modal h3 { font-size: 16px; margin-bottom: 16px; }
.modal .field input, .modal .field select {
  width: 100%; padding: 9px 11px; border: 1px solid #dde1ec; border-radius: 6px; font-size: 14px;
}
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions button { flex: 1; padding: 9px; border-radius: 6px; border: 0; font-size: 14px; }
.btn-ok { background: #4a7cff; color: #fff; }
.btn-cancel { background: #eef0f5; color: #555; }

/* ============ 管理页 ============ */
.admin-wrap { padding: 24px; }
.admin-wrap h1 { font-size: 20px; margin-bottom: 18px; }
.tabs2 { display: flex; gap: 8px; margin-bottom: 18px; }
.tabs2 button {
  padding: 8px 18px; border: 1px solid #dde1ec; background: #fff;
  border-radius: 6px; font-size: 14px;
}
.tabs2 button.active { background: #4a7cff; color: #fff; border-color: #4a7cff; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eef0f5; font-size: 14px; }
th { background: #f7f9ff; color: #555; font-weight: 600; }
td .op a { margin-right: 8px; cursor: pointer; font-size: 13px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.topbar .right { display: flex; gap: 8px; }
.topbar input { padding: 7px 10px; border: 1px solid #dde1ec; border-radius: 6px; font-size: 13px; }
.log-line { font-size: 13px; padding: 6px 0; border-bottom: 1px dashed #eef0f5; }
.log-line .t { color: #999; margin-right: 8px; }
.log-line .u { color: #4a7cff; margin-right: 8px; }
