/* 智慧校园平台 · 设计系统（Utilitarian Governance）
   对齐原型 DESIGN.md 设计 token：主色 #0060ab、浅灰底、白卡片、药丸徽章、240px 侧栏、56px 顶栏、8px 圆角。 */

:root {
  --primary: #0060ab;
  --primary-container: #3296fa;
  --on-primary: #ffffff;
  --on-primary-container: #002d55;
  --primary-fixed: #d3e3ff;
  --surface: #f8f9fa;
  --surface-card: #ffffff;
  --surface-low: #f3f4f5;
  --surface-high: #e7e8e9;
  --surface-dim: #d9dadb;
  --border: #c0c7d5;
  --text-primary: #1D2129;
  --text-secondary: #86909C;
  --on-surface: #191c1d;
  --on-surface-variant: #404753;
  --success: #46B27C;
  --warning: #F6A53D;
  --danger: #F0534D;
  --secondary: #006d44;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 2px 8px rgba(0,0,0,0.05);
  --sidebar-w: 240px;
  --header-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hanken Grotesk", sans-serif;
  background: var(--surface); color: var(--text-primary);
  font-size: 14px; line-height: 22px; -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ===== 图标（内联 SVG 占位用 Unicode，避免外部字体依赖）===== */
.ico { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex: 0 0 20px; }

/* ===== 按钮 ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; transition: all .15s; line-height: 20px; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: #004a85; }
.btn-outline { border: 1px solid var(--border); color: var(--on-surface-variant); background: #fff; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fff; border: 1px solid #f5c2be; color: var(--danger); }
.btn-danger:hover { background: #fff5f4; }
.btn-ghost { color: var(--on-surface-variant); }
.btn-ghost:hover { color: var(--primary); background: var(--surface-high); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== 药丸徽章 ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; line-height: 18px; font-weight: 500; }
.badge-green { background: #e3f6ec; color: #1c7a4a; }
.badge-orange { background: #fdf1e0; color: #b76e00; }
.badge-red { background: #fdebea; color: #c0352e; }
.badge-blue { background: #e6f1fb; color: var(--primary); }
.badge-gray { background: #eef0f2; color: var(--text-secondary); }

/* ===== 登录页 ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(135deg, #e6f1fb 0%, #f3f4f5 100%); position: relative; overflow: hidden; }
.login-card { width: 420px; max-width: 100%; background: var(--surface-card); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.08); border: 1px solid var(--surface-high); overflow: hidden; }
.login-accent { height: 4px; background: linear-gradient(90deg, var(--primary), var(--primary-container)); }
.login-body { padding: 40px 40px 32px; }
.login-logo { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 16px; background: #e6f1fb; display: flex; align-items: center; justify-content: center; color: var(--primary); font-size: 30px; font-weight: 700; }
.login-title { text-align: center; font-size: 20px; font-weight: 600; color: var(--on-surface); }
.login-sub { text-align: center; font-size: 13px; color: var(--text-secondary); margin-top: 4px; margin-bottom: 24px; }
.qr-frame { width: 180px; height: 180px; margin: 0 auto 20px; border: 1px dashed var(--border); border-radius: 12px; background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); flex-direction: column; gap: 8px; position: relative; overflow: hidden; }
.qr-frame .qr-grid { font-size: 60px; color: var(--primary); opacity: .25; letter-spacing: 4px; font-family: monospace; }
.scan-line { position: absolute; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--primary), transparent); animation: scan 2s linear infinite; }
@keyframes scan { 0% { top: 0; } 100% { top: 100%; } }
.login-hint { text-align: center; font-size: 13px; color: var(--primary); margin-bottom: 20px; }
.identity-picker { display: flex; flex-direction: column; gap: 8px; }
.identity-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; transition: all .15s; text-align: left; }
.identity-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.identity-avatar { width: 36px; height: 36px; border-radius: 50%; background: #e6f1fb; color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 600; flex: 0 0 36px; }
.identity-name { font-weight: 500; }
.identity-role { font-size: 12px; color: var(--text-secondary); }

/* ===== 主布局 ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 16px 0; z-index: 40; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 24px 20px; }
.brand-logo { width: 40px; height: 40px; border-radius: 8px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; flex: 0 0 40px; }
.brand-name { font-size: 16px; font-weight: 600; color: var(--primary); }
.brand-sub { font-size: 12px; color: var(--text-secondary); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0 8px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; margin: 2px 0; border-radius: var(--radius); color: var(--on-surface-variant); font-size: 14px; cursor: pointer; transition: all .15s; }
.nav-item:hover { background: var(--surface-high); }
.nav-item.active { background: #e6f1fb; color: var(--primary); font-weight: 600; }
.nav-item .badge-count { margin-left: auto; background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 6px; line-height: 16px; }

.header { position: fixed; top: 0; right: 0; left: var(--sidebar-w); height: var(--header-h); background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; z-index: 30; }
.header-title { font-size: 20px; font-weight: 600; color: var(--on-surface); }
.header-right { display: flex; align-items: center; gap: 16px; }
.campus-switch { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; color: var(--on-surface-variant); cursor: pointer; position: relative; }
.campus-switch:hover { border-color: var(--primary); color: var(--primary); }
.user-chip { display: flex; align-items: center; gap: 10px; cursor: pointer; position: relative; }

/* ===== 下拉面板 ===== */
.dropdown-panel { position: absolute; right: 0; top: 44px; min-width: 220px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 120; overflow: hidden; }
.dropdown-title { padding: 10px 14px; font-size: 12px; color: var(--text-secondary); border-bottom: 1px solid var(--surface-high); font-weight: 600; }
.dropdown-item { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 14px; cursor: pointer; transition: background .12s; }
.dropdown-item:hover { background: var(--surface-low); }
.dropdown-item.active { color: var(--primary); font-weight: 600; background: #f0f7ff; }
.dropdown-user-info { padding: 12px 14px; font-size: 13px; line-height: 1.5; color: var(--on-surface-variant); border-bottom: 1px solid var(--surface-high); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: #e6f1fb; color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 600; }
.user-meta { text-align: left; }
.user-meta .nm { font-size: 13px; font-weight: 500; }
.user-meta .rl { font-size: 11px; color: var(--text-secondary); }

.main { flex: 1; margin-left: var(--sidebar-w); margin-top: var(--header-h); padding: 24px; }
.main-inner { max-width: 1152px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

/* ===== 卡片 ===== */
.card { background: var(--surface-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.card-title { font-size: 20px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }
.card-sub { font-size: 13px; color: var(--text-secondary); font-weight: 400; }

/* ===== 工作台横幅 ===== */
.banner { background: var(--surface-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; display: flex; align-items: center; justify-content: space-between; }
.banner h2 { font-size: 28px; font-weight: 600; margin-bottom: 8px; }
.banner p { color: var(--text-secondary); }
.banner p strong { color: var(--primary); }
.banner-art { width: 180px; height: 110px; border-radius: 8px; background: #e6f1fb; display: flex; align-items: center; justify-content: center; color: var(--primary); font-size: 48px; opacity: .8; }

/* ===== 统计卡 ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card { background: var(--surface-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; justify-content: space-between; min-height: 120px; cursor: pointer; transition: box-shadow .15s; }
.stat-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.stat-label { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 14px; }
.stat-value { font-size: 30px; font-weight: 600; }

/* ===== 应用网格 ===== */
.app-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.app-card { border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; cursor: pointer; transition: transform .15s; border: 1px solid transparent; }
.app-card:hover { transform: translateY(-2px); }
.app-icon { width: 48px; height: 48px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; box-shadow: var(--shadow); }

/* ===== 列表/表格 ===== */
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--surface-high); cursor: pointer; transition: background .15s; }
.list-item:hover { background: var(--surface-low); }
.list-item:last-child { border-bottom: none; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-meta { font-size: 12px; color: var(--text-secondary); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--surface-high); }
th { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
tbody tr:hover { background: var(--surface-low); }

/* ===== 时间线 ===== */
.timeline { position: relative; padding-left: 24px; }
.timeline-item { position: relative; padding-bottom: 24px; }
.timeline-item::before { content: ''; position: absolute; left: -17px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.timeline-item::after { content: ''; position: absolute; left: -13px; top: 14px; bottom: -2px; width: 2px; background: var(--surface-high); }
.timeline-item:last-child::after { display: none; }
.timeline-item.done::before { background: var(--success); }
.timeline-item.active::before { background: var(--primary); box-shadow: 0 0 0 4px #e6f1fb; }
.timeline-item.reject::before { background: var(--danger); }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-title { font-weight: 600; }
.tl-opinion { margin-top: 4px; color: var(--text-secondary); background: var(--surface-low); padding: 6px 10px; border-radius: 6px; font-size: 13px; }
.tl-time { font-size: 12px; color: var(--text-secondary); }

/* ===== 表单 ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-item { display: flex; flex-direction: column; gap: 6px; }
.form-item.full { grid-column: 1 / -1; }
.form-label { font-size: 13px; color: var(--on-surface-variant); }
.form-label .req { color: var(--danger); }
.form-input, .form-select, .form-textarea { padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); outline: none; transition: border .15s; background: #fff; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px #e6f1fb; }
.form-textarea { min-height: 88px; resize: vertical; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 12px; justify-content: flex-end; padding-top: 8px; }
.form-read { background: var(--surface-low); padding: 10px 12px; border-radius: 6px; }

/* ===== 部门树 ===== */
.tree-node { padding: 4px 0; }
.tree-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.tree-row:hover { background: var(--surface-low); }
.tree-caret { width: 16px; text-align: center; color: var(--text-secondary); font-size: 12px; }
.tree-children { padding-left: 22px; }
.tag { font-size: 11px; padding: 1px 8px; border-radius: 999px; }
.tag-campus { background: #e6f1fb; color: var(--primary); }
.tag-class { background: #e3f6ec; color: #1c7a4a; }
.tag-grade { background: #fdf1e0; color: #b76e00; }

/* ===== 弹层 ===== */
.overlay { position: fixed; inset: 0; background: rgba(25,28,29,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 12px; width: 480px; max-width: calc(100vw - 32px); max-height: 86vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.modal-head { padding: 20px 24px 0; font-size: 18px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 20px 24px; }
.modal-foot { padding: 0 24px 24px; display: flex; gap: 12px; justify-content: flex-end; }

/* ===== 提示 ===== */
.toast-wrap { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #323233; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.2); animation: toastIn .2s; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--success); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== 空态 ===== */
.empty { text-align: center; color: var(--text-secondary); padding: 40px 0; }

/* ===== 看板 ===== */
.kpi-row { display: flex; gap: 16px; flex-wrap: wrap; }
.kpi { flex: 1; min-width: 150px; background: var(--surface-low); border-radius: var(--radius); padding: 16px; }
.kpi .k { font-size: 13px; color: var(--text-secondary); }
.kpi .v { font-size: 26px; font-weight: 600; margin-top: 4px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-label { width: 90px; font-size: 13px; color: var(--on-surface-variant); flex: 0 0 90px; }
.bar-track { flex: 1; height: 14px; background: var(--surface-low); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 999px; }

/* ===== 流程编辑器（需求3）===== */
.flow-toolbar { display: flex; gap: 8px; margin-bottom: 16px; }
.flow-start-node, .flow-end-node { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-radius: var(--radius); font-weight: 600; }
.flow-start-node { background: #f0f7ff; color: var(--primary); border: 1px dashed var(--primary); }
.flow-end-node { background: #e3f6ec; color: #1c7a4a; border: 1px dashed var(--success); }
.flow-arrow { text-align: center; color: var(--text-secondary); font-size: 18px; line-height: 1; padding: 4px 0; }
.flow-node-list { display: flex; flex-direction: column; gap: 8px; }
.flow-node { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; cursor: grab; transition: box-shadow .12s; }
.flow-node:hover { box-shadow: var(--shadow); border-color: var(--primary-container); }
.flow-node-drag { display: flex; align-items: center; padding: 0 8px; color: var(--text-secondary); cursor: grab; border-right: 1px solid var(--surface-high); font-size: 14px; letter-spacing: -2px; }
.flow-node-body { flex: 1; padding: 10px 14px; }
.flow-node-head { display: flex; align-items: center; gap: 8px; }
.flow-node-tools { margin-left: auto; display: flex; gap: 2px; }
.flow-node-approver { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.flow-branch { margin: 12px 0; padding: 12px; border: 1px solid #f5cfa0; border-radius: var(--radius); background: #fffaf2; }
.flow-branch-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.flow-inline { padding: 4px 8px; font-size: 13px; min-width: 80px; }
.btn-ghost { color: var(--text-secondary); padding: 4px; border-radius: 4px; display: inline-flex; }
.btn-ghost:hover { color: var(--primary); background: var(--surface-high); }

/* ===== 移动端适配（H5 一套自适应页面）===== */
@media (max-width: 768px) {
  .sidebar { width: 64px; }
  .sidebar-brand { padding: 0 12px 16px; justify-content: center; }
  .brand-name, .brand-sub, .nav-text, .nav-item .badge-count { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .header { left: 64px; padding: 0 12px; }
  .header-title { font-size: 16px; }
  .user-meta, .header-right .campus-switch { display: none; }
  .main { margin-left: 64px; padding: 12px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .app-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .banner-art { display: none; }
}
