/* ========== 公司协作工作台 全局样式 ========== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-2: #64748b;
  --sidebar: #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #2563eb;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e293b 0%, #2563eb 100%); }
.login-card { background: #fff; border-radius: 16px; padding: 40px 44px; width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-logo .icon { width: 46px; height: 46px; border-radius: 12px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; }
.login-logo h1 { font-size: 22px; color: var(--text); }
.login-sub { color: var(--text-2); margin-bottom: 28px; font-size: 13px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field input { width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px; outline: none; transition: border .2s; }
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.btn { border: none; border-radius: 8px; padding: 11px 18px; font-size: 14px; font-weight: 500; transition: all .15s; }
.btn-primary { background: var(--primary); color: #fff; width: 100%; padding: 12px; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 6px; }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-outline { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger-outline:hover { background: #fef2f2; }
.login-tip { margin-top: 16px; font-size: 12px; color: var(--text-2); text-align: center; }
.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; color: var(--text-2); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.btn-dingtalk { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; background: #fff; color: #333; border: 1px solid var(--border); padding: 12px; font-size: 14px; }
.btn-dingtalk:hover { border-color: #0089FF; color: #0089FF; background: #f0f8ff; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 232px; background: var(--sidebar); color: var(--sidebar-text); flex-shrink: 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand .icon { width: 38px; height: 38px; border-radius: 10px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 700; flex-shrink: 0; }
.brand h2 { font-size: 16px; color: #fff; white-space: nowrap; }
.brand small { display: block; font-size: 11px; color: var(--sidebar-text); font-weight: 400; margin-top: 2px; }
.nav { flex: 1; padding: 10px 0; }
.nav-group { padding: 10px 18px 4px; font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: .5px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 18px; cursor: pointer; transition: background .15s; font-size: 14px; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; flex-shrink: 0; }
.sidebar-user { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.sidebar-user .info { flex: 1; min-width: 0; }
.sidebar-user .name { color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .role { color: var(--sidebar-text); font-size: 11px; }
.logout-btn { background: none; border: none; color: var(--sidebar-text); font-size: 17px; cursor: pointer; padding: 4px; }
.logout-btn:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--card); padding: 0 28px; height: 58px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar h3 { font-size: 17px; }
.topbar .date { color: var(--text-2); font-size: 13px; }
.content { padding: 24px 28px; flex: 1; }

/* ---------- 仪表盘 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card .label { color: var(--text-2); font-size: 13px; }
.card .value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.card .extra { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.card .value.up { color: var(--success); }
.card .value.warn { color: var(--warning); }
.card .value.danger { color: var(--danger); }
.card .value.primary { color: var(--primary); }
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.panel { background: var(--card); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.panel h4 { font-size: 15px; margin-bottom: 14px; }
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar { width: 70%; background: linear-gradient(180deg, var(--primary), #60a5fa); border-radius: 5px 5px 2px 2px; min-height: 4px; transition: height .4s; }
.bar-col .b-label { font-size: 11px; color: var(--text-2); white-space: nowrap; }
.bar-col .b-val { font-size: 11px; color: var(--text); font-weight: 600; }
.rank-list { list-style: none; }
.rank-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.rank-list li:last-child { border-bottom: none; }
.rank-no { width: 22px; height: 22px; border-radius: 6px; background: var(--bg); color: var(--text-2); font-size: 12px; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.rank-no.top { background: var(--warning); color: #fff; }
.rank-list .r-name { flex: 1; }
.rank-list .r-val { font-weight: 600; color: var(--primary); }

/* ---------- 通用列表页 ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-head h3 { font-size: 18px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input, .toolbar select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; outline: none; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--primary); }
.table-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; min-width: 720px; }
table.grid th { background: #f8fafc; color: var(--text-2); font-weight: 600; font-size: 12.5px; text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.grid td { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; font-size: 13px; vertical-align: middle; }
table.grid tr:hover td { background: #f8fafc; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.tag-blue { background: var(--primary-light); color: var(--primary-dark); }
.tag-green { background: #dcfce7; color: #15803d; }
.tag-red { background: #fee2e2; color: #b91c1c; }
.tag-orange { background: #ffedd5; color: #c2410c; }
.tag-gray { background: #f1f5f9; color: var(--text-2); }
.tag-purple { background: #f3e8ff; color: #7e22ce; }
.row-actions { display: flex; gap: 6px; }
.row-actions .btn-sm { padding: 3px 10px; font-size: 12px; }
.empty { padding: 50px; text-align: center; color: var(--text-2); }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); }
.pager span { color: var(--text-2); font-size: 13px; }
.pager button { min-width: 60px; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: 680px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.2); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.modal-head h4 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-2); cursor: pointer; line-height: 1; }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-item.full { grid-column: 1 / -1; }
.form-item label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; }
.form-item label .req { color: var(--danger); }
.form-item input, .form-item select, .form-item textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; outline: none; background: #fff; transition: border .2s; }
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-item textarea { resize: vertical; min-height: 64px; }
.form-item input[readonly] { background: #f8fafc; color: var(--text-2); }
.form-item .hint { font-size: 11px; color: var(--text-2); margin-top: 3px; }
.ms-box { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; min-height: 38px; }
.ms-item { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text); cursor: pointer; padding: 2px 4px; }
.ms-item input { width: auto; margin: 0; }
select[multiple] { height: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--border); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--text); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: slideIn .25s ease; display: flex; align-items: center; gap: 8px; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warn { background: var(--warning); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
  .sidebar { width: 200px; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 50; left: -240px; transition: left .25s; }
  .sidebar.open { left: 0; }
  .content { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
}
.menu-toggle { display: none; }
@media (max-width: 860px) { .menu-toggle { display: block; background: none; border: none; font-size: 20px; cursor: pointer; } }
