:root {
  --primary: #7357d9;
  --primary-dark: #5840b7;
  --primary-soft: #f0ecff;
  --ink: #20222a;
  --muted: #747986;
  --line: #e7e8ef;
  --bg: #f6f7fb;
  --card: #ffffff;
  --green: #16856b;
  --green-soft: #e9f8f2;
  --orange: #c47419;
  --orange-soft: #fff5e5;
  --red: #cf4c55;
  --red-soft: #fff0f1;
  --blue-soft: #edf5ff;
  --blue: #2670b8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #f7f5ff 0%, #eef7ff 100%);
}
.login-card {
  width: min(430px, 100%);
  padding: 34px;
  border-radius: 24px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(45, 40, 90, .08);
  text-align: center;
}
.login-brand {
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: white;
  font-weight: 800;
}
.login-card h1 { margin: 0 0 10px; font-size: 25px; }
.login-card p { margin: 0 0 24px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.primary-btn, .ghost-btn, .header-btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 700;
  transition: transform .15s, background .15s;
}
    .primary-btn { background: var(--primary); color: white; width: 100%; }
    .primary-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
    .wecom-btn { background: #16856b; }
    .wecom-btn:hover { background: #0f6e56; }
    .login-status { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--green-soft); color: var(--green); font-size: 11px; line-height: 1.7; text-align: left; }
    .otp-box { margin-top: 14px; text-align: left; }
    .field-label { display: block; margin: 0 0 6px 2px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
    .text-input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text); font-size: 13px; outline: none; }
    .text-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(88,64,183,.08); }
    .otp-row { display: grid; grid-template-columns: 1fr 96px; gap: 8px; margin-top: 10px; }
    .small-btn { width: 96px; height: 42px; padding: 0; border-radius: 10px; font-size: 11px; white-space: nowrap; }
    #otpLoginBox .primary-btn { margin-top: 12px; }
