:root {
  --brand: #2D6CDF;
  --brand-dark: #1D4ED8;
  --brand-light: #EEF3FC;
  --ink: #1F2937;
  --sub: #6B7280;
  --line: #E5E7EB;
  --green: #10B981;
  --yellow: #F59E0B;
  --red: #EF4444;
  --bg: #F6F8FC;
  --card: #FFFFFF;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Microsoft YaHei", "PingFang SC", sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #2D6CDF 0%, #1D4ED8 55%, #173FA8 100%); }
.login-card { background: #fff; border-radius: 16px; padding: 40px 44px; width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-card h1 { font-size: 22px; color: var(--brand); margin-bottom: 4px; letter-spacing: 1px; }
.login-card .slogan { color: var(--sub); font-size: 12px; margin-bottom: 26px; }
.login-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.login-tabs button { flex: 1; padding: 9px; border: 1px solid var(--line); background: #fff; border-radius: 8px; font-size: 14px; }
.login-tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
.field textarea { min-height: 72px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(45,108,223,.12); }
.btn-primary { width: 100%; padding: 11px; background: var(--brand); color: #fff; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; margin-top: 6px; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-dingtalk { width: 100%; padding: 11px; background: #0089FF; color: #fff; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; margin-top: 8px; }
.btn-dingtalk:hover { background: #0073D9; }
.demo-hint { margin-top: 18px; background: var(--brand-light); border-radius: 8px; padding: 10px 14px; font-size: 12px; color: #3B5BA5; line-height: 1.8; }
.captcha-box { display: flex; align-items: center; gap: 10px; }
.captcha-q { font-size: 15px; font-weight: 700; color: var(--brand-dark); background: var(--brand-light); border: 1px solid #C9D6EE; border-radius: 8px; padding: 8px 14px; white-space: nowrap; letter-spacing: .5px; }
.captcha-box input { flex: 1; width: auto; }
.captcha-refresh { color: var(--brand); font-size: 18px; text-decoration: none; font-weight: 700; padding: 0 4px; cursor: pointer; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 216px; background: #152238; color: #C7D2E5; padding: 20px 0; flex-shrink: 0; position: sticky; top: 0; height: 100vh; }
.logo { padding: 0 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.logo b { color: #fff; font-size: 17px; letter-spacing: 1px; display: block; }
.logo span { font-size: 11px; color: #8FA3C4; }
.nav { margin-top: 14px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 11px 20px; color: #C7D2E5; font-size: 14px; border-left: 3px solid transparent; }
.nav a.on { background: rgba(45,108,223,.22); color: #fff; border-left-color: var(--brand); }
.nav a:hover { color: #fff; }
.main { flex: 1; padding: 24px 28px; max-width: 1320px; margin: 0 auto; width: 100%; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.topbar h2 { font-size: 20px; }
.pwd-banner { background: #FFF7E6; border: 1px solid #F59E0B; color: #92400E; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }
.userchip { display: flex; align-items: center; gap: 10px; background: #fff; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); }
.rolebadge { color: #fff; font-size: 11px; padding: 3px 9px; border-radius: 999px; }
.userchip a { font-size: 12px; color: var(--sub); }

/* 卡片 */
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 18px; }
.kpi { background: var(--card); border-radius: var(--radius); padding: 16px 18px; border: 1px solid var(--line); }
.kpi .v { font-size: 26px; font-weight: 700; color: var(--brand); }
.kpi .l { font-size: 12px; color: var(--sub); margin-top: 2px; }
.kpi.clickable { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.kpi.clickable:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08); transform: translateY(-2px); border-color: var(--brand); }
.minibar.clickable { cursor: pointer; border-radius: 6px; padding: 2px 4px; margin-left: -4px; }
.minibar.clickable:hover { background: #f1f5f9; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: #f1f5f9; }
.card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); padding: 18px 20px; margin-bottom: 16px; }
.card h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; padding: 10px 0; }
  .logo { padding: 4px 16px 8px; }
  .nav { display: flex; flex-wrap: wrap; margin-top: 4px; padding: 0 8px; gap: 2px; }
  .nav a { border-left: none; border-bottom: 3px solid transparent; padding: 9px 14px; }
  .nav a.on { border-bottom-color: var(--brand); background: transparent; }
  .main { padding: 16px; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .tbl { display: block; overflow-x: auto; white-space: nowrap; }
  .modal { padding: 20px 18px; }
}

/* 表格 */
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; color: var(--sub); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid #F0F2F6; font-size: 13px; vertical-align: middle; }
.tbl tr:hover td { background: #FAFBFE; }
.tag { display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 999px; }
.tag.blue { background: var(--brand-light); color: var(--brand-dark); }
.tag.green { background: #E7F8F1; color: #047857; }
.tag.yellow { background: #FEF3DC; color: #B45309; }
.tag.red { background: #FDE8E8; color: #B91C1C; }
.tag.gray { background: #F3F4F6; color: #6B7280; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.btn { padding: 7px 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 13px; color: var(--ink); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.sm { padding: 4px 12px; font-size: 12px; }

/* 模态 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: #fff; border-radius: 14px; width: 560px; max-width: 94vw; max-height: 88vh; overflow: auto; padding: 26px 28px; }
.modal h3 { font-size: 17px; margin-bottom: 6px; }
.modal .sub { color: var(--sub); font-size: 12px; margin-bottom: 18px; line-height: 1.7; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* 流程条 */
.stagebar { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.stagebar .st { flex: 1; min-width: 90px; text-align: center; padding: 9px 4px; border-radius: 8px; background: #fff; border: 1px solid var(--line); font-size: 12px; color: var(--sub); cursor: pointer; position: relative; }
.stagebar .st.cur { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
.stagebar .st.past { background: var(--brand-light); color: var(--brand-dark); border-color: #C9D6EE; }
.stagebar .st .goal { display: block; font-size: 10px; margin-top: 2px; opacity: .75; }
.nodeflow { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 16px; }
.nodeflow .nf { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 12px; color: var(--sub); }
.nodeflow .nf .nf-ic { font-weight: 700; }
.nodeflow .nf.done { border-color: var(--green); color: var(--green); }
.nodeflow .nf.cur { border-color: var(--brand); background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }
.nodeitem { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; display: flex; align-items: center; gap: 12px; background: #fff; }
.nodeitem .id { font-size: 11px; color: var(--sub); min-width: 74px; }
.nodeitem .body { flex: 1; }
.nodeitem .body b { font-size: 13.5px; display: block; }
.nodeitem .body span { font-size: 12px; color: var(--sub); }
.nodeitem.done { opacity: .68; background: #FAFDFB; }
.nodeitem.overdue { border-color: #FCA5A5; background: #FFF7F7; }
.empty { text-align: center; color: var(--sub); padding: 40px 0; font-size: 13px; }
.minibar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.minibar .bar { height: 14px; border-radius: 4px; background: var(--brand); min-width: 2px; }
.minibar .nm { width: 88px; color: var(--ink); }
.minibar .ct { color: var(--sub); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--sub); margin-top: 10px; }
.toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); background: #152238; color: #fff; padding: 10px 22px; border-radius: 999px; font-size: 13px; z-index: 99; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast.err { background: #B91C1C; }

/* 打印 / 导出（隐藏导航与按钮，只留看板内容） */
@media print {
  .sidebar, .topbar, .btn, .toast, .modal-mask, #printdash, .stagebar { display: none !important; }
  .layout { display: block; }
  .main { max-width: 100%; padding: 0; }
  .card { break-inside: avoid; border: 1px solid #ccc; box-shadow: none; }
  .kpi, .kpis { break-inside: avoid; }
  body { background: #fff; }
}

/* 组织与权限 */
.nav a.nav-sep { margin-top: 10px; border-top: 1px solid rgba(255,255,255,.12); padding-top: 15px; }
.org-tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.org-tab { padding: 9px 18px; border: none; background: transparent; font-size: 14px; color: var(--sub); border-bottom: 2px solid transparent; }
.org-tab:hover { color: var(--ink); }
.org-tab.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.role-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }

/* 消息通知 */
.bell { position: relative; font-size: 17px; color: var(--ink); text-decoration: none; padding: 0 2px; line-height: 1; }
.bell:hover { transform: scale(1.08); }
.notif-badge { position: absolute; top: -7px; right: -8px; background: #EF4444; color: #fff; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; line-height: 16px; text-align: center; border-radius: 999px; padding: 0 4px; box-sizing: border-box; }
.notif-modal { width: 480px; max-width: 94vw; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.notif-head h3 { font-size: 16px; margin: 0; }
.notif-list { max-height: 60vh; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: flex-start; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: #F5F8FF; }
.notif-item.unread { background: #F0F5FF; }
.notif-ic { font-size: 18px; line-height: 1.2; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.notif-text { font-size: 12px; color: var(--sub); margin-top: 3px; }
.notif-time { font-size: 11px; color: #9CA3AF; margin-top: 4px; }
.dot-unread { width: 7px; height: 7px; border-radius: 50%; background: #EF4444; display: inline-block; flex: none; }
