:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --line: #e6e9ef;
  --text: #1f2733;
  --muted: #8a94a6;
  --primary: #2f6fed;
  --primary-d: #2257c4;
  --ok: #19a974;
  --warn: #e08a00;
  --danger: #e04b4b;
  --shadow: 0 2px 10px rgba(20, 30, 50, .06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); background: var(--bg); }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12px; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 6px; }

/* 登录 */
.login-wrap { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 340px; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); padding: 28px 24px; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card .sub { margin: 0 0 20px; color: var(--muted); }
.login-card input { width: 100%; padding: 12px 14px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; }
.login-card button { width: 100%; padding: 12px; border: 0; border-radius: 10px; background: var(--primary); color: #fff; font-size: 16px; font-weight: 600; }
.login-card .hint { margin: 14px 0 0; font-size: 11px; color: var(--muted); line-height: 1.5; }

/* 框架 */
.app { display: flex; min-height: 100%; }
.side { width: 210px; background: #1f2733; color: #cfd6e2; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { font-size: 18px; font-weight: 700; color: #fff; padding: 18px 18px 10px; }
.side nav { flex: 1; overflow-y: auto; padding: 6px; }
.nav-item { padding: 11px 14px; border-radius: 9px; cursor: pointer; font-size: 14px; margin-bottom: 2px; display: flex; align-items: center; gap: 8px; }
.nav-item:hover { background: rgba(255,255,255,.06); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-group { font-size: 11px; color: #6b7689; padding: 12px 14px 4px; }
.who { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); }
.who #whoName { font-size: 14px; color: #fff; }
.link { background: none; border: 0; color: #8fb0ff; cursor: pointer; padding: 4px 0 0; font-size: 12px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.page-title { font-size: 18px; font-weight: 600; padding: 16px 22px; background: var(--panel); border-bottom: 1px solid var(--line); }
.content { padding: 18px 22px; flex: 1; }

/* 卡片/看板 */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.card { background: var(--panel); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.card .k { color: var(--muted); font-size: 13px; }
.card .v { font-size: 24px; font-weight: 700; margin-top: 6px; }
.card .v.green { color: var(--ok); }
.card .v.blue { color: var(--primary); }
.card .v.orange { color: var(--warn); }

/* 看板图表 */
.chart-card { background: var(--panel); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); margin-top: 14px; }
.chart-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: #2a3340; }
.chart-box { width: 100%; min-height: 200px; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.chart-grid .chart-card { margin-top: 14px; }
.chart-grid .chart-card:first-child { margin-right: 7px; }
.chart-grid .chart-card:last-child { margin-left: 7px; }
.chart-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 40px 0; }
@media (max-width: 720px) {
  .chart-grid { grid-template-columns: 1fr; }
  .chart-grid .chart-card { margin-left: 0 !important; margin-right: 0 !important; }
}

/* 表格 */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { background: #fafbfd; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; background: #eef2f8; color: #4a566b; }
.tag.green { background: #e4f6ee; color: var(--ok); }
.tag.blue { background: #e6eefe; color: var(--primary); }
.tag.orange { background: #fdf0db; color: var(--warn); }
.tag.red { background: #fde8e8; color: var(--danger); }

/* 按钮 */
button.btn, .btn { padding: 9px 16px; border: 0; border-radius: 9px; background: var(--primary); color: #fff; font-size: 14px; cursor: pointer; }
.btn.ghost { background: #eef2f8; color: #4a566b; }
.btn.sm { padding: 6px 12px; font-size: 12px; }
.btn.ok { background: var(--ok); }
.btn.danger { background: var(--danger); }
.row-actions { display: flex; gap: 6px; }

/* 模态 */
.modal { position: fixed; inset: 0; background: rgba(15,22,35,.45); display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 50; }
.modal-box { width: 100%; max-width: 460px; background: #fff; border-radius: 14px; padding: 20px; max-height: 86vh; overflow-y: auto; }
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.modal-body input, .modal-body select, .modal-body textarea { width: 100%; padding: 10px 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.field-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.field-row input { margin-bottom: 0; flex: 1; }
.field-row .q { width: 90px; flex: none; }

/* 移动端 */
@media (max-width: 720px) {
  .side { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .brand { width: 100%; }
  .side nav { display: flex; flex-wrap: wrap; width: 100%; }
  .nav-item { padding: 8px 12px; font-size: 13px; }
  .nav-group { display: none; }
  .who { width: 100%; display: flex; gap: 10px; align-items: center; }
  .app { flex-direction: column; }
  th, td { padding: 9px 10px; font-size: 12px; }
  .content { padding: 12px; }
}
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1f2733; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; z-index: 99; }
