/* ============================================================
   个人工作台 · 移动端单页
   设计基准：华为 Mate X6 外屏 396×894（一屏刚好）
   ============================================================ */

:root {
  --bg: #0b0f18;
  --bg-2: #0f1522;
  --card: #141b28;
  --card-2: #1a2333;
  --line: #ffffff12;
  --line-2: #ffffff1f;
  --tx: #e6edf7;
  --tx-2: #9db0c9;
  --tx-3: #6b7e97;
  --blue: #4f8cff;
  --green: #7ee0a8;
  --amber: #ffb454;
  --red: #ff6b6b;
  --cyan: #4fd1d9;
  --purple: #a78bfa;
  --r: 14px;
  --r-sm: 10px;
  --shadow: 0 10px 30px #0008;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 关键：.statusbar / .zonebar 设了 display:flex，会盖掉 hidden 属性，必须显式兜住 */
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--tx);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { display: flex; flex-direction: column; }

/* ---------- 顶栏 ---------- */
.appbar {
  flex: 0 0 auto;
  padding: 14px 16px 10px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: linear-gradient(180deg, #101828 0%, #0b0f18 100%);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 20;
}
.appbar h1 {
  margin: 0; font-size: 17px; font-weight: 650; letter-spacing: .2px;
  display: flex; align-items: center; gap: 8px;
}
.appbar h1 .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 10px var(--green);
}
.appbar .sub {
  margin-top: 3px; font-size: 11.5px; color: var(--tx-3);
  display: flex; gap: 10px; flex-wrap: wrap;
}
.appbar .sub b { color: var(--tx-2); font-weight: 500; }