.ghost-btn { background: var(--primary-soft); color: var(--primary-dark); }
.ghost-btn.small, .header-btn { padding: 8px 12px; font-size: 12px; border-radius: 9px; }
.header-btn { background: white; border: 1px solid var(--line); color: #5d626e; }
.login-card .ghost-btn { width: 100%; margin-top: 10px; }
.error-text { color: var(--red); font-size: 12px; line-height: 1.6; margin-top: 14px; }
.login-note { margin-top: 20px; padding: 12px; background: var(--orange-soft); color: #8d642d; font-size: 11px; line-height: 1.7; border-radius: 10px; text-align: left; }
.app-shell { min-height: 100vh; }
.app-header {
  height: 68px;
  padding: 0 max(18px, calc((100vw - 1240px) / 2));
  background: white;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}
.app-title { font-weight: 800; font-size: 16px; }
.user-line { color: var(--muted); font-size: 11px; margin-top: 4px; }
.top-nav {
  display: flex;
  gap: 8px;
  padding: 10px max(18px, calc((100vw - 1240px) / 2));
  background: white;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.nav-btn {
  border: 0;
  background: transparent;
  color: #777d89;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 13px;
}
.nav-btn.active { color: var(--primary); background: var(--primary-soft); font-weight: 800; }
.main-panel {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 18px 96px;
}
.page-view { animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.eyebrow { color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: 1.2px; margin-bottom: 5px; }
.page-heading h2 { margin: 0; font-size: 24px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.stat-value { font-size: 26px; font-weight: 800; color: var(--primary-dark); }
.stat-label { color: var(--muted); font-size: 11px; margin-top: 5px; }
.content-grid { display: grid; gap: 16px; }
.two-columns { grid-template-columns: 1fr 1fr; }
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
}
.panel-title { font-weight: 800; font-size: 14px; margin-bottom: 12px; }
.item-list { display: grid; gap: 10px; }
.empty-list { color: #9a9ea8; font-size: 12px; padding: 14px 0; }
.item-card {
  border: 1px solid #edeef3;
  border-radius: 12px;
  padding: 12px;
  background: #fbfbfe;
}
.item-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.item-title { font-size: 13px; font-weight: 750; line-height: 1.5; }
.item-meta { color: var(--muted); font-size: 11px; line-height: 1.6; margin-top: 5px; }
.badge { padding: 4px 7px; border-radius: 7px; font-size: 10px; white-space: nowrap; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.course-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 17px;
  display: flex;
  flex-direction: column;
  min-height: 180px;
}
.course-card h3 { margin: 8px 0; font-size: 16px; }
.course-card p { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 0 0 12px; flex: 1; }
.card-actions { display: flex; gap: 8px; }
.card-actions button { flex: 1; border: 0; border-radius: 9px; padding: 9px; font-size: 12px; font-weight: 700; }
.card-actions .main-action { background: var(--primary); color: white; }
.card-actions .sub-action { background: var(--primary-soft); color: var(--primary-dark); }
.scenario-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.scenario-card { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.scenario-card.easy { border-top: 4px solid var(--green); }
.scenario-card.medium { border-top: 4px solid var(--primary); }
.scenario-card.hard { border-top: 4px solid var(--red); }
.scenario-level { font-size: 11px; font-weight: 800; color: var(--muted); margin-bottom: 7px; }
.scenario-card h3 { margin: 0 0 8px; font-size: 15px; }
.scenario-card p { color: var(--muted); font-size: 11px; line-height: 1.7; min-height: 48px; }
.scenario-card button { width: 100%; margin-top: 10px; border: 0; border-radius: 10px; padding: 10px; background: var(--primary-soft); color: var(--primary-dark); font-weight: 800; }
.notice-box { padding: 12px 14px; border-radius: 12px; background: var(--orange-soft); color: #8d642d; font-size: 12px; line-height: 1.7; margin-bottom: 16px; }
.quota-chip { background: var(--primary-soft); color: var(--primary-dark); padding: 7px 10px; border-radius: 9px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.trainer-panel { background: white; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.trainer-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.trainer-title { font-weight: 800; font-size: 14px; }
.trainer-subtitle { color: var(--muted); font-size: 11px; margin-top: 3px; }
#trainerFrame { width: 100%; height: calc(100vh - 240px); min-height: 620px; border: 0; display: block; }
.rank-list { display: grid; gap: 8px; }
.rank-row { display: grid; grid-template-columns: 38px 1fr 80px; align-items: center; gap: 10px; padding: 10px; background: #fbfbfe; border: 1px solid #edeef3; border-radius: 10px; font-size: 12px; }
.rank-num { width: 26px; height: 26px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-dark); border-radius: 8px; font-weight: 800; }
.rank-score { text-align: right; color: var(--primary-dark); font-weight: 800; }
.weakness-panel { background: linear-gradient(135deg, #ffffff, #f8f6ff); }
.weak-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.weak-tag { padding: 7px 9px; border-radius: 8px; background: var(--red-soft); color: var(--red); font-size: 11px; }
.form-grid { display: grid; gap: 12px; }
.form-grid label { display: grid; gap: 6px; color: #565b68; font-size: 12px; font-weight: 700; }
.form-grid input, .form-grid textarea, .form-grid select {
  width: 100%;
  border: 1px solid #dfe1e8;
  border-radius: 10px;
  padding: 10px 11px;
  outline: none;
  background: #fcfcfd;
  color: var(--ink);
}
.form-grid input:focus, .form-grid textarea:focus, .form-grid select:focus { border-color: #aa97e2; box-shadow: 0 0 0 3px #f1edfc; }
.form-actions { display: flex; gap: 10px; }
.form-actions button { flex: 1; }
.form-status { min-height: 18px; color: var(--muted); font-size: 11px; line-height: 1.6; }
    .analytics-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .role-manager { display: grid; gap: 14px; }
    .role-form { display: grid; grid-template-columns: 1fr 160px auto; gap: 10px; align-items: end; }
    .role-form label { display: grid; gap: 6px; color: #565b68; font-size: 12px; font-weight: 700; }
    .role-form select { width: 100%; border: 1px solid #dfe1e8; border-radius: 10px; padding: 10px 11px; background: #fcfcfd; }
    .role-note { padding: 10px 12px; border-radius: 10px; background: var(--blue-soft); color: var(--blue); font-size: 11px; line-height: 1.7; }
    .analytics-card { border: 1px solid #edeef3; border-radius: 12px; padding: 14px; background: #fbfbfe; }
.analytics-card h4 { margin: 0 0 8px; font-size: 13px; }
.bar-row { margin: 9px 0; }
.bar-head { display: flex; justify-content: space-between; font-size: 11px; color: #666b77; margin-bottom: 5px; }
.bar-track { height: 7px; background: #eeeeF5; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 99px; }
.modal-mask { position: fixed; inset: 0; background: rgba(30, 28, 42, .45); z-index: 100; display: grid; place-items: center; padding: 18px; }
.modal-card { width: min(560px, 100%); max-height: 86vh; overflow-y: auto; background: white; border-radius: 18px; padding: 24px; position: relative; }
.confirm-card { width: min(360px, 100%); padding: 26px 24px 20px; text-align: center; }
.confirm-message { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.7; margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 12px; }
.confirm-actions .primary-btn, .confirm-actions .ghost-btn { flex: 1; width: auto; margin: 0; }
.wide-modal { width: min(860px, 100%); }
.modal-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border: 0; background: #f1f1f5; border-radius: 9px; color: #666b77; font-size: 20px; }
.detail-title { font-size: 20px; margin: 0 0 8px; }
.detail-meta { color: var(--muted); font-size: 12px; line-height: 1.7; margin-bottom: 14px; }
.detail-content { color: #444956; font-size: 13px; line-height: 1.8; white-space: pre-wrap; }
.score-line { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #f0f1f4; font-size: 12px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: #292632; color: white; padding: 11px 16px; border-radius: 10px; z-index: 200; font-size: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18); }
.bottom-nav { display: none; }
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .two-columns, .analytics-grid { grid-template-columns: 1fr; }
  .card-grid, .scenario-grid { grid-template-columns: 1fr; }
  .top-nav { display: none; }
  .app-header { height: 62px; }
  .main-panel { padding: 18px 14px 86px; }
  #trainerFrame { height: calc(100vh - 220px); min-height: 560px; }
  .role-form { grid-template-columns: 1fr; }
  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    background: white;
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-btn { flex: 1; border: 0; background: transparent; color: #858a96; font-size: 11px; padding: 8px 2px; border-radius: 8px; }
  .bottom-btn.active { color: var(--primary); background: var(--primary-soft); font-weight: 800; }
}
@media (max-width: 520px) {
  .login-card { padding: 26px 20px; }
  .page-heading h2 { font-size: 21px; }
  .stat-grid { gap: 8px; }
  .stat-card { padding: 13px; }
  .stat-value { font-size: 22px; }
}
