/* 生物小步练管理后台样式：浅色、密度偏高的表格型后台，与小程序端绿色调保持一致 */
:root {
  --brand: #3f6b4f;
  --brand-deep: #2f5540;
  --brand-soft: #eef4ec;
  --ink: #22302a;
  --ink-2: #5c6b63;
  --ink-3: #8a988f;
  --line: #e4e9e3;
  --bg: #f6f8f5;
  --panel: #ffffff;
  --red: #b4453f;
  --amber: #a97718;
  --green: #3d7a53;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(28, 46, 37, 0.05), 0 8px 24px rgba(28, 46, 37, 0.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; }
h3 { font-size: 15px; }
h4 { font-size: 13px; color: var(--ink-2); margin: 18px 0 8px; letter-spacing: .02em; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--ink-2); }
.muted { color: var(--ink-3); font-size: 12px; }
.small { font-size: 11px; }
.error { color: var(--red); font-size: 13px; margin: 8px 0 0; }
.right { text-align: right; }
.spacer { flex: 1; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(1200px 600px at 20% -10%, #e7f0e6 0%, transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 32px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 22px; margin: 20px 0 6px; }
.login-card p { margin: 0 0 18px; }
.login-card label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 12px; }
.login-card input { width: 100%; margin-top: 6px; }
.login-card .foot { margin: 16px 0 0; text-align: center; font-size: 11px; color: var(--ink-3); }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; }
.brand strong { display: block; font-size: 14px; letter-spacing: .02em; }
.brand small { display: block; font-size: 11px; color: var(--ink-3); }
.brand.small .brand-mark { width: 28px; height: 28px; font-size: 14px; border-radius: 8px; }

