:root {
  --accent: #3b6fe0;
  --accent-dark: #2f5cc4;
  --danger: #d9534f;
  --bg: #f2f4f8;
  --panel: #ffffff;
  --head-bg: #eef1f6;
  --line: #dde3ec;
  --text: #1f2430;
  --muted: #7a8396;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
}
.input:focus { outline: 2px solid rgba(59, 111, 224, .25); border-color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--head-bg); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; }

/* 管理后台入口 */
.admin-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}
.admin-link:hover { background: var(--head-bg); }

/* ---------- 登录 ---------- */
.auth-wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-box {
  width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px 28px;
  box-shadow: 0 8px 30px rgba(20, 30, 60, .08);
}
.auth-box h1 { font-size: 22px; margin-bottom: 6px; }
.auth-box .hint { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.auth-box .input { margin-bottom: 12px; }
.captcha-row { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.captcha-display {
  flex: 1;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: repeating-linear-gradient(45deg, #f5f7fb, #f5f7fb 8px, #eef1f6 8px, #eef1f6 16px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Courier New", monospace;
  font-weight: 700;
  letter-spacing: 4px;
  cursor: pointer;
  user-select: none;
}
.auth-actions { display: flex; gap: 10px; margin-top: 4px; }
.auth-actions .btn { flex: 1; }
.auth-error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- 主界面 ---------- */
.app-wrap { height: 100%; display: flex; flex-direction: column; }
.app-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.app-brand { font-size: 17px; font-weight: 700; }
.app-user { display: flex; align-items: center; gap: 12px; }
.user-info { font-size: 14px; color: var(--muted); }

.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
  padding: 16px 20px;
  gap: 16px;
}

/* 左侧上传 */
.upload-panel {
  flex: 0 0 300px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.upload-panel h2 { font-size: 16px; }
.upload-panel .hint { font-size: 12px; color: var(--muted); }
.file-input { font-size: 13px; }
.upload-status { font-size: 13px; color: var(--muted); min-height: 18px; }
.upload-result { border-top: 1px dashed var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.upload-meta { font-size: 13px; color: var(--text); }
.field-label { font-size: 12px; color: var(--muted); }
.path-text { font-family: "Consolas", "Courier New", monospace; font-size: 12px; resize: none; }

.upload-hint {
  font-size: 12px;
  color: var(--muted);
  background: var(--head-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.6;
}
.upload-hint ul { padding-left: 16px; margin-top: 4px; }

.upload-banner {
  font-size: 13px;
  color: #7a5a00;
  background: #fff6db;
  border: 1px solid #f0d39a;
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.6;
}

.get-sav {
  font-size: 12px;
  color: var(--muted);
  background: #eef6ff;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  padding: 8px 10px;
  line-height: 1.6;
}

/* 对话顶栏（显示 profile 与 resume） */
.chat-topbar {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  background: var(--head-bg);
  border-radius: 12px 12px 0 0;
  word-break: break-all;
}
.chat-topbar b { color: var(--text); font-weight: 600; }

/* 右侧对话 */
.chat-main {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.chat-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 30px 10px; }
.chat-msg { max-width: 82%; padding: 9px 12px; border-radius: 10px; font-size: 14px; white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.chat-msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 3px; }
.chat-msg.bot { align-self: flex-start; background: var(--head-bg); color: var(--text); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.chat-msg.typing { color: var(--muted); font-style: italic; }
.chat-msg.path-msg { background: #eef3ff; border: 1px dashed var(--accent); font-family: "Consolas", "Courier New", monospace; font-size: 12px; }
.chat-reason { margin-bottom: 6px; border-left: 3px solid var(--line); padding-left: 8px; }
.chat-reason-head { font-size: 11px; color: var(--muted); cursor: pointer; user-select: none; margin-bottom: 2px; }
.chat-reason-body { font-size: 12px; color: var(--muted); white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow-y: auto; }
.chat-steps { font-style: normal; color: #3a4152; }
.chat-cot { font-style: italic; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 6px; max-height: 140px; overflow-y: auto; }
.chat-answer { white-space: pre-wrap; word-break: break-word; }
.chat-reason.collapsed .chat-reason-body { display: none; }

/* 分析报告（iframe 内嵌预览） */
.chat-report { margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; white-space: normal; }
.chat-report-head { font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px; background: var(--head-bg); border-bottom: 1px solid var(--line); }
.chat-report-bar { display: flex; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.chat-report-btn { font-size: 13px; color: var(--accent); text-decoration: none; cursor: pointer; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; }
.chat-report-btn:hover { background: var(--head-bg); }
.chat-report-frame { display: block; width: 100%; height: 420px; border: 0; background: #fff; }
.chat-input-row { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); }
.chat-input { flex: 1; }

/* 提示条 */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #333;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;
  max-width: 88vw;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }
.toast.warn { background: #b8860b; }

@media (max-width: 900px) {
  .app-body { flex-direction: column; }
  .upload-panel { flex: 0 0 auto; }
}

/* 确认弹窗 */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(15, 20, 35, .45);
  z-index: 998;
}
.modal-box {
  position: relative;
  z-index: 999;
  width: 380px;
  max-width: 90vw;
  background: var(--panel);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 12px 40px rgba(10, 15, 30, .3);
}
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.modal-text { font-size: 14px; color: var(--text); line-height: 1.7; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal-actions .btn { min-width: 90px; }