:root {
  --brand: #1e6ff2;
  --brand-d: #1857c4;
  --bg: #f2f4f8;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #6b7789;
  --line: #e3e8ef;
  --ok: #12a150;
  --warn: #e8a300;
  --danger: #e5484d;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.6 "Microsoft YaHei", "PingFang SC", -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: 14px; }
a { color: var(--brand); text-decoration: none; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eef3fd 0%, #f7f9fc 55%, #eaf1ff 100%);
  padding: 24px;
}
.login-card {
  width: 380px; background: var(--card); border-radius: 16px; padding: 32px;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card p.sub { margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.login-card .field { margin-bottom: 14px; }
.login-card .demo { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 12px; line-height: 1.9; }
.login-card .demo code { background: #f2f5fa; padding: 1px 6px; border-radius: 4px; color: #33405a; }

/* ---------- 框架 ---------- */
#app { min-height: 100%; }
/* 整个应用至少铺满一屏：侧栏始终满高，切页面时不会忽长忽短 */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 208px; flex: 0 0 208px; background: #12203a; color: #cfd8e6;
  display: flex; flex-direction: column; padding: 16px 12px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 8px; padding: 6px 8px 18px; }
.brand .dot { width: 26px; height: 26px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; }
.brand b { color: #fff; font-size: 15px; letter-spacing: .3px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px;
  color: #c3cfe2; margin-bottom: 4px; cursor: pointer; font-size: 14px;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { background: var(--brand); color: #fff; }
.nav a .ico { width: 16px; text-align: center; opacity: .9; }
.side .foot { margin-top: auto; font-size: 12px; color: #7d8ca6; padding: 8px; line-height: 1.7; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; flex: 0 0 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 28px;
}
.topbar-inner { width: 100%; display: flex; align-items: center; gap: 12px; }
.topbar h2 { margin: 0; font-size: 16px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #4c8dff, #1e6ff2); color: #fff; display: grid; place-items: center; font-size: 13px; }
.content { flex: 1; padding: 24px 28px 48px; }
/* 内容区铺满可用宽度：不居中、限宽，避免大屏下左右各留一大块空白 */
.content > * { width: 100%; }

/* ---------- 通用 ---------- */
.card { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.card h3 { margin: 0 0 14px; font-size: 15px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #c3cddd; background: #fafbfd; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); }
.btn.danger { color: var(--danger); border-color: #f3c6c7; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--brand); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { padding: 5px 10px; font-size: 13px; }

input[type=text], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text); outline: none; transition: .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(30,111,242,.12); }
textarea { resize: vertical; min-height: 96px; line-height: 1.7; }
label.fl { display: block; font-size: 13px; color: #3d4a5e; margin-bottom: 6px; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.req::after { content: " *"; color: var(--danger); }

/* ---------- 徽章 ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; line-height: 1.7; white-space: nowrap; }
.s-待处理 { background: #fff4e0; color: #b3730a; }
.s-处理中 { background: #e7f0ff; color: #1e5fd0; }
.s-已完成 { background: #e5f7ec; color: #0e8a45; }
.s-已关闭 { background: #eef0f3; color: #6b7789; }
.s-已作废 { background: #f6eef7; color: #8b4a95; text-decoration: line-through; }
.row-void td { color: #9aa3b2; }
.row-void td:first-child { text-decoration: line-through; }
/* 修改密码弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(16,24,40,.42); display: flex; align-items: center; justify-content: center; z-index: 60; }
.modal-box { background: #fff; border-radius: 12px; padding: 20px 22px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 12px 40px rgba(16,24,40,.18); }
.modal-box h3 { margin: 0 0 4px; font-size: 16px; }
.modal-box .sub { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; }
.modal-box .field { margin-bottom: 12px; }
.modal-box .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
/* 操作日志 */
.audit-item { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.audit-item:last-child { border-bottom: 0; }
.audit-item .who { font-weight: 600; color: #1d2b45; }
.audit-item .what { color: #45546c; }
.audit-item .when { color: var(--muted); font-size: 12px; margin-left: 8px; }
.audit-item .ip { color: #9aa3b2; font-size: 11.5px; margin-left: 8px; }
.p-紧急 { background: #fdeaea; color: #c9353a; }
.p-高 { background: #fff1e6; color: #c2620d; }
.p-中 { background: #eaf1ff; color: #2a62c4; }
.p-低 { background: #f0f2f5; color: #6b7789; }
.tag { background: #f2f5fa; border-radius: 6px; padding: 1px 8px; font-size: 12px; color: #45546c; }
.overdue { color: var(--danger); font-weight: 600; }

/* ---------- 表格 ---------- */
.table-wrap { overflow: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 760px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: #fafbfd; position: sticky; top: 0; z-index: 1; }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover { background: #f7faff; }
tbody tr.closed { background: #f7f8fa; color: #8b95a5; }
tbody tr.closed:hover { background: #f1f3f6; }
td.no { font-family: Consolas, Monaco, monospace; font-size: 12.5px; color: #43536b; white-space: nowrap; }
td.title-cell { font-weight: 500; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 48px; text-align: center; color: var(--muted); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button {
  border: none; background: transparent; padding: 7px 13px; border-radius: 8px;
  cursor: pointer; color: var(--muted); font-size: 13.5px;
}
.tabs button.on { background: #eaf1ff; color: var(--brand); font-weight: 600; }

/* ---------- 抽屉 ---------- */
.mask { position: fixed; inset: 0; background: rgba(14,22,38,.42); display: flex; justify-content: flex-end; z-index: 40; }
.drawer {
  width: min(680px, 100%); background: var(--bg); height: 100%; overflow: auto;
  box-shadow: -8px 0 32px rgba(14,22,38,.18); animation: slidein .18s ease-out;
}
@keyframes slidein { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head { position: sticky; top: 0; background: #fff; border-bottom: 1px solid var(--line); padding: 16px 20px; z-index: 2; }
.drawer-head .t { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.drawer-body { padding: 18px 20px 40px; }
.kv { display: grid; grid-template-columns: 96px 1fr 96px 1fr; gap: 8px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 16px; }
.tl-item::before { content: ""; position: absolute; left: -19px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: #b9c4d4; }
.tl-item.hi::before { background: var(--brand); }
.tl-item .l1 { font-size: 13.5px; }
.tl-item .l2 { font-size: 12px; color: var(--muted); }

.comment { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.comment.internal { background: #fffaf0; border-color: #f2dfb8; }
.comment .c-head { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.comment .c-body { white-space: pre-wrap; font-size: 13.5px; }

/* ---------- 统计 ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.kpi { background: var(--card); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.kpi .k { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.kpi.alert .v { color: var(--danger); }
.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: 76px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; }
.bar .track { height: 10px; background: #eef1f6; border-radius: 999px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 999px; background: var(--brand); transition: width .3s; }
.bar .val { text-align: right; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: #1c2430; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 13.5px;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 90; max-width: 80vw;
}
.toast.on { opacity: 1; bottom: 44px; }
.toast.err { background: #b42b30; }

@media (max-width: 820px) {
  .side { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 88px 1fr; }
  .content { padding: 12px 12px 84px; }
  .topbar { padding: 0 14px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}

/* 手机上才出现的底部导航（窄屏时侧栏隐藏，靠它切页） */
.mtabs { display: none; }
@media (max-width: 820px) {
  .mtabs {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: #fff; border-top: 1px solid var(--line);
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -2px 12px rgba(16, 24, 40, .06);
  }
  .mtabs a {
    flex: 1; text-align: center; padding: 7px 0; font-size: 12.5px;
    color: var(--muted); cursor: pointer; line-height: 1.5;
  }
  .mtabs a .mi { display: block; font-size: 17px; line-height: 1.2; }
  .mtabs a.on { color: var(--brand); font-weight: 600; }
}

/* ---------- 通知铃铛 ---------- */
.bell { position: relative; margin-right: 10px; }
.nbadge {
  display: inline-block; min-width: 16px; height: 16px; line-height: 16px;
  margin-left: 5px; padding: 0 4px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; font-style: normal;
  text-align: center; vertical-align: 1px;
}

/* ---------- 通知列表 ---------- */
.notify-list { display: flex; flex-direction: column; }
.nv {
  padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer;
  border-radius: 8px;
}
.nv:hover { background: #f6f8fc; }
.nv.read { opacity: .55; }
.nv-t { font-weight: 500; }
.nv-s { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- 管理页 ---------- */
.sub-head {
  margin: 26px 0 12px; padding-top: 18px; border-top: 1px solid var(--line);
  font-weight: 600; font-size: 14px;
}
/* 管理页的人员表列比较多，不强制 760 最小宽度，能塞就塞下 */
.table-wrap table.adm { min-width: 0; }
.table-wrap td .row { flex-wrap: nowrap; }

/* ---------- 小弹窗 ---------- */
.modal {
  background: #fff; border-radius: 14px; padding: 22px 24px; width: min(420px, 92vw);
  box-shadow: 0 20px 60px rgba(16, 24, 40, .22);
  margin: auto; align-self: center;
}
.modal input { width: 100%; }

/* ---------- 附件 / 照片 ---------- */
.hide-file { display: none; }
.files { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.thumb {
  position: relative; display: block; width: 104px; border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; background: #f7f9fc;
  text-decoration: none; color: var(--text);
}
.thumb img { display: block; width: 100%; height: 74px; object-fit: cover; background: #eef1f6; }
.thumb .att-doc {
  height: 74px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--danger); letter-spacing: 1px; background: #fff5f5;
}
.thumb .att-name {
  display: block; padding: 5px 7px; font-size: 11.5px; line-height: 1.4;
  color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.thumb.pending { border-style: dashed; }
.att-del {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; padding: 0;
  border: none; border-radius: 50%; background: rgba(16, 24, 40, .62); color: #fff;
  font-size: 14px; line-height: 18px; text-align: center; cursor: pointer;
}
.att-del:hover { background: var(--danger); }
.thumb:hover { border-color: var(--brand); }

@media (max-width: 820px) {
  .bell { margin-right: 6px; }
  .thumb { width: calc(33.3% - 8px); }
}
