/* ==========================================================================
   app.css —— 设备管理履职评价系统 全站样式
   说明：整个前端只引用这一个样式文件。想换主题色改 :root 里的 --primary。
   ========================================================================== */
:root {
  --primary: #1f6feb;
  --primary-dark: #1857bb;
  --primary-light: #e8f1ff;
  --bg: #f4f6fa;
  --panel: #ffffff;
  --text: #1c2536;
  --text-dim: #6b7688;
  --border: #e3e8f0;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(22, 40, 78, .07);
  --shadow-lg: 0 12px 40px rgba(22, 40, 78, .18);
  --sidebar: #16233a;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "微软雅黑", "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #c4cdda; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------ 登录页 ------------------------------ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #16233a 0%, #1f6feb 100%);
  padding: 20px;
}
.login-card {
  width: 400px; max-width: 100%; background: #fff; border-radius: 14px; padding: 34px 34px 26px;
  box-shadow: var(--shadow-lg);
}
.login-card h1 { font-size: 21px; margin: 0 0 6px; }
.login-card .sub { color: var(--text-dim); font-size: 13px; margin-bottom: 22px; }
.login-logo {
  width: 52px; height: 52px; border-radius: 13px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 26px; margin-bottom: 16px;
}

/* ------------------------------ 布局 ------------------------------ */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 218px; background: var(--sidebar); color: #cbd5e1; flex: 0 0 218px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.09); }
.sidebar .brand b { color: #fff; font-size: 15px; display: block; }
.sidebar .brand span { font-size: 11px; color: #8fa0b8; }
.nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.nav a {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 8px;
  color: #cbd5e1; font-size: 13.5px; margin-bottom: 2px; cursor: pointer;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav .nav-group { font-size: 11px; color: #6c7d97; padding: 12px 12px 5px; letter-spacing: .5px; }
.nav a .ic { width: 17px; text-align: center; }
.sidebar .foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.09); font-size: 11px; color: #8fa0b8; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
  position: sticky; top: 0; z-index: 30;
}
.topbar h2 { font-size: 16px; margin: 0; }
.topbar .user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-dim); }
.badge-role { padding: 2px 9px; border-radius: 20px; font-size: 11.5px; background: var(--primary-light); color: var(--primary); font-weight: 600; }
.badge-role.manager { background: #fff4e5; color: #b45309; }
.badge-role.staff { background: #eef2f7; color: #55637a; }
.content { padding: 20px; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h3 { margin: 0 0 3px; font-size: 18px; }
.page-head p { margin: 0; color: var(--text-dim); font-size: 13px; }

/* ------------------------------ 卡片 / 栅格 ------------------------------ */
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 760px) {
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -220px; z-index: 60; transition: left .2s; }
  .sidebar.open { left: 0; }
}
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .card-head {
  padding: 13px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.card > .card-body { padding: 16px; }
.card > .card-body.tight { padding: 0; }
.stat { padding: 16px; }
.stat .label { color: var(--text-dim); font-size: 12.5px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat .value small { font-size: 13px; font-weight: 400; color: var(--text-dim); }
.stat.ok .value { color: var(--ok); }
.stat.warn .value { color: var(--warn); }
.stat.danger .value { color: var(--danger); }

/* ------------------------------ 表单 ------------------------------ */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 13px; margin-bottom: 5px; color: #3c4759; font-weight: 500; }
.field .hint { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
input[type=text], input[type=password], input[type=number], input[type=month], input[type=date], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,111,235,.12); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px; border-radius: 8px; border: 1px solid var(--border); background: #fff;
  color: var(--text); cursor: pointer; font-size: 13.5px; font-weight: 500; transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: #c9d3e0; background: #f8fafc; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #f3c2c2; }
.btn.danger:hover { background: #fef2f2; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline .field { margin-bottom: 0; min-width: 140px; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13.5px; }
.checkbox input { width: auto; }

/* ------------------------------ 表格 ------------------------------ */
.table-wrap { overflow: auto; max-height: 68vh; border-radius: 0 0 var(--radius) var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 8px 11px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.tbl th {
  background: #f8fafc; font-weight: 600; color: #47536b; position: sticky; top: 0; z-index: 2;
  white-space: nowrap; border-bottom: 1px solid #dbe2ec;
}
table.tbl tbody tr:hover { background: #f7fbff; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.center, table.tbl th.center { text-align: center; }
table.tbl tr.total td { font-weight: 700; background: #f4f8ff; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11.5px; background: #eef2f7; color: #55637a; white-space: nowrap; }
.tag.ok { background: #e7f7ec; color: #15803d; }
.tag.warn { background: #fff5e6; color: #b45309; }
.tag.danger { background: #fdecec; color: #b91c1c; }
.tag.info { background: var(--primary-light); color: var(--primary); }
.score-hi { color: var(--ok); font-weight: 700; }
.score-mid { color: var(--warn); font-weight: 700; }
.score-lo { color: var(--danger); font-weight: 700; }
.empty { padding: 34px; text-align: center; color: var(--text-dim); }
.rank-1 { color: #d97706; font-weight: 700; }
.rank-2 { color: #64748b; font-weight: 700; }
.rank-3 { color: #a16207; font-weight: 700; }
/* 评分结果表里按岗位分段的小标题（各岗位分别排名） */
.post-band {
  padding: 9px 13px; background: linear-gradient(90deg, #e8f1ff, #f7fbff);
  border-top: 2px solid var(--primary); border-bottom: 1px solid #d8e6fb;
  font-weight: 700; font-size: 13.5px; color: #16406f;
}
.post-band + .table-wrap { max-height: none; }
/* ---------- 设备对照 · ① 按人调整负责设备（工具栏 + 表格多选） ---------- */
.pe-toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 10px; }
.pe-f { display: flex; flex-direction: column; gap: 4px; }
.pe-f > label { font-size: 12.5px; color: #3c4759; font-weight: 500; }
.pe-f select, .pe-f input { min-width: 150px; }
.pe-f-grow { flex: 1; min-width: 260px; }
.pe-f-grow select { width: 100%; font-weight: 600; }
.pe-summary { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.pe-chip { background: #f1f5fb; border: 1px solid var(--border); border-radius: 20px; padding: 4px 12px;
  font-size: 12.5px; color: #47536b; }
.pe-chip b { color: var(--text); }
.pe-chip.warn { background: #fff7e6; border-color: #fde68a; color: #92400e; }
.pe-chip.warn b { color: #92400e; }
.pe-actions { margin-bottom: 10px; gap: 10px; align-items: center; }
.pe-note { width: 300px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
@media (max-width: 1100px) { .pe-note { width: 200px; } }
.pe-wrap { max-height: 400px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.pe-table th { position: sticky; top: 0; z-index: 3; }
.pe-table td, .pe-table th { padding: 6px 10px; }
.pe-table .pe-cb { width: 42px; }
.pe-table .pe-cb input { width: 15px; height: 15px; cursor: pointer; }
.pe-row { cursor: pointer; }
.pe-row:hover { background: #f0f7ff; }
.pe-row.on { background: var(--primary-light); }
.pe-row.on:hover { background: #dbeafe; }
/* ---------- 可搜索下拉框（ui.js） ---------- */
.ss { position: relative; display: inline-block; width: 100%; vertical-align: middle; }
.ss-native { position: absolute !important; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ss-input { width: 100%; padding: 8px 30px 8px 11px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; background: #fff url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%236b7a90' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center; }
.ss-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.ss-list { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 28px rgba(16,32,64,.16); padding: 4px; }
.ss-item { display: flex; justify-content: space-between; gap: 8px; align-items: center;
  padding: 7px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.ss-item:hover, .ss-item.active { background: var(--primary-light); }
.ss-item.on { font-weight: 600; color: var(--primary-dark); }
.ss-item .ss-check { color: var(--primary); font-weight: 700; }
.ss-empty { padding: 10px; color: #8a94a6; font-size: 13px; text-align: center; }
.pe-f .ss, .field .ss { min-width: 0; }
.field .ss-input { min-width: 150px; }

/* 评分结果：无数据（不排名）的人排在最后，整行淡显 */
table.tbl tr.row-inactive td { background: #fafbfd; color: #8a94a6; }
table.tbl tr.row-inactive:hover td { background: #f4f6fa; }
.pe-row.on td:nth-child(2) b { color: var(--primary-dark); }
/* 设备对照：可编辑的责任人输入框 */
.dev-edit { width: 100%; min-width: 86px; padding: 4px 7px; font-size: 12.5px; }
.dev-row-editing { background: #fffbe9 !important; }
/* 机器人图标（钢铁主题 SVG） */
.bot-fab img { width: 46px; height: 46px; display: block; }
.bot-head .avatar img { width: 30px; height: 30px; display: block; }

/* ------------------------------ 提示 / 弹窗 ------------------------------ */
.toast-box { position: fixed; top: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #fff; border-left: 4px solid var(--primary); border-radius: 8px; padding: 11px 16px;
  box-shadow: var(--shadow-lg); font-size: 13.5px; min-width: 220px; max-width: 420px; animation: slideIn .18s;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.alert { padding: 11px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; border: 1px solid; }
.alert.info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert.err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert.ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.modal-mask {
  position: fixed; inset: 0; background: rgba(16,26,45,.45); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal { background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); width: 620px; max-width: 100%; max-height: 88vh; display: flex; flex-direction: column; }
.modal.wide { width: 900px; }
.modal > .modal-head { padding: 15px 18px; border-bottom: 1px solid var(--border); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.modal > .modal-body { padding: 18px; overflow: auto; }
.modal > .modal-foot { padding: 13px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 9px; }
.close-x { cursor: pointer; color: var(--text-dim); font-size: 19px; line-height: 1; background: none; border: none; }
.spinner {
  width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------ 上传区 ------------------------------ */
.dropzone {
  border: 2px dashed #c6d3e4; border-radius: 10px; padding: 26px; text-align: center;
  background: #fafcff; cursor: pointer; transition: all .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-light); }
.dropzone .big { font-size: 30px; }
.dropzone .t { font-weight: 600; margin-top: 6px; }
.dropzone .s { color: var(--text-dim); font-size: 12.5px; margin-top: 3px; }
.upload-kind { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.upload-kind button { padding: 7px 13px; border-radius: 20px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 13px; }
.upload-kind button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.filelist { margin-top: 12px; }
.filelist .f { display: flex; justify-content: space-between; gap: 10px; padding: 7px 11px; background: #f8fafc; border-radius: 7px; margin-bottom: 6px; font-size: 13px; }

/* ------------------------------ 进度条 ------------------------------ */
.bar { height: 7px; background: #eef2f7; border-radius: 4px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.bar.ok > i { background: var(--ok); }
.bar.warn > i { background: var(--warn); }
.bar.danger > i { background: var(--danger); }

/* ------------------------------ 小机器人 ------------------------------ */
.bot-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 150;
  width: 62px; height: 62px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #16233a, #2b4a75); color: #fff;
  box-shadow: 0 8px 24px rgba(22,35,58,.45); display: flex; align-items: center; justify-content: center;
  transition: transform .18s;
}
.bot-fab:hover { transform: scale(1.07); }
.bot-fab .dot {
  position: absolute; top: 4px; right: 4px; width: 12px; height: 12px; border-radius: 50%;
  background: #22c55e; border: 2px solid #fff;
}
.bot-panel {
  position: fixed; right: 22px; bottom: 96px; z-index: 150;
  width: 760px; max-width: calc(100vw - 34px); height: 660px; max-height: calc(100vh - 130px);
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  overflow: hidden; animation: popIn .18s;
}
@keyframes popIn { from { transform: translateY(14px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.bot-head {
  background: linear-gradient(135deg, #16233a, #1f6feb); color: #fff; padding: 13px 16px;
  display: flex; align-items: center; gap: 11px;
}
.bot-head .avatar {
  width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center; font-size: 21px;
}
.bot-head b { display: block; font-size: 14.5px; }
.bot-head span { font-size: 11.5px; opacity: .82; }
.bot-head .tools { margin-left: auto; display: flex; gap: 6px; }
.bot-head .tools button { background: rgba(255,255,255,.16); border: none; color: #fff; width: 28px; height: 28px; border-radius: 7px; cursor: pointer; font-size: 14px; }
.bot-head .tools button:hover { background: rgba(255,255,255,.3); }
.bot-chips { padding: 9px 12px; border-bottom: 1px solid var(--border); display: flex; gap: 7px; flex-wrap: wrap; background: #fafcff; max-height: 92px; overflow-y: auto; }
.bot-chips button {
  padding: 4px 11px; border-radius: 20px; border: 1px solid #d6e2f5; background: #fff; color: var(--primary);
  font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.bot-chips button:hover { background: var(--primary-light); }
.bot-body { flex: 1; overflow-y: auto; padding: 16px; background: #f7f9fc; }
.msg { display: flex; gap: 10px; margin-bottom: 16px; }
.msg.me { flex-direction: row-reverse; }
.msg .av { width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.msg.bot .av img { width: 26px; height: 26px; display: block; }
.msg.bot .av { background: var(--primary-light); }
.msg.me .av { background: #e2e8f0; }
.bubble { background: #fff; border-radius: 11px; padding: 12px 15px; box-shadow: var(--shadow); max-width: 640px; min-width: 0; }
.msg.me .bubble { background: var(--primary); color: #fff; }
.bubble h4 { margin: 0 0 9px; font-size: 14.5px; }
.bubble .sub { font-weight: 600; margin: 12px 0 6px; font-size: 13px; color: #33415c; }
.bubble table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 6px 0; }
.bubble table th, .bubble table td { border: 1px solid #e3e8f0; padding: 5px 8px; text-align: left; }
.bubble table th { background: #f2f6fc; font-weight: 600; }
.bubble .kvs { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13px; }
.bubble .kvs .k { color: var(--text-dim); }
.bubble .kvs .v { font-weight: 600; }
.bubble .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.bubble .acts .btn { font-size: 12.5px; padding: 6px 12px; }
.bubble .txt { margin: 5px 0; font-size: 13px; }
.bot-foot { padding: 11px 13px; border-top: 1px solid var(--border); display: flex; gap: 9px; background: #fff; }
.bot-foot input { flex: 1; }
.typing span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #9fb0c7; margin-right: 3px; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,60%,100% { opacity: .25; } 30% { opacity: 1; } }

/* ------------------------------ 其它 ------------------------------ */
.muted { color: var(--text-dim); }
.small { font-size: 12.5px; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 12.5px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
table.tbl td.nowrap, table.tbl th.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
pre.json { background: #0f172a; color: #cbd5e1; padding: 12px; border-radius: 8px; overflow: auto; max-height: 300px; font-size: 12px; }
.mm-person td { background: #eaf2ff; border-top: 2px solid #a8c8f8; }
.mm-person .btn { margin-left: 8px; }
