/* ========== 大青云 OA 样式（与 CRM 同设计语言） ========== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1e293b;
  --text-2: #64748b;
  --border: #e2e8f0;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --green: #16a34a;
  --green-light: #dcfce7;
  --orange: #ea580c;
  --orange-light: #ffedd5;
  --red: #dc2626;
  --red-light: #fee2e2;
  --purple: #7c3aed;
  --purple-light: #ede9fe;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
#app { display: flex; height: 100vh; overflow: hidden; }

/* ========== 侧边栏 ========== */
.sidebar { width: 232px; flex-shrink: 0; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; }
.sidebar-logo { display: flex; align-items: center; gap: 12px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.07); }
.logo-mark { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.logo-mark.logo-img { background: #fff; padding: 3px; }
.logo-mark.logo-img img { width: 100%; height: 100%; object-fit: contain; }
.logo-title { color: #fff; font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.logo-sub { font-size: 10px; opacity: .55; margin-top: 2px; }
.nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 2px; border-radius: 8px; cursor: pointer; color: var(--sidebar-text); font-size: 13.5px; transition: all .15s; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #e2e8f0; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .ico { font-size: 15px; width: 20px; text-align: center; }
.nav-item .nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 10px; border-radius: 999px; padding: 1px 6px; }
.sidebar-footer { padding: 14px 18px; font-size: 11px; border-top: 1px solid rgba(255,255,255,.07); display: flex; align-items: center; gap: 7px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }

/* ========== 主区域 ========== */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { height: 60px; flex-shrink: 0; background: var(--card); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; }
.page-title { font-size: 17px; font-weight: 600; }
.topbar-actions { display: flex; gap: 10px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px; background: #f1f5f9; cursor: pointer; font-size: 13px; }
.user-chip:hover { background: var(--primary-light); }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-2); background: #fff; padding: 1px 8px; border-radius: 999px; }
.content { flex: 1; overflow-y: auto; padding: 22px 24px; }

/* ========== 通用组件 ========== */
.btn { border: none; cursor: pointer; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; transition: all .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f1f5f9; }
.btn-green { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 13px; padding: 2px 6px; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--red); }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); padding: 18px 20px; }
.card-title { font-size: 14.5px; font-weight: 600; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-blue { background: var(--primary-light); color: var(--primary-dark); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-gray { background: #f1f5f9; color: var(--text-2); }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; padding: 10px 12px; font-size: 12px; color: var(--text-2); font-weight: 500; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.tbl tr:hover td { background: #f8fafc; }
.tbl tr.clickable { cursor: pointer; }

/* ========== 门户 ========== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.kpi { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); padding: 18px 20px; display: flex; align-items: center; gap: 14px; }
.kpi-ico { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.kpi-val { font-size: 24px; font-weight: 700; line-height: 1.2; }
.kpi-label { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 18px; }

.todo-card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); padding: 16px 18px; }
.todo-card .tc-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; margin-bottom: 12px; }
.todo-card .tc-head .cnt { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; border-radius: 999px; padding: 1px 8px; font-weight: 500; }
.todo-item { padding: 9px 12px; background: #f8fafc; border-radius: 8px; margin-bottom: 8px; font-size: 12.5px; border-left: 3px solid var(--primary); cursor: pointer; }
.todo-item:hover { background: #eff6ff; }
.todo-item .t { color: var(--text-2); font-size: 11px; margin-top: 3px; }
.todo-item.urgent { border-left-color: var(--red); }

.sys-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.sys-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; transition: all .15s; text-decoration: none; color: inherit; display: block; }
.sys-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(37, 99, 235, .1); transform: translateY(-2px); }
.sys-card .si { font-size: 26px; margin-bottom: 8px; }
.sys-card .sn { font-size: 13.5px; font-weight: 600; }
.sys-card .sd { font-size: 11.5px; color: var(--text-2); margin-top: 3px; }
.sys-card.offline { opacity: .55; }

/* ========== 流程模板 ========== */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tpl-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; cursor: pointer; transition: all .15s; }
.tpl-card:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(37, 99, 235, .1); transform: translateY(-2px); }
.tpl-card .ti { font-size: 26px; }
.tpl-card .tn { font-size: 14.5px; font-weight: 600; margin: 8px 0 4px; }
.tpl-card .td { font-size: 12px; color: var(--text-2); line-height: 1.6; min-height: 38px; }
.tpl-card .tf { margin-top: 10px; font-size: 11.5px; color: var(--primary); }

/* ========== 时间线 ========== */
.timeline-item { padding: 10px 12px; background: #f8fafc; border-radius: 8px; margin-bottom: 8px; font-size: 12.5px; border-left: 3px solid var(--primary); }
.timeline-item .t { color: var(--text-2); font-size: 11.5px; margin-bottom: 3px; }
.timeline-item.done { border-left-color: var(--green); }
.timeline-item.reject { border-left-color: var(--red); }
.timeline-item.pending { border-left-color: var(--orange); }

/* ========== 模态框 / 抽屉 ========== */
.modal-mask, .drawer-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: none; align-items: center; justify-content: center; z-index: 100; }
.modal-mask.show, .drawer-mask.show { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 560px; max-width: 92vw; max-height: 88vh; display: flex; flex-direction: column; animation: pop .18s ease; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header, .drawer-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3, .drawer-header h3 { font-size: 15.5px; }
.modal-close { border: none; background: none; font-size: 20px; color: var(--text-2); cursor: pointer; line-height: 1; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 540px; max-width: 94vw; background: #fff; display: flex; flex-direction: column; animation: slide .2s ease; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.drawer-mask { align-items: stretch; justify-content: flex-end; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-item { display: flex; flex-direction: column; gap: 5px; }
.form-item.full { grid-column: 1 / -1; }
.form-item label { font-size: 12.5px; color: var(--text-2); }
.form-item label .req { color: var(--red); }
.input, .select, .textarea { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: inherit; background: #fff; color: var(--text); outline: none; transition: border .15s; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); }
.textarea { resize: vertical; min-height: 80px; }
.input-sm { padding: 6px 10px; font-size: 12.5px; }

/* ========== 考勤打卡 ========== */
.clock-panel { text-align: center; padding: 30px 20px; }
.clock-time { font-size: 42px; font-weight: 700; letter-spacing: 2px; }
.clock-date { color: var(--text-2); margin: 6px 0 22px; font-size: 13px; }
.clock-btn { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; border: none; border-radius: 50%; width: 110px; height: 110px; font-size: 15px; font-weight: 600; cursor: pointer; box-shadow: 0 8px 24px rgba(37, 99, 235, .35); transition: transform .15s; }
.clock-btn:hover { transform: scale(1.05); }
.clock-btn small { font-size: 11px; opacity: .85; font-weight: 400; }
.clock-info { margin-top: 20px; font-size: 12.5px; color: var(--text-2); }

/* ========== 公告 ========== */
.notice-item { padding: 13px 16px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; cursor: pointer; background: #fff; }
.notice-item:hover { border-color: var(--primary); }
.notice-item .nt { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.notice-item .nm { font-size: 12px; color: var(--text-2); margin-top: 5px; }
.notice-body { font-size: 13.5px; line-height: 1.9; white-space: pre-wrap; }

/* ========== 工具栏/其他 ========== */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar .spacer { flex: 1; }
.empty { text-align: center; color: var(--text-2); padding: 36px 0; font-size: 13px; }
.tip-box { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px; padding: 14px 16px; font-size: 12.5px; line-height: 1.8; color: #1e40af; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; font-size: 13px; }
.info-grid .k { color: var(--text-2); }
.org-dept { background: #f8fafc; border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }

.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 300; }
.toast { background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--green); border-radius: 8px; box-shadow: 0 8px 24px rgba(15,23,42,.12); padding: 11px 18px; margin-bottom: 10px; font-size: 13px; animation: pop .18s ease; }
.toast.error { border-left-color: var(--red); }

@media (max-width: 1100px) {
  .kpi-grid, .sys-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
