/* 启程 · 学员服务管理 —— 样式 */
:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --border: #e3e9f1;
  --text: #1f2d3d;
  --muted: #7a8899;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-bg: #e8f0fe;
  --green: #16a34a;
  --green-bg: #e6f7ee;
  --red: #dc2626;
  --red-bg: #fdeaea;
  --orange: #d97706;
  --orange-bg: #fef3e2;
  --sidebar-w: 228px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(31, 45, 61, .08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
a { color: var(--primary); text-decoration: none; }

/* ---------- 登录 ---------- */
.login-screen {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #e8eef7, #dfe8f3);
  padding: 20px;
}
.login-card {
  background: var(--card); border-radius: 14px; box-shadow: 0 8px 30px rgba(31,45,61,.12);
  padding: 40px 36px; width: 100%; max-width: 380px; text-align: center;
}
.login-logo { margin-bottom: 12px; }
.login-card h1 { font-size: 20px; margin-bottom: 6px; }
.login-sub { color: var(--muted); margin-bottom: 24px; }
.login-error { color: var(--red); font-size: 13px; margin: 8px 0; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 100;
}
.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(238, 242, 247, .92); backdrop-filter: blur(6px);
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px; border-bottom: 1px solid var(--border);
}
.topbar h2 { font-size: 18px; font-weight: 600; }
.menu-btn { display: none; background: none; border: none; color: var(--text); cursor: pointer; padding: 4px; }
.content { padding: 20px 24px 80px; max-width: 1280px; width: 100%; }

.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; border-bottom: 1px solid var(--border); }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 17px; }
.brand-text span { font-size: 12px; color: var(--muted); }

