:root {
  --brand: #2f4858;
  --brand-2: #24424f;
  --bg: #f4f6f8;
  --card: #fff;
  --line: #e3e8ec;
  --text: #1d1d1f;
  --muted: #6b7c87;
  --ok: #1f8a4c;
  --warn: #b7791f;
  --bad: #c0392b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(31, 45, 61, .08);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Roboto, "Noto Sans", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55;
}
.boot { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- 外壳 ---------- */
.shell { display: flex; min-height: 100%; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
}
.topbar .title { font-size: 16px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar button { background: transparent; border: 0; color: #fff; font-size: 15px; padding: 6px 8px; cursor: pointer; }
.icon-btn { position: relative; }
.dot {
  position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; border-radius: 8px;
  background: var(--bad); color: #fff; font-size: 10px; line-height: 16px; text-align: center; padding: 0 4px;
}
.page { flex: 1; padding: 14px 12px calc(76px + var(--safe-bottom)); max-width: 1180px; width: 100%; margin: 0 auto; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
  display: flex; padding-bottom: var(--safe-bottom);
}
.tabbar a {
  flex: 1; text-align: center; padding: 8px 2px 6px; color: var(--muted); text-decoration: none; font-size: 11px;
}
.tabbar a .ic { display: block; font-size: 19px; line-height: 1.2; }
.tabbar a.on { color: var(--brand); font-weight: 600; }

@media (min-width: 900px) {
  .sidebar {
    display: flex; flex-direction: column; width: 216px; flex: 0 0 216px; background: var(--brand-2); color: #dfe8ee;
    padding: 14px 0; position: sticky; top: 0; height: 100vh; overflow: auto;
  }
  .sidebar .brand { padding: 0 16px 12px; font-weight: 700; color: #fff; font-size: 15px; border-bottom: 1px solid rgba(255,255,255,.12); }
  .sidebar a { color: #cfdbe3; text-decoration: none; padding: 10px 16px; font-size: 14px; }
  .sidebar a.on { background: rgba(255,255,255,.1); color: #fff; border-left: 3px solid #7fb0c8; }
  .sidebar .grp { padding: 14px 16px 6px; font-size: 11px; letter-spacing: .08em; color: #8fa6b3; text-transform: uppercase; }
  .tabbar { display: none; }
  .page { padding: 20px 24px 40px; }
}

/* ---------- 卡片与排版 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card h3 { margin: 0 0 10px; font-size: 15px; color: var(--brand); }
.card .sub { color: var(--muted); font-size: 12px; margin: -6px 0 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); font-size: 12.5px; }
.tiny { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.hr { height: 1px; background: var(--line); margin: 12px -14px; }
.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
@media (max-width: 620px) { .grid.c3 { grid-template-columns: repeat(2, 1fr); } }

/* ---------- 打卡 ---------- */
.punch-wrap { text-align: center; padding: 18px 0 8px; }
.punch-btn {
  width: 168px; height: 168px; border-radius: 50%; border: 0; color: #fff; font-size: 19px; font-weight: 700;
  background: radial-gradient(circle at 32% 28%, #4b7d96, var(--brand) 62%); box-shadow: 0 6px 18px rgba(47,72,88,.32);
  cursor: pointer; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.punch-btn:disabled { background: #b6c3cb; box-shadow: none; cursor: not-allowed; }
.punch-btn .t { font-size: 30px; font-weight: 700; letter-spacing: .02em; }
.punch-btn.out { background: radial-gradient(circle at 32% 28%, #3f8f66, #1f8a4c 62%); }
.punch-meta { margin-top: 12px; color: var(--muted); font-size: 13px; }
.status-line { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.status-line:last-child { border-bottom: 0; }

/* ---------- 徽标 ---------- */
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; line-height: 18px; }
.badge.ok { background: #e6f4ec; color: var(--ok); }
.badge.warn { background: #fbf1e0; color: var(--warn); }
.badge.bad { background: #fbeae8; color: var(--bad); }
.badge.info { background: #e8eff3; color: var(--brand); }
.badge.gray { background: #eef1f3; color: var(--muted); }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 8px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.tbl th { background: #f7f9fa; color: var(--brand); font-weight: 600; position: sticky; top: 0; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl tr.click { cursor: pointer; }
table.tbl tr.click:active { background: #f1f5f7; }

/* ---------- 表单 ---------- */
label.f { display: block; margin-bottom: 10px; }
label.f > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px;
  font-family: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #a9c6d6; border-color: #a9c6d6; }
textarea { min-height: 72px; resize: vertical; }
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; font-size: 15px; cursor: pointer; font-family: inherit;
}
.btn:disabled { opacity: .55; cursor: progress; }
.btn.ghost { background: #fff; color: var(--brand); }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.block { display: block; width: 100%; text-align: center; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.filters select, .filters input { width: auto; min-width: 110px; flex: 0 0 auto; }

/* ---------- 登录 ---------- */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login .box { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 24px; width: 100%; max-width: 380px; }
.login h1 { margin: 0 0 4px; font-size: 20px; color: var(--brand); }
.login .logo { width: 56px; height: 56px; border-radius: 14px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 26px; margin-bottom: 14px; }

/* ---------- KPI ---------- */
.kpi { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.kpi .v { font-size: 20px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.kpi .k { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi .d { font-size: 11.5px; margin-top: 3px; }
.chart-box { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.chart-box h4 { margin: 0 0 8px; font-size: 13.5px; color: var(--brand); }
.chart-box canvas { width: 100% !important; max-height: 260px; }

/* ---------- 弹层与提示 ---------- */
.mask { position: fixed; inset: 0; background: rgba(20,30,38,.42); display: flex; align-items: flex-end; justify-content: center; z-index: 60; }
@media (min-width: 640px) { .mask { align-items: center; } }
.sheet { background: #fff; width: 100%; max-width: 640px; max-height: 88vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 16px; }
@media (min-width: 640px) { .sheet { border-radius: 16px; } }
.sheet h3 { margin: 0 0 12px; font-size: 16px; color: var(--brand); }
.toast-host { position: fixed; left: 0; right: 0; bottom: calc(84px + var(--safe-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 90; pointer-events: none; }
.toast { background: rgba(29,45,58,.94); color: #fff; padding: 9px 15px; border-radius: 20px; font-size: 14px; max-width: 86%; }
.toast.bad { background: rgba(160,44,34,.95); }
.toast.ok { background: rgba(24,110,64,.95); }

/* ---------- 时间线 ---------- */
.tl { list-style: none; margin: 0; padding: 0 0 0 18px; position: relative; }
.tl:before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl li { position: relative; padding: 0 0 12px; }
.tl li:before { content: ''; position: absolute; left: -17px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: #cbd6dd; }
.tl li.done:before { background: var(--ok); }
.tl li.cur:before { background: var(--warn); }
.tl li.rej:before { background: var(--bad); }

.empty { text-align: center; color: var(--muted); padding: 26px 10px; font-size: 14px; }
.install-hint { background: #eef5f8; border: 1px solid #cfe0e9; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.linklike { color: var(--brand); text-decoration: underline; cursor: pointer; background: none; border: 0; font: inherit; padding: 0; }