/* 框架 */
.layout { display: flex; min-height: 100vh; }
.side { width: 208px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.side nav { margin-top: 18px; display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.side nav a { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: 8px;
  color: var(--ink-2); font-size: 13px; cursor: pointer; user-select: none; transition: background .15s, color .15s; }
.side nav a:hover { background: var(--brand-soft); color: var(--brand-deep); }
.side nav a.active { background: var(--brand); color: #fff; }
.side nav a .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .45; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; font-size: 12px; }
.side-foot .who { font-weight: 600; color: var(--ink); }
.side-foot .role { color: var(--ink-3); margin-bottom: 8px; font-size: 11px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 58px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.crumbs { display: flex; align-items: baseline; gap: 10px; }
.crumbs strong { font-size: 15px; }
.content { padding: 20px 24px 48px; }

/* 通用块 */
.stack { display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.panel-head h3 { display: flex; align-items: center; gap: 8px; }
.panel-sub { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1080px) { .grid-2 { grid-template-columns: 1fr; } }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1080px) { .cards { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); }
.stat span { font-size: 12px; color: var(--ink-3); }
.stat strong { display: block; font-size: 26px; font-weight: 650; letter-spacing: -.01em; margin: 2px 0; }
.stat em { font-style: normal; font-size: 11px; color: var(--ink-3); }

.notice { border-radius: var(--radius); padding: 10px 14px; font-size: 12.5px;
  background: #f3f7f1; border: 1px solid #dbe7d8; color: var(--brand-deep); }
.notice.warn { background: #fdf7e9; border-color: #f0e2bd; color: #7d5c12; }

/* 表单控件 */
input, select, textarea {
  font-family: inherit; font-size: 13px; color: var(--ink); background: #fff;
  border: 1px solid #d9e0d7; border-radius: 8px; padding: 7px 10px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(63, 107, 79, .12); }
input[disabled] { background: #f4f6f3; color: var(--ink-3); }
textarea { width: 100%; resize: vertical; line-height: 1.6; }
label { font-size: 12px; color: var(--ink-2); }
label.inline { display: inline-flex; align-items: center; gap: 6px; }
label.checkbox { margin-right: 12px; }
label.checkbox input { width: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; }
.form-grid label.checkbox { flex-direction: row; align-items: center; }
.opt-row { flex-direction: row !important; align-items: center; gap: 8px; }
.opt-row input[type=text], .opt-row input:not([type]) { flex: 1; }
.opt-label { width: 18px; font-weight: 600; color: var(--brand-deep); }

.btn { font-family: inherit; font-size: 13px; border-radius: 8px; border: 1px solid #d6ded3;
  background: #fff; color: var(--ink); padding: 7px 13px; cursor: pointer; transition: all .15s; white-space: nowrap; }
.btn:hover { border-color: var(--brand); color: var(--brand-deep); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.btn.ghost { border-color: transparent; color: var(--ink-2); background: transparent; }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { color: var(--red); border-color: #ecd6d3; }
.btn.danger:hover { background: #fbf0ef; border-color: var(--red); }
.btn.tiny { font-size: 12px; padding: 4px 9px; border-radius: 7px; }
.btn.block { width: 100%; padding: 9px; margin-top: 6px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar input:not([type=file]) { min-width: 180px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; background: var(--panel); font-size: 13px; }
table.mini { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--ink-2); background: #fafbf9; white-space: nowrap; }
tbody tr:hover { background: #fafcfa; }
tbody tr:last-child td { border-bottom: none; }
table.mini th, table.mini td { padding: 7px 10px; font-size: 12.5px; }
.stem-cell { max-width: 480px; }
.stem-cell span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stem-cell code { display: block; margin-top: 2px; font-size: 11px; }
.detail-cell { max-width: 320px; word-break: break-all; color: var(--ink-3); font-size: 11.5px; }
.thumb { width: 40px; height: 32px; object-fit: cover; border-radius: 5px; margin-right: 8px;
  border: 1px solid var(--line); vertical-align: middle; cursor: zoom-in; }

.chip { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 20px; border: 1px solid transparent; }
.chip.green { background: #eef6ef; color: var(--green); border-color: #d8e9dc; }
.chip.red { background: #fbeeed; color: var(--red); border-color: #f0d8d5; }
.chip.amber { background: #fdf6e6; color: var(--amber); border-color: #f0e2bd; }
.chip.gray { background: #f3f5f2; color: var(--ink-3); border-color: #e6eae4; }
.rate { font-weight: 600; }
.rate.green { color: var(--green); }
.rate.amber { color: var(--amber); }
.rate.red { color: var(--red); }
.rate.gray { color: var(--ink-3); }

.pager { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-3); }
.picker { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow: auto; }
.pick-list { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow: auto; margin: 8px 0; }
.pick-item { display: flex; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 6px; font-size: 12.5px; }
.pick-item:hover { background: var(--brand-soft); }
.pick-item span { flex: 1; }

/* 看板图表 */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 168px; padding-top: 8px; }
.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar { width: 100%; max-width: 26px; background: linear-gradient(180deg, #6d9a7b, var(--brand)); border-radius: 4px 4px 2px 2px; }
.bar-label { font-size: 9px; color: var(--ink-3); margin-top: 6px; white-space: nowrap; transform: scale(.92); }

.kv { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin: 10px 0 6px; }
@media (max-width: 900px) { .kv { grid-template-columns: repeat(3, 1fr); } }
.kv div { background: #fafbf9; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.kv span { display: block; font-size: 11px; color: var(--ink-3); }
.kv strong { font-size: 18px; }

.ability { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12px; }
.ability > span { width: 72px; color: var(--ink-2); }
.ability-bar { flex: 1; height: 8px; background: #eef1ec; border-radius: 6px; overflow: hidden; }
.ability-bar div { height: 100%; background: linear-gradient(90deg, #7fa98b, var(--brand)); border-radius: 6px; }
.ability em { width: 56px; text-align: right; font-style: normal; color: var(--ink-3); }

.loading { padding: 40px; text-align: center; color: var(--ink-3); }
.toast { position: fixed; top: 18px; right: 18px; z-index: 100; padding: 9px 16px; border-radius: 8px;
  font-size: 13px; color: #fff; background: var(--brand-deep); box-shadow: 0 8px 24px rgba(0,0,0,.16); }
.toast.err { background: var(--red); }

/* 弹层 */
.modal-mask { position: fixed; inset: 0; background: rgba(24, 36, 30, .38); display: flex; align-items: flex-start;
  justify-content: center; padding: 40px 20px; z-index: 50; overflow: auto; }
.modal { width: 100%; max-width: 720px; background: #fff; border-radius: 14px; padding: 20px 22px;
  box-shadow: 0 24px 60px rgba(20, 34, 27, .22); }
.errors { margin-top: 8px; max-height: 160px; overflow: auto; font-size: 12px; color: var(--red); }
.preview { max-width: 100%; max-height: 160px; border-radius: 8px; border: 1px solid var(--line); }
.preview.small { max-width: 72px; max-height: 56px; }