.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px; color: #46566b; font-size: 14px;
}
.nav a svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav a:hover { background: #f2f6fb; color: var(--text); }
.nav a.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
/* 侧栏分组下拉 */
.nav-group { display: flex; flex-direction: column; }
.nav-group-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: #46566b; font-size: 14px; }
.nav-group-head svg:first-child { width: 19px; height: 19px; flex-shrink: 0; }
.nav-group-head:hover { background: #f2f6fb; color: var(--text); }
.nav-group-head.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.nav-arrow { margin-left: auto; transition: transform .18s; }
.nav-group.open .nav-arrow { transform: rotate(180deg); }
.nav-sub { display: none; flex-direction: column; gap: 1px; padding: 2px 0 4px 26px; }
.nav-group.open .nav-sub { display: flex; }
.nav-sub a { padding: 6px 12px; border-radius: 7px; color: var(--muted); font-size: 13px; }
.nav-sub a:hover { background: #f2f6fb; color: var(--text); }
.nav-sub a.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 12px; }
.link-btn { background: none; border: none; color: var(--muted); font-size: 13px; cursor: pointer; padding: 0; }
.link-btn:hover { color: var(--primary); }
.link-btn.danger:hover { color: var(--red); }
.sidebar-backdrop { display: none; }

/* ---------- 通用组件 ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.card h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 8px; cursor: pointer;
  padding: 8px 16px; font-size: 14px; font-family: inherit; line-height: 1.4;
  transition: background .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover:not(:disabled) { background: #15803d; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fff; border-color: #f3c1c1; color: var(--red); }
.btn-danger:hover:not(:disabled) { background: var(--red-bg); }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }

.input, select.input, textarea.input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
textarea.input { resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: #46566b; }
label.field .req::after { content: " *"; color: var(--red); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 500; white-space: nowrap;
}
.badge-blue { background: var(--primary-bg); color: var(--primary); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-gray { background: #eef1f5; color: #64748b; }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .input, .toolbar select { width: auto; min-width: 140px; }
.toolbar .spacer { flex: 1; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; min-width: 700px; }
.table th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid #eef2f7; vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table tr.rowlink { cursor: pointer; }
.table tr.rowlink:hover td { background: #f7fafd; }
.name-link { color: var(--primary); font-weight: 600; cursor: pointer; }
.name-link:hover { text-decoration: underline; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat.clickable { cursor: pointer; transition: border-color .15s; }
.stat.clickable:hover { border-color: var(--primary); }

.empty { text-align: center; color: var(--muted); padding: 48px 20px; }
.empty svg { width: 44px; height: 44px; color: #c3cfdd; margin-bottom: 10px; }

/* ---------- 学员详情 ---------- */
.detail-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.detail-head h2 { font-size: 20px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.back-link:hover { color: var(--primary); }

.steps { display: flex; margin: 6px 0 2px; overflow-x: auto; padding-bottom: 4px; }
.step { display: flex; align-items: center; flex-shrink: 0; }
.step .dot {
  width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; background: #e6ecf3; color: #8fa0b3; border: 2px solid transparent; flex-shrink: 0;
}
.step.done .dot { background: var(--primary); color: #fff; }
.step.done-green .dot { background: var(--green); color: #fff; }
.step.current .dot { background: #fff; border-color: var(--primary); color: var(--primary); font-weight: 700; }
.step.current-green .dot { border-color: var(--green); color: var(--green); font-weight: 700; }
.step .slabel { margin-left: 7px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.step.done .slabel, .step.done-green .slabel { color: var(--text); }
.step.current .slabel, .step.current-green .slabel { color: var(--text); font-weight: 600; }
.step .bar { width: 34px; height: 2px; background: #e6ecf3; margin: 0 8px; }
.step.done .bar, .step.done-green .bar { background: var(--primary); }
.step.done-green .bar { background: var(--green); }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 20px; }
.kv .k { font-size: 12px; color: var(--muted); }
.kv .v { font-size: 14px; margin-top: 2px; word-break: break-all; }
.kv .v.empty-v { color: #b6c2cf; }

.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
}
.file-item .ficon { width: 32px; height: 32px; border-radius: 7px; background: var(--primary-bg); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.file-item .fmeta { flex: 1; min-width: 150px; }
.file-item .fname { font-weight: 500; word-break: break-all; }
.file-item .fsub { font-size: 12px; color: var(--muted); }
.file-item .factions { display: flex; gap: 6px; }
.file-item img.fthumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }

.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 18px 14px; }
.tl-item::before {
  content: ""; position: absolute; left: -18px; top: 6px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border);
}
.tl-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tl-time { color: var(--muted); font-size: 12px; }
.tl-content { margin-top: 6px; white-space: pre-wrap; word-break: break-word; background: #f7fafd; border-radius: 8px; padding: 10px 12px; }

.followup-alert {
  display: flex; align-items: center; gap: 8px;
  background: var(--orange-bg); color: var(--orange);
  border: 1px solid #f5ddb8; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 14px;
}
.followup-alert.overdue { background: var(--red-bg); color: var(--red); border-color: #f3c1c1; }

.poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.poster-card { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.poster-card img { width: 100%; height: 120px; object-fit: cover; display: block; cursor: zoom-in; }
.poster-card .pinfo { padding: 8px 10px; font-size: 12px; }
.poster-card .pinfo .pname { word-break: break-all; }

.section-title { font-size: 14px; font-weight: 600; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.longtext { white-space: pre-wrap; word-break: break-word; background: #f7fafd; border-radius: 8px; padding: 12px 14px; }
/* 岗位全内容卡片 */
.job-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; background: #fff; }
.job-card:last-child { margin-bottom: 0; }
.job-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.job-card-head > div:first-child { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- 模态框 ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300; background: rgba(23, 34, 48, .45);
  display: flex; align-items: flex-start; justify-content: center; padding: 30px 16px; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 12px; box-shadow: 0 12px 40px rgba(23,34,48,.25);
  width: 100%; max-width: 720px; padding: 22px 24px; margin: auto 0;
}
.modal.modal-lg { max-width: 920px; }
.modal h3 { font-size: 16px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal .close-x { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; padding: 2px 6px; }

/* ---------- 导入预览 ---------- */
.import-summary { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.import-summary .badge { font-size: 13px; padding: 4px 12px; }
.import-note { font-size: 13px; color: var(--muted); margin-bottom: 10px; }

/* ---------- AI 助手 ---------- */
.ai-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 250;
  width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--primary); color: #fff; box-shadow: 0 6px 20px rgba(37, 99, 235, .4);
  display: flex; align-items: center; justify-content: center;
}
.ai-fab:hover { background: var(--primary-dark); }
.ai-panel {
  position: fixed; right: 22px; bottom: 86px; z-index: 260;
  width: 400px; max-width: calc(100vw - 32px); height: 560px; max-height: calc(100vh - 110px);
  background: #fff; border-radius: 14px; box-shadow: 0 12px 40px rgba(23,34,48,.25);
  display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border);
}
.ai-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.ai-title { display: flex; flex-direction: column; }
.ai-title strong { font-size: 14px; }
.ai-status { font-size: 11px; color: var(--muted); }
.ai-status.ok { color: var(--green); }
.ai-status.no { color: var(--orange); }
.ai-header-actions { display: flex; gap: 4px; }
.icon-btn { background: none; border: none; color: var(--muted); cursor: pointer; padding: 5px; border-radius: 6px; display: flex; }
.icon-btn:hover { background: #f2f6fb; color: var(--text); }
.ai-modes { display: flex; gap: 6px; padding: 10px 14px 0; }
.ai-mode {
  flex: 1; border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 6px 0; font-size: 13px; cursor: pointer; color: var(--muted); font-family: inherit;
}
.ai-mode.active { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.ai-messages { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 18px 8px; }
.msg { max-width: 88%; border-radius: 10px; padding: 9px 12px; font-size: 13px; white-space: pre-wrap; word-break: break-word; position: relative; }
.msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 3px; }
.msg.bot { align-self: flex-start; background: #f2f6fb; border-bottom-left-radius: 3px; }
.msg .msg-copy {
  position: absolute; right: 6px; bottom: -22px; background: none; border: none;
  color: var(--muted); font-size: 11px; cursor: pointer; display: none;
}
.msg.bot:hover .msg-copy { display: block; }
.msg.bot { margin-bottom: 20px; }
.msg.error { background: var(--red-bg); color: var(--red); align-self: stretch; max-width: 100%; }
.typing { align-self: flex-start; color: var(--muted); font-size: 13px; padding: 6px 10px; }
.typing span { animation: blink 1.2s infinite; }
.typing .typing-hint { animation: none; opacity: .7; font-size: 12px; margin-left: 6px; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.ai-examples { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 8px; }
.ai-example {
  border: 1px solid var(--border); background: #fff; color: var(--muted);
  border-radius: 999px; font-size: 12px; padding: 3px 10px; cursor: pointer; font-family: inherit;
}
.ai-example:hover { border-color: var(--primary); color: var(--primary); }
.ai-input-row { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); align-items: flex-end; }
.ai-input-row textarea {
  flex: 1; resize: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font-size: 13px; font-family: inherit; max-height: 110px; line-height: 1.5;
}
.ai-input-row textarea:focus { outline: none; border-color: var(--primary); }

/* ---------- Toast ---------- */
.toast-root { position: fixed; top: 18px; right: 18px; z-index: 400; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1f2d3d; color: #fff; border-radius: 8px; padding: 10px 16px; font-size: 13px;
  box-shadow: 0 4px 14px rgba(23,34,48,.3); max-width: 340px; word-break: break-all;
  animation: slidein .2s ease;
}
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- AI 独立页面 ---------- */
.ai-page { max-width: 900px; display: flex; flex-direction: column; }
.ai-page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ai-page-title h3 { margin: 0 0 6px; font-size: 16px; }
.ai-page-title p { font-size: 13px; max-width: 640px; }
.ai-head-btns { display: flex; gap: 8px; }
.ai-page .ai-modes { padding: 14px 0 0; }
.ai-page-msgs { border: 1px solid var(--border); border-radius: 10px; background: #fafcff; min-height: 320px; height: 46vh; margin-top: 10px; padding: 14px; }
.msg-atts { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.msg.user .chip { background: rgba(255,255,255,.25); color: #fff; border-color: rgba(255,255,255,.4); }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--primary-bg); color: var(--primary);
  border: 1px solid #cdddfb; border-radius: 999px; padding: 2px 10px; font-size: 12px; word-break: break-all;
}
.chip-x { background: none; border: none; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 0 0 2px; }
.chip-x:hover { color: var(--red); }
.ai-page .ai-input-row { border-top: none; padding: 10px 0 0; }
.ai-imp-types { display: flex; gap: 8px; flex-wrap: wrap; }
.ai-imp-types .btn.active { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); font-weight: 600; }

/* ---------- 手机适配 ---------- */
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 30px rgba(23,34,48,.2); }
  .sidebar.open { transform: none; }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 99; background: rgba(23,34,48,.35);
    opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; }
  .menu-btn { display: block; }
  .content { padding: 14px 12px 90px; }
  .topbar { padding: 12px 14px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .half-mobile { grid-column: span 1; }
  .form-grid .full { grid-column: 1 / -1; }
  .toolbar .input, .toolbar select { min-width: 0; flex: 1 1 130px; }
  .modal-overlay { padding: 12px 8px; }
  .modal { padding: 16px 14px; }
  .ai-panel { right: 12px; bottom: 78px; height: min(560px, calc(100vh - 100px)); }
  .ai-fab { right: 14px; bottom: 14px; }
  .kv-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .form-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .kv-grid { grid-template-columns: 1fr; }
  .detail-head h2 { font-size: 18px; }
}
