:root {
  --c-primary: #2563eb;
  --c-primary-deep: #1d4ed8;
  --c-primary-soft: #eaf1fe;
  --c-bg: #f4f6fa;
  --c-surface: #ffffff;
  --c-line: #e4e8f0;
  --c-text: #1f2937;
  --c-text-2: #6b7280;
  --c-text-3: #9ca3af;
  --c-green: #16a34a;
  --c-green-soft: #e8f7ee;
  --c-orange: #d97706;
  --c-orange-soft: #fdf3e3;
  --c-red: #dc2626;
  --c-red-soft: #fdecec;
  --c-purple: #7c3aed;
  --c-purple-soft: #f3ecfd;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 4px 14px rgba(15, 23, 42, .05);
  --ff: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body { font-family: var(--ff); background: var(--c-bg); color: var(--c-text); font-size: 14px; line-height: 1.6; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; border-radius: 4px; }

/* ===== 顶部切换条 ===== */
.proto-bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  background: #0f1b33; color: #fff; padding: 10px 20px;
}
.proto-bar .brand { font-weight: 700; font-size: 15px; letter-spacing: .5px; }
.proto-bar .brand small { font-weight: 400; opacity: .65; margin-left: 8px; font-size: 12px; }
.proto-tabs { display: flex; gap: 6px; margin-left: 12px; }
.proto-tabs button {
  background: rgba(255,255,255,.08); color: #cbd5e1; border: 0;
  padding: 7px 18px; border-radius: 999px; font-size: 13px;
}
.proto-tabs button[aria-selected="true"] { background: var(--c-primary); color: #fff; font-weight: 600; }
.proto-note { margin-left: auto; font-size: 12px; color: #94a3b8; }

/* ===== 视图切换 ===== */
.view { display: none; }
.view.active { display: block; }

/* ===================== 机构端 Web ===================== */
.org-shell { display: flex; min-height: calc(100vh - 45px); }
.org-side {
  width: 208px; flex: none; background: var(--c-surface);
  border-right: 1px solid var(--c-line); padding: 16px 10px;
}
.org-side .tenant {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px;
  border-bottom: 1px solid var(--c-line); margin-bottom: 12px;
}
.tenant .logo {
  width: 34px; height: 34px; border-radius: 8px; background: var(--c-primary);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.tenant b { font-size: 14px; display: block; line-height: 1.3; }
.tenant span { font-size: 11px; color: var(--c-text-3); }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: none; color: var(--c-text-2);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; text-align: left;
}
.nav-item .ico { width: 18px; text-align: center; }
.nav-item:hover { background: var(--c-bg); color: var(--c-text); }
.nav-item[aria-selected="true"] { background: var(--c-primary-soft); color: var(--c-primary-deep); font-weight: 600; }
.nav-item .badge {
  margin-left: auto; background: var(--c-red); color: #fff;
  font-size: 11px; border-radius: 999px; padding: 0 7px; line-height: 18px;
}
.org-main { flex: 1; padding: 24px 28px; min-width: 0; }
.org-page { display: none; }
.org-page.active { display: block; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-head h1 { font-size: 20px; font-weight: 700; }
.page-head .sub { color: var(--c-text-2); font-size: 13px; margin-top: 2px; }

/* 卡片与统计 */
.card { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { padding: 16px 18px; }
.stat .label { color: var(--c-text-2); font-size: 13px; }
.stat .num { font-size: 26px; font-weight: 700; margin: 4px 0 2px; }
.stat .delta { font-size: 12px; color: var(--c-text-3); }
.stat .delta.up { color: var(--c-green); }
.stat .num.warn { color: var(--c-orange); }

.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--c-line); }
.panel-head h2 { font-size: 15px; font-weight: 600; }
.panel-head a { font-size: 12px; color: var(--c-primary); text-decoration: none; }
.panel-body { padding: 8px 18px 16px; }

/* 列表行 */
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--c-line); }
.row:last-child { border-bottom: 0; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600;
}
.avatar.b1 { background: #3b82f6; } .avatar.b2 { background: #10b981; }
.avatar.b3 { background: #f59e0b; } .avatar.b4 { background: #8b5cf6; }
.row .info { flex: 1; min-width: 0; }
.row .info b { font-size: 14px; display: block; }
.row .info span { font-size: 12px; color: var(--c-text-2); }
.time-chip { font-size: 12px; color: var(--c-text-2); background: var(--c-bg); border-radius: var(--radius-sm); padding: 3px 9px; }

/* 徽章状态 */
.chip { display: inline-flex; align-items: center; justify-content: center; font-size: 12px; border-radius: 999px; padding: 3px 10px; line-height: 1.4; white-space: nowrap; }
.chip.green { background: var(--c-green-soft); color: var(--c-green); }
.chip.orange { background: var(--c-orange-soft); color: var(--c-orange); }
.chip.red { background: var(--c-red-soft); color: var(--c-red); }
.chip.blue { background: var(--c-primary-soft); color: var(--c-primary-deep); }
.chip.gray { background: var(--c-bg); color: var(--c-text-2); }
.chip.purple { background: var(--c-purple-soft); color: var(--c-purple); }

/* 按钮 */
.btn {
  border: 1px solid var(--c-line); background: var(--c-surface); color: var(--c-text);
  border-radius: var(--radius-sm); padding: 7px 16px; font-size: 13px;
}
.btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.btn.primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn.primary:hover { background: var(--c-primary-deep); }
.btn.sm { padding: 4px 12px; font-size: 12px; }
.btn.ghost-danger { color: var(--c-red); border-color: #f3c1c1; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* 表格 */
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; color: var(--c-text-2); font-weight: 500; padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid var(--c-line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--c-line); font-size: 13px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.field label { display: block; font-size: 13px; color: var(--c-text-2); margin-bottom: 6px; }
.field label i { color: var(--c-red); font-style: normal; margin-left: 2px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--c-line); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 14px; font-family: inherit; background: #fff; color: var(--c-text);
}
.field textarea { resize: vertical; min-height: 72px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--c-primary); outline: none; box-shadow: 0 0 0 3px var(--c-primary-soft); }
.form-actions { margin-top: 20px; display: flex; gap: 12px; align-items: center; }

/* 冲突提示条 */
.alert { display: none; border-radius: var(--radius-sm); padding: 12px 16px; font-size: 13px; margin: 14px 0; }
.alert.show { display: flex; gap: 10px; align-items: flex-start; }
.alert.warn { background: var(--c-orange-soft); color: #92610a; border: 1px solid #f3ddb3; }
.alert.danger { background: var(--c-red-soft); color: #a51f1f; border: 1px solid #f3c1c1; }
.alert b { font-weight: 700; }
.alert .tag { flex: none; font-size: 11px; border-radius: 4px; padding: 1px 6px; margin-top: 2px; }
.alert .tag.block { background: var(--c-red); color: #fff; }
.alert .tag.soft { background: var(--c-orange); color: #fff; }

/* 状态机操作列 */
.op-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* 结算快照注解 */
.snap-note { font-size: 12px; color: var(--c-text-2); background: var(--c-primary-soft); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 12px; }
.snap-note b { color: var(--c-primary-deep); }

/* ===================== 手机端（老师 / 家长） ===================== */
.phone-wrap { display: flex; gap: 48px; justify-content: center; align-items: flex-start; padding: 34px 20px 60px; flex-wrap: wrap; }
.phone-col { text-align: center; }
.phone-col .cap { color: var(--c-text-2); font-size: 13px; margin-top: 14px; }
.phone {
  width: 375px; max-width: 94vw; height: 780px; background: var(--c-bg);
  border-radius: 34px; border: 10px solid #111827; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 24px 48px rgba(15,23,42,.22); text-align: left;
}
.p-status { background: var(--c-primary); color: #fff; display: flex; justify-content: space-between; padding: 8px 20px 4px; font-size: 12px; }
.p-head { background: var(--c-primary); color: #fff; padding: 10px 20px 16px; }
.p-head h1 { font-size: 18px; font-weight: 700; }
.p-head .p-sub { font-size: 12px; opacity: .8; margin-top: 2px; }
.p-body { flex: 1; overflow-y: auto; padding: 14px 14px 20px; }
.p-tabbar { display: flex; background: var(--c-surface); border-top: 1px solid var(--c-line); }
.p-tabbar button { flex: 1; border: 0; background: none; padding: 9px 0 12px; font-size: 11px; color: var(--c-text-3); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.p-tabbar button .ico { font-size: 19px; line-height: 1; }
.p-tabbar button[aria-selected="true"] { color: var(--c-primary); font-weight: 600; }
.p-page { display: none; }
.p-page.active { display: block; animation: fadeIn .18s ease; }

.p-card { background: var(--c-surface); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); margin-bottom: 12px; }
.p-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.p-lesson { display: flex; gap: 12px; }
.p-lesson .bar { width: 4px; border-radius: 4px; background: var(--c-primary); flex: none; }
.p-lesson .bar.done { background: var(--c-green); }
.p-lesson .bar.wait { background: var(--c-orange); }
.p-lesson > .chip { align-self: center; flex: none; }
.p-lesson b { font-size: 15px; }
.p-meta { font-size: 12px; color: var(--c-text-2); margin-top: 2px; }
.p-balance { display: flex; align-items: center; justify-content: space-between; }
.p-balance .big { font-size: 30px; font-weight: 700; }
.p-balance .big small { font-size: 13px; color: var(--c-text-2); font-weight: 400; }
.p-balance .big.low { color: var(--c-orange); }
.btn-block { width: 100%; padding: 12px; border: 0; border-radius: 10px; font-size: 15px; font-weight: 600; }
.btn-checkin { background: var(--c-green); color: #fff; }
.btn-checkin:disabled { background: #a7d7ba; }
.btn-submit { background: var(--c-primary); color: #fff; }
.p-field { margin-bottom: 14px; }
.p-field label { display: block; font-size: 13px; color: var(--c-text-2); margin-bottom: 6px; }
.p-field textarea, .p-field input { width: 100%; border: 1px solid var(--c-line); border-radius: 10px; padding: 10px 12px; font-size: 14px; font-family: inherit; }
.p-field textarea { min-height: 90px; resize: vertical; }
.stars { display: flex; gap: 6px; font-size: 26px; color: #d1d5db; cursor: pointer; user-select: none; }
.stars span.on { color: #f59e0b; }
.fb-quote { background: var(--c-bg); border-left: 3px solid var(--c-primary); border-radius: 0 8px 8px 0; padding: 10px 12px; font-size: 13px; margin-top: 8px; }
.fb-tag { font-size: 11px; color: var(--c-purple); background: var(--c-purple-soft); border-radius: 4px; padding: 1px 6px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 42px; transform: translateX(-50%) translateY(20px);
  background: #111827; color: #fff; padding: 10px 22px; border-radius: 999px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 弹窗（收款登记） */
.modal-mask { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 80; align-items: center; justify-content: center; }
.modal-mask.show { display: flex; }
.modal { background: var(--c-surface); border-radius: 14px; width: 480px; max-width: 92vw; padding: 22px 26px; box-shadow: 0 20px 50px rgba(15,23,42,.25); }
.modal h3 { font-size: 16px; margin-bottom: 16px; }

/* 聊天（7.4 沟通） */
.chat { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.msg { max-width: 80%; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.msg.me { align-self: flex-end; background: var(--c-primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.them { align-self: flex-start; background: var(--c-bg); border: 1px solid var(--c-line); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 8px; margin-top: 10px; }
.chat-input input { flex: 1; border: 1px solid var(--c-line); border-radius: 10px; padding: 9px 12px; font-size: 13px; font-family: inherit; }
.chat-input input:focus { border-color: var(--c-primary); outline: none; }

/* 成长档案时间线（4.3） */
.tl { position: relative; padding-left: 18px; }
.tl::before { content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--c-line); }
.tl-item { position: relative; padding: 0 0 13px 12px; font-size: 13px; }
.tl-item::before { content: ""; position: absolute; left: -18px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--c-primary); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--c-line); }
.tl-item .t { font-size: 11px; color: var(--c-text-3); margin-bottom: 1px; }

/* 商机阶段管道（3.2） */
.pipeline { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.pipeline .st { border-radius: 999px; padding: 3px 12px; background: var(--c-bg); color: var(--c-text-2); font-size: 12px; white-space: nowrap; }
.pipeline .st.done { background: var(--c-green-soft); color: var(--c-green); }
.pipeline .st.cur { background: var(--c-primary); color: #fff; font-weight: 600; }
.pipeline .arr { color: var(--c-text-3); font-size: 12px; }

/* 负课时标红（8.1） */
.neg { color: var(--c-red) !important; }

/* ===== 共用小程序：身份选择 / 登录绑定 ===== */
.m-screen { display: none; }
.m-screen.active { display: block; animation: fadeIn .18s ease; }
.m-steps { display: flex; gap: 14px; justify-content: center; margin-bottom: 16px; font-size: 11px; color: var(--c-text-3); }
.m-steps .on { color: var(--c-primary); font-weight: 600; }
.id-cards { display: flex; flex-direction: column; gap: 12px; }
.id-card { display: flex; align-items: center; gap: 14px; background: var(--c-surface); border: 2px solid var(--c-line); border-radius: 14px; padding: 15px 16px; cursor: pointer; transition: border-color .15s, background .15s; }
.id-card:hover { border-color: #b9ccf5; }
.id-card.sel { border-color: var(--c-primary); background: var(--c-primary-soft); }
.id-card .ic { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; color: #fff; flex: none; }
.id-card .ic.t { background: var(--c-green); }
.id-card .ic.p { background: var(--c-orange); }
.id-card b { display: block; font-size: 15px; }
.id-card span { font-size: 12px; color: var(--c-text-2); }
.id-card .check { margin-left: auto; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--c-line); flex: none; position: relative; }
.id-card.sel .check { background: var(--c-primary); border-color: var(--c-primary); }
.id-card.sel .check::after { content: "✓"; position: absolute; inset: 0; color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.wx-row { display: flex; align-items: center; gap: 10px; background: #f0fdf4; border: 1px solid #bbe7c8; border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 13px; cursor: pointer; }
.wx-row:hover { border-color: #7fd49a; }

/* 原型说明页 */
.doc-panel { max-width: 1080px; margin: 30px auto; padding: 26px 32px; }
.doc-panel h2 { font-size: 17px; margin-bottom: 12px; }
.doc-panel table { width: 100%; border-collapse: collapse; font-size: 13px; }
.doc-panel th, .doc-panel td { border: 1px solid var(--c-line); padding: 8px 12px; text-align: left; }
.doc-panel th { background: #f8fafc; }
.doc-panel ul { margin: 10px 0 0 18px; color: var(--c-text-2); font-size: 13px; }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .org-side { width: 64px; }
  .org-side .tenant b, .org-side .tenant span, .nav-item .txt, .nav-item .badge { display: none; }
}

/* 掌握情况四档选择（老师端反馈 · 与家长端控件同风格） */
.grade-row { display: flex; gap: 8px; }
.grade-row button { flex: 1; height: 34px; border-radius: 10px; border: 1px solid var(--c-line); background: #fff; color: var(--c-text-2); font-size: 13px; font-family: inherit; }
.grade-row button.on { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary-deep); font-weight: 600; }

/* ===== 管理端 · 平台超管（独立于租户体系 · 规格 2.1/2.2） ===== */
.admin-side .tenant .logo { background: #7c5cff; }
.admin-side .nav-item[aria-selected="true"] { background: rgba(124,92,255,.12); color: #5b3fd6; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th { text-align: left; padding: 11px 16px; font-size: 12px; color: var(--c-text-3); border-bottom: 1px solid var(--c-line); background: var(--c-bg); white-space: nowrap; }
table.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--c-line); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: 0; }
.td-sub { font-size: 11.5px; color: var(--c-text-3); margin-top: 2px; }
.bar-meter { flex: 1; height: 8px; border-radius: 4px; background: var(--c-bg); overflow: hidden; min-width: 60px; }
.bar-meter i { display: block; height: 100%; border-radius: 4px; background: var(--c-primary); }
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.plan { border: 1.5px solid var(--c-line); }
.plan.hot { border-color: #7c5cff; box-shadow: 0 4px 16px rgba(124,92,255,.15); }
.plan h3 { justify-content: flex-start; gap: 8px; }
.plan .p-meta { font-size: 12px; color: var(--c-text-3); margin-bottom: 8px; }
.plan ul { list-style: none; font-size: 13px; display: grid; gap: 6px; color: var(--c-text-2); }
.switch { position: relative; width: 40px; height: 22px; border-radius: 999px; border: 0; background: #cbd2dc; transition: background .2s; vertical-align: middle; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch.on { background: #7c5cff; }
.switch.on::after { transform: translateX(18px); }

/* 消息中心未读行 / 通知设置表 / 权限矩阵复选框 */
.row.notice { cursor: pointer; }
.row.notice.unread { background: var(--c-primary-soft); border-radius: 8px; padding: 4px 6px; margin: 0 -6px; }
table.notice-setting { width: 100%; border-collapse: collapse; }
table.notice-setting td { padding: 8px 0; font-size: 13.5px; }
table.notice-setting td:last-child { text-align: right; }
table.tbl input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--c-primary); cursor: pointer; }
table.tbl input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .45; }

/* 系统参数配置表单（管理端） */
.cfg-form { display: grid; gap: 9px; }
.cfg-form label { display: grid; gap: 4px; font-size: 12px; color: var(--c-text-2); }
.cfg-form input { border: 1px solid var(--c-line); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px; background: #fff; color: var(--c-text); }
.cfg-form input:focus { outline: 2px solid var(--c-primary); outline-offset: 0; border-color: var(--c-primary); }
