:root {
  --bg: #f4f6f8;
  --card: #fff;
  --line: #e3e7ec;
  --text: #1f2933;
  --muted: #6b7785;
  --accent: #1f6feb;
  --accent-soft: #e8f0fe;
  --ok: #1a7f4b;
  --ok-soft: #e3f5ea;
  --warn: #b25e09;
  --warn-soft: #fdf0dc;
  --bad: #c62828;
  --bad-soft: #fde8e8;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pre { white-space: pre-wrap; word-break: break-word; }

/* 布局 */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 200px; flex: none; background: #17212e; color: #cbd5e1;
  padding: 20px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.side .brand { color: #fff; font-weight: 600; font-size: 16px; padding: 0 10px 16px; }
.side a { color: inherit; padding: 9px 10px; border-radius: 6px; display: block; }
.side a:hover { background: #223043; text-decoration: none; }
.side a.on { background: var(--accent); color: #fff; }
.side .spacer { flex: 1; }
.side .who { padding: 8px 10px; font-size: 12px; color: #8a99ab; }
.main { flex: 1; min-width: 0; padding: 24px 28px 60px; max-width: 1200px; }
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.head .grow { flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* 表单 */
label.f { display: block; margin-bottom: 14px; }
label.f > span, .flabel { display: block; font-weight: 500; margin-bottom: 5px; }
.req::after { content: " *"; color: var(--bad); }
input[type=text], input[type=password], input[type=number], input[type=date], textarea, select {
  width: 100%; padding: 8px 10px; border: 1px solid #cfd6de; border-radius: 6px;
  font: inherit; color: inherit; background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input:disabled, textarea:disabled { background: #f3f5f7; color: var(--muted); }
button {
  font: inherit; padding: 7px 14px; border-radius: 6px; border: 1px solid #cfd6de;
  background: #fff; color: var(--text); cursor: pointer; white-space: nowrap;
}
button:hover { background: #f3f5f7; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #1a5fd0; }
button.danger { color: var(--bad); border-color: #efc2c2; }
button.link { border: 0; background: none; color: var(--accent); padding: 2px 4px; }
button:disabled { opacity: .55; cursor: not-allowed; }
.checks { display: flex; gap: 14px; flex-wrap: wrap; }
.checks label { display: flex; gap: 6px; align-items: center; cursor: pointer; }

/* 标签 */
.chip { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; background: #eef1f4; color: var(--muted); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.blue { background: var(--accent-soft); color: var(--accent); }

/* 表格 */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; color: var(--muted); font-size: 13px; white-space: nowrap; background: #fafbfc; }
td.num { font-variant-numeric: tabular-nums; }
td.clip { max-width: 260px; }
td.clip div { max-height: 4.8em; overflow: hidden; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f7f9fb; }

/* 统计 */
.stats { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 18px; min-width: 110px; }
.stat b { display: block; font-size: 24px; line-height: 1.2; }
.stat.bad b { color: var(--bad); }
.stat.ok b { color: var(--ok); }

/* 总览 */
.person { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.person h2 { margin: 0; }
.item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.item:hover { background: #f9fafb; }
.item .title { font-weight: 500; }
.item .vals { color: var(--muted); font-size: 13px; }
.item .vals b { color: var(--text); font-weight: 500; }
.item .grow { flex: 1; min-width: 0; }

/* 任务卡片（员工端） */
.taskcard { display: flex; gap: 14px; align-items: center; cursor: pointer; }
.taskcard:hover { border-color: var(--accent); }
.taskcard .grow { flex: 1; min-width: 0; }
.taskcard .title { font-size: 16px; font-weight: 500; }

/* 图片 */
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { position: relative; width: 84px; height: 84px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: #f3f5f7; }
.thumb.sm { width: 44px; height: 44px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.thumb .x { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; padding: 0; line-height: 18px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 13px; }
.drop { border: 1.5px dashed #c3ccd6; border-radius: 8px; padding: 14px; color: var(--muted); text-align: center; cursor: pointer; margin-top: 8px; }
.drop.over, .drop.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; z-index: 100; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 94vh; }

/* 字段编辑器 */
.fieldrow { display: grid; grid-template-columns: 1fr 130px 70px auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.fieldrow .ops { display: flex; gap: 2px; }
.fieldrow .ops button { padding: 5px 8px; }

/* 弹窗 */
.mask { position: fixed; inset: 0; background: rgba(15,23,32,.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; padding: 22px; width: 100%; max-width: 620px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.kv { margin-bottom: 12px; }
.kv .k { color: var(--muted); font-size: 13px; }
.reply { background: var(--warn-soft); border-radius: 8px; padding: 10px 12px; margin-top: 10px; }
.reply .k { color: var(--warn); font-size: 12px; font-weight: 500; }

/* 登录 */
.login { max-width: 360px; margin: 12vh auto 0; padding: 0 16px; }
.login h1 { text-align: center; margin-bottom: 6px; }
.login p { text-align: center; color: var(--muted); margin: 0 0 20px; }
.login button { width: 100%; padding: 10px; }

/* 员工端顶栏 */
.top { background: #17212e; color: #fff; padding: 0 24px; display: flex; align-items: center; gap: 6px; height: 52px; }
.top .brand { font-weight: 600; margin-right: 18px; }
.top a { color: #cbd5e1; padding: 6px 12px; border-radius: 6px; }
.top a:hover { background: #223043; text-decoration: none; }
.top a.on { background: var(--accent); color: #fff; }
.top .grow { flex: 1; }
.narrow { max-width: 820px; margin: 0 auto; padding: 24px 20px 60px; }

.tabs { display: flex; gap: 4px; }
.tabs button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 36px 0; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }

#toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
#toast div { background: #17212e; color: #fff; padding: 9px 18px; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
#toast div.err { background: var(--bad); }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .side { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .side .brand { width: 100%; padding-bottom: 6px; }
  .side .spacer, .side .who { display: none; }
  .main { padding: 16px; }
  .fieldrow { grid-template-columns: 1fr 1fr; }
}