/* ---------- 状态条（单行横滑） ---------- */
.statusbar {
  flex: 0 0 auto;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 10px 16px; background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.statusbar::-webkit-scrollbar { display: none; }
.stat {
  flex: 0 0 auto; min-width: 74px; padding: 7px 11px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-sm); cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.stat:active { transform: scale(.97); }
.stat .n { font-size: 17px; font-weight: 700; line-height: 1.2; }
.stat .l { font-size: 10.5px; color: var(--tx-3); margin-top: 1px; white-space: nowrap; }
.stat.warn .n { color: var(--amber); }
.stat.bad .n { color: var(--red); }
.stat.ok .n { color: var(--green); }

/* ---------- 分区切换条（领导端） ---------- */
.zonebar {
  flex: 0 0 auto; display: flex; gap: 6px; overflow-x: auto;
  padding: 9px 16px; background: var(--bg-2);
  border-bottom: 1px solid var(--line); scrollbar-width: none;
}
.zonebar::-webkit-scrollbar { display: none; }
.zchip {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px;
  font-size: 13px; color: var(--tx-2); background: #ffffff08;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: all .15s;
}
.zchip.on { background: #4f8cff1f; color: #9dc0ff; border-color: #4f8cff44; font-weight: 600; }
.zchip .badge {
  display: inline-block; min-width: 16px; height: 16px; line-height: 16px;
  margin-left: 5px; padding: 0 4px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 10px; text-align: center;
}

/* ---------- 主滚动区 ---------- */
.zone {
  flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
  padding: 14px 16px 24px; -webkit-overflow-scrolling: touch;
}
.zone[hidden] { display: none; }

.block { margin-bottom: 20px; }
.block-hd {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 9px;
}
.block-hd .no {
  font-size: 10.5px; color: var(--tx-3); font-variant-numeric: tabular-nums;
  border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px;
}
.block-hd h2 { margin: 0; font-size: 15px; font-weight: 650; }
.block-hd .cnt { font-size: 12px; color: var(--tx-3); margin-left: auto; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 13px 14px; margin-bottom: 9px;
}
.card.tight { padding: 11px 12px; }
.card.overdue { border-color: #ff6b6b55; background: #2a1418; }
.card.confirm { border-color: #ffb45455; background: #2a2013; }
.card-hd {
  display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px;
}
.card-hd .t { font-size: 14.5px; font-weight: 600; flex: 1; line-height: 1.45; }
.tag {
  flex: 0 0 auto; font-size: 10.5px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid; white-space: nowrap; font-weight: 500;
}
.tag.gray  { color: var(--tx-3);  border-color: #ffffff22; background: #ffffff08; }
.tag.blue  { color: #9dc0ff;      border-color: #4f8cff44; background: #4f8cff18; }
.tag.green { color: var(--green); border-color: #7ee0a844; background: #7ee0a818; }
.tag.amber { color: var(--amber); border-color: #ffb45444; background: #ffb45418; }
.tag.red   { color: var(--red);   border-color: #ff6b6b44; background: #ff6b6b18; }
.tag.cyan  { color: var(--cyan);  border-color: #4fd1d944; background: #4fd1d918; }

.meta { font-size: 12px; color: var(--tx-3); line-height: 1.75; }
.meta b { color: var(--tx-2); font-weight: 500; }
.meta .k { color: var(--tx-3); }

.req {
  margin: 8px 0; padding: 9px 11px; border-radius: var(--r-sm);
  background: #ffb45410; border: 1px solid #ffb45440;
  border-left: 3px solid var(--amber);
  font-size: 12.5px; line-height: 1.65; color: #ffd9a0;
}
.req .lbl {
  display: block; font-size: 10.5px; color: var(--amber);
  letter-spacing: .5px; margin-bottom: 3px; font-weight: 600;
}

/* ---------- 进度条 ---------- */
.bar { height: 4px; border-radius: 999px; background: #ffffff12; overflow: hidden; margin: 8px 0 4px; }
.bar > i { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width .3s; }

/* ---------- 时间线 ---------- */
.tl { margin-top: 10px; padding-left: 14px; border-left: 1px solid var(--line-2); }
.tl-item { position: relative; padding: 0 0 11px 12px; font-size: 12.5px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ''; position: absolute; left: -18px; top: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--card-2); border: 2px solid var(--tx-3);
}
.tl-item.ok::before   { border-color: var(--green); }
.tl-item.warn::before { border-color: var(--amber); }
.tl-item.bad::before  { border-color: var(--red); }
.tl-item .h { display: flex; gap: 8px; align-items: baseline; }
.tl-item .h b { font-weight: 600; font-size: 12.5px; }
.tl-item .h span { font-size: 11px; color: var(--tx-3); margin-left: auto; }
.tl-item .b { color: var(--tx-2); margin-top: 2px; line-height: 1.6; white-space: pre-wrap; }

/* ---------- 按钮 ---------- */
.acts { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 11px; }
.btn {
  padding: 7px 14px; border-radius: 9px; font-size: 12.5px; font-weight: 550;
  border: 1px solid var(--line-2); background: #ffffff0d; color: var(--tx-2);
  cursor: pointer; transition: all .15s; font-family: inherit;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.green   { background: #7ee0a820; border-color: #7ee0a855; color: var(--green); }
.btn.amber   { background: #ffb45418; border-color: #ffb45455; color: var(--amber); }
.btn.red     { background: #ff6b6b18; border-color: #ff6b6b55; color: var(--red); }
.btn.block   { width: 100%; justify-content: center; text-align: center; padding: 12px; font-size: 14px; }
.btn.sm      { padding: 5px 10px; font-size: 11.5px; }

/* ---------- 空状态 ---------- */
.empty {
  padding: 26px 18px; text-align: center; color: var(--tx-3);
  font-size: 13px; line-height: 1.8;
  background: #ffffff05; border: 1px dashed var(--line-2); border-radius: var(--r);
}
.empty b { display: block; color: var(--tx-2); font-size: 13.5px; margin-bottom: 5px; font-weight: 550; }

/* ---------- 表格（运营数据复刻） ---------- */
.tbl-wrap { overflow-x: auto; margin: 9px 0; border: 1px solid var(--line); border-radius: var(--r-sm); }
table.tbl { border-collapse: collapse; width: 100%; font-size: 12px; min-width: 340px; }
table.tbl th, table.tbl td { padding: 7px 9px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tbl th:first-child, table.tbl td:first-child { text-align: left; }
table.tbl thead th { background: #ffffff08; color: var(--tx-2); font-weight: 600; font-size: 11.5px; }
table.tbl tbody tr.group td { background: #4f8cff12; color: #9dc0ff; font-weight: 600; }
table.tbl td.neg { color: var(--red); }
table.tbl td.pos { color: var(--green); }
table.tbl tbody tr:last-child td { border-bottom: none; }

/* ---------- 周视图 ---------- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-bottom: 11px; }
.wd {
  text-align: center; padding: 7px 2px; border-radius: 9px;
  background: var(--card); border: 1px solid var(--line); cursor: pointer;
  transition: all .15s;
}
.wd .d { font-size: 10px; color: var(--tx-3); }
.wd .n { font-size: 14px; font-weight: 650; margin: 1px 0; }
.wd .s { font-size: 9px; color: var(--tx-3); height: 12px; }
.wd.on { border-color: var(--blue); background: #4f8cff1c; }
.wd.on .n { color: #9dc0ff; }
.wd .s.g { color: var(--green); }
.wd .s.r { color: var(--red); }
.wd .s.c { color: var(--cyan); }

/* ---------- 指标卡 ---------- */
.metric { padding: 12px 13px; }
.metric .mh { display: flex; align-items: center; gap: 7px; margin-bottom: 2px; }
.metric .mh b { font-size: 13.5px; font-weight: 600; flex: 1; }
.metric .src { font-size: 10.5px; color: var(--tx-3); margin-bottom: 9px; }
.metric .nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 8px; }
.metric .nums div { text-align: center; padding: 7px 3px; background: #ffffff07; border-radius: 9px; }
.metric .nums .v { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric .nums .k { font-size: 9.5px; color: var(--tx-3); margin-top: 1px; }
.metric .why { font-size: 11.5px; color: var(--amber); background: #ffb45410; padding: 6px 9px; border-radius: 8px; line-height: 1.55; }
.metric.hit { border-color: #ffb45444; }

/* ---------- 底部两端切换 ---------- */
.endbar {
  flex: 0 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 9px 16px; padding-bottom: max(9px, env(safe-area-inset-bottom));
  background: #0a0e16; border-top: 1px solid var(--line-2);
  position: relative; z-index: 20;
}
.endbtn {
  padding: 11px 8px; border-radius: 12px; border: 1px solid var(--line-2);
  background: #ffffff07; color: var(--tx-3); cursor: pointer;
  font-size: 13.5px; font-weight: 600; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: all .18s;
}
.endbtn .ico { font-size: 15px; }
.endbtn.on.leader   { background: #4f8cff24; border-color: #4f8cff77; color: #b8d1ff; }
.endbtn.on.employee { background: #7ee0a824; border-color: #7ee0a877; color: #a8f0c8; }
.endbtn:active { transform: scale(.98); }

/* ---------- 弹层 ---------- */
.mask {
  position: fixed; inset: 0; background: #000a; backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 100; animation: fade .15s;
}
.mask[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  background: var(--bg-2); border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--line-2); padding: 18px 16px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  animation: up .2s cubic-bezier(.2,.8,.3,1);
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
.sheet-hd { display: flex; align-items: center; margin-bottom: 15px; }
.sheet-hd h3 { margin: 0; font-size: 16px; font-weight: 650; flex: 1; }
.sheet-hd .x {
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: #ffffff0f; color: var(--tx-2); font-size: 17px;
  cursor: pointer; line-height: 1; font-family: inherit;
}

.field { margin-bottom: 13px; }
.field > label {
  display: block; font-size: 12.5px; color: var(--tx-2); margin-bottom: 5px; font-weight: 550;
}
.field > label .must { color: var(--red); margin-left: 2px; }
.field input[type=text], .field input[type=date], .field textarea, .field select {
  width: 100%; padding: 10px 12px; border-radius: var(--r-sm);
  background: #ffffff0a; border: 1px solid var(--line-2);
  color: var(--tx); font-size: 14px; font-family: inherit;
  outline: none; transition: border-color .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--blue); background: #4f8cff10;
}
.field textarea { resize: vertical; min-height: 68px; line-height: 1.6; }
.field .hint { font-size: 11px; color: var(--tx-3); margin-top: 4px; line-height: 1.55; }
.field input[type=date] { color-scheme: dark; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip {
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px;
  background: #ffffff0a; border: 1px solid var(--line-2); color: var(--tx-2);
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.chip.on { background: #4f8cff22; border-color: #4f8cff66; color: #b8d1ff; font-weight: 600; }

.formerr {
  padding: 9px 12px; border-radius: 9px; background: #ff6b6b15;
  border: 1px solid #ff6b6b44; color: #ffb3b3; font-size: 12.5px;
  margin-bottom: 12px; line-height: 1.6;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(12px);
  background: #1e2940ee; border: 1px solid var(--line-2); color: var(--tx);
  padding: 11px 18px; border-radius: 999px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: all .22s; z-index: 200; max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #3a1c22ee; border-color: #ff6b6b55; color: #ffc9c9; }

/* ---------- 详情页（员工端） ---------- */
.detail-back {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px;
  font-size: 13px; color: var(--tx-2); cursor: pointer;
  padding: 6px 12px 6px 8px; border-radius: 999px; background: #ffffff08;
  border: 1px solid var(--line); font-family: inherit;
}
.detail-title { font-size: 18px; font-weight: 650; line-height: 1.45; margin: 0 0 10px; }
.sec-lbl {
  font-size: 11px; color: var(--tx-3); letter-spacing: .8px;
  text-transform: uppercase; margin: 16px 0 7px; font-weight: 600;
}

/* ---------- 看板（员工端首屏） ---------- */
.kb { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-bottom: 16px; }
.kb-c {
  padding: 14px 13px; border-radius: var(--r); background: var(--card);
  border: 1px solid var(--line);
}
.kb-c .n { font-size: 26px; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kb-c .l { font-size: 11.5px; color: var(--tx-3); margin-top: 3px; }
.kb-c.hi .n { color: var(--amber); }
.kb-c.bad .n { color: var(--red); }
.kb-c.ok .n { color: var(--green); }

.weekfeed {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  margin-bottom: 16px; font-size: 12.5px; color: var(--tx-2);
}
.weekfeed b { color: var(--green); font-variant-numeric: tabular-nums; }

/* 分组标题 */
.grp-hd {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--tx-2); font-weight: 600;
  margin: 16px 0 8px;
}
.grp-hd::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.grp-hd .n { color: var(--tx-3); font-weight: 500; }

/* 附件示意 */
.att { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.att span {
  font-size: 10.5px; padding: 3px 8px; border-radius: 6px;
  background: #ffffff0a; border: 1px solid var(--line); color: var(--tx-3);
}

/* 演示数据提示 */
.demo-note {
  font-size: 11px; color: var(--tx-3); padding: 9px 12px;
  background: #ffffff06; border: 1px dashed var(--line-2);
  border-radius: var(--r-sm); margin-bottom: 14px; line-height: 1.65;
  display: flex; align-items: flex-start; gap: 8px;
}
.demo-note button {
  margin-left: auto; flex: 0 0 auto; font-size: 11px; padding: 4px 9px;
  border-radius: 7px; background: #ffffff0d; border: 1px solid var(--line-2);
  color: var(--tx-2); cursor: pointer; font-family: inherit;
}
