:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --border: #e3e8f0;
  --border-soft: #eef1f6;
  --text: #0f172a;
  --text-2: #5b6879;
  --text-3: #97a1b0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #059669;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 650; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 20% -10%, #e5ecff 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 20%, #e9f2ff 0%, transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(15, 23, 42, .08);
  padding: 32px 28px;
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 26px; }
.brand-mark {
  width: 42px; height: 42px; flex: none;
  border-radius: 11px;
  background: linear-gradient(135deg, #2f6bff, #1d4ed8);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .28);
}
.brand-mark.sm { width: 34px; height: 34px; font-size: 15px; border-radius: 9px; }
.brand-text h1 { font-size: 18px; letter-spacing: .2px; }
.brand-text p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-3); }

.field { display: block; margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: 6px;
  font-weight: 500;
}
.field-label.inline { display: inline; margin: 0 6px 0 0; }

input[type="text"], input[type="tel"], input[type="number"], input[type="date"], input[type="password"], select {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
select { appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2397a1b0' d='M6 8.5 1.5 4h9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.code-row .btn { flex: none; width: 108px; }

.field-error {
  margin: -8px 0 12px;
  font-size: 12.5px;
  color: var(--danger);
}
.login-tip { margin: 14px 0 0; font-size: 12px; color: var(--text-3); text-align: center; }

/* ---------------- 按钮 ---------------- */
.btn {
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { background: #f7f9fc; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .22);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost { background: #fff; }
.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-dashed {
  width: 100%;
  border-style: dashed;
  color: var(--primary);
  background: #fbfcff;
}
.btn-dashed:hover { background: var(--primary-soft); }

/* 今天 / 补录昨天 切换 */
.seg {
  display: flex; border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; background: #fff;
}
.seg-btn {
  flex: 1; min-width: 0; min-height: 42px; padding: 6px 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: none; background: #fff; color: var(--text-2);
  font-size: 13.5px; font-family: inherit; cursor: pointer;
  transition: background .15s, color .15s;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn b { display: block; font-weight: 400; font-size: 11px; opacity: .7; margin-top: 1px; }
.seg-btn.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.seg-btn.active b { opacity: .85; }
.seg-btn[data-date="yesterday"].active { background: #fff7ed; color: #b45309; }

.entry-hint.warn {
  color: #92400e; background: #fff7ed;
  border: 1px solid #fed7aa; border-radius: 8px; padding: 8px 10px;
}
.late-tag {
  display: inline-block; margin-left: 5px; padding: 0 5px;
  font-size: 10.5px; line-height: 16px; border-radius: 4px;
  color: #b45309; background: #fff7ed; border: 1px solid #fed7aa;
  vertical-align: 1px;
}
.btn-wechat {
  background: #07c160; border-color: #07c160; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  box-shadow: 0 2px 8px rgba(7, 193, 96, .24);
}
.btn-wechat:hover { background: #06ad56; border-color: #06ad56; }
.btn-wechat:active { background: #069c4d; }
.wx-ico { width: 19px; height: 19px; fill: currentColor; flex-shrink: 0; }
.login-split {
  position: relative; margin: 18px 0 14px; height: 1px; background: var(--border-soft);
}
.login-split span {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: #fff; padding: 0 12px; font-size: 12px; color: var(--text-3);
}
.login-tip.center { text-align: center; }
.login-tip + .btn-block { margin-top: 10px; }

/* 绑定申请 */
.bind-admin .br-actions { display: flex; gap: 6px; }
.bind-admin .br-ok { color: var(--ok); }
.bind-admin .br-no { color: var(--danger); }
.bind-empty { font-size: 12.5px; color: var(--text-3); padding: 6px 2px; }
.badge-dot {
  display: inline-block; min-width: 16px; height: 16px; line-height: 16px;
  margin-left: 6px; padding: 0 4px; border-radius: 8px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 600;
  vertical-align: 1px; text-align: center;
}

.chip {
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-2);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.on { background: var(--primary-soft); border-color: #c3d6ff; color: var(--primary-dark); font-weight: 600; }

.icon-btn {
  width: 30px; height: 30px;
  border: none; background: transparent;
  color: var(--text-3);
  font-size: 15px; cursor: pointer; border-radius: 6px;
}
.icon-btn:hover { background: #f2f4f8; color: var(--text); }

.link-btn {
  border: none; background: none; padding: 0;
  color: var(--primary); font-size: 13px; font-family: inherit; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }

/* ---------------- 布局 ---------------- */
.app { min-height: 100vh; padding-bottom: 40px; }
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.app-title { font-size: 17px; }
.app-sub { margin: 2px 0 0; font-size: 12px; color: var(--text-3); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip {
  font-size: 13px; color: var(--text-2);
  background: #f2f5fa; border: 1px solid var(--border-soft);
  padding: 5px 11px; border-radius: 999px;
}

.wrap { max-width: 1240px; margin: 0 auto; padding: 20px 24px 0; display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.card-head h2 { font-size: 15px; }
.card-note { font-size: 12.5px; color: var(--text-3); }
.head-tools { display: flex; align-items: center; gap: 4px; }
.select-sm { height: 32px; width: 120px; font-size: 13px; }

/* ---------------- 筛选 ---------------- */
.filter-card { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.filter-row { display: flex; gap: 14px; flex-wrap: wrap; flex: 1; align-items: flex-end; }
.filter-item { min-width: 148px; }
.filter-item.grow { min-width: 260px; flex: 1; }
.filter-item .field-label { margin-bottom: 6px; }
.quick-row { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 3px; }
.filter-actions { display: flex; gap: 10px; align-items: center; }

/* ---------------- 概览条 ---------------- */
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px;
}
.stat .k { font-size: 12.5px; color: var(--text-3); }
.stat .v { font-size: 26px; font-weight: 680; margin-top: 6px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--text-2); margin-top: 4px; }

/* ---------------- 指标卡 ---------------- */
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric {
  border: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #fcfdff, #fff);
  border-radius: 10px;
  padding: 13px 14px;
}
.metric .m-k { font-size: 12.5px; color: var(--text-2); }
.metric .m-v { font-size: 22px; font-weight: 680; margin-top: 5px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.metric .m-a { font-size: 12px; color: var(--text-3); margin-top: 3px; font-variant-numeric: tabular-nums; }
.metric.hl { border-color: #c9dcff; background: linear-gradient(180deg, #f2f7ff, #fff); }

/* ---------------- 漏斗 ---------------- */
.funnel { display: flex; flex-direction: column; gap: 11px; }
.f-stage { display: grid; grid-template-columns: 96px 1fr 150px; align-items: center; gap: 12px; }
.f-name { font-size: 13px; color: var(--text-2); }
.f-bar { height: 22px; background: #f0f3f8; border-radius: 6px; overflow: hidden; }
.f-fill {
  height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, #3b74ff, #2563eb);
  min-width: 3px;
  transition: width .35s ease;
}
.f-stage:nth-child(3) .f-fill { background: linear-gradient(90deg, #4b86ff, #2f6bef); }
.f-stage:nth-child(4) .f-fill { background: linear-gradient(90deg, #5f95ff, #3a72f0); }
.f-stage:nth-child(5) .f-fill { background: linear-gradient(90deg, #74a5ff, #4a7ef2); }
.f-num { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; text-align: right; }
.f-num b { color: var(--text); font-weight: 650; }
.f-num span { color: var(--text-3); }

/* ---------------- 表格 ---------------- */
.table-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td {
  padding: 9px 10px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-soft);
  font-variant-numeric: tabular-nums;
}
.tbl th {
  font-size: 12px; font-weight: 600; color: var(--text-3);
  background: #fafbfd;
  position: sticky; top: 0;
  border-bottom: 1px solid var(--border);
}
.tbl th:first-child, .tbl td:first-child,
.tbl th.txt, .tbl td.txt { text-align: left; }
.tbl tbody tr:hover { background: #fafbfe; }
.tbl tfoot td {
  font-weight: 680;
  background: #fafbfd;
  border-top: 1px solid var(--border);
  border-bottom: none;
}
.tbl .ops { display: flex; gap: 10px; justify-content: flex-end; }
.empty {
  padding: 34px 0; text-align: center; color: var(--text-3); font-size: 13px;
}
.rank-no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 5px;
  background: #f0f3f8; color: var(--text-2); font-size: 11.5px; font-weight: 650;
}
.rank-no.top { background: var(--primary); color: #fff; }
.dim { color: var(--text-3); }

/* ---------------- 录入弹窗 ---------------- */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .38); backdrop-filter: blur(2px); }
.modal-panel {
  position: relative;
  width: 100%; max-width: 980px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
  overflow: hidden;
}
.modal-panel.wide { max-width: 1120px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 16px 20px; overflow: auto; flex: 1; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--border); background: #fbfcfe;
}
.entry-meta { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.entry-meta .field { margin-bottom: 0; min-width: 180px; }
#dateSwitchWrap { min-width: 230px; }
.entry-hint { margin: 0 0 4px; font-size: 12.5px; color: var(--text-3); }
.entry-scroll { max-height: 46vh; }
.entry-tbl input { height: 32px; font-size: 13px; padding: 0 8px; text-align: right; }
.entry-tbl input.name-in { text-align: left; min-width: 96px; }
.entry-tbl input:disabled { background: #f4f6fa; color: var(--text-2); cursor: not-allowed; }

/* ---------------- 录入卡片网格 ---------------- */
.entry-grid { display: flex; flex-direction: column; gap: 14px; }
.entry-card {
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 12px;
  background: #fafbfd;
}
.ec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ec-name {
  flex: 1; min-width: 0; height: 42px;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 0 12px; font-size: 15px; font-weight: 600;
  background: #fff;
}
.ec-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.ec-cell {
  display: flex; flex-direction: column; gap: 2px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 6px 4px;
  transition: border-color .15s;
}
.ec-label { font-size: 11px; color: var(--text-3); text-align: center; white-space: nowrap; }
.ec-label i { font-style: normal; font-size: 9px; color: #b08900; background: #fff7e0; border-radius: 4px; padding: 0 3px; }
.ec-cell input {
  width: 100%; height: 64px;
  border: none; background: transparent;
  font-size: 24px; font-weight: 600; text-align: center;
  padding: 0; color: #1b2330;
}
.ec-cell input:focus { outline: none; }
.ec-cell:focus-within { border-color: var(--primary); }
.ec-cell.invalid-cell { border-color: var(--danger); background: #fff5f5; }
.ec-cell.invalid-cell input { color: var(--danger); }

.entry-sums {
  display: flex; align-items: center; gap: 6px;
  margin-top: 12px; overflow-x: auto; padding-bottom: 4px;
}
.es-label { font-size: 13px; font-weight: 600; color: var(--text-2); flex-shrink: 0; }
.es-chip {
  flex-shrink: 0; font-size: 12px; color: var(--text-2);
  background: #f2f5fa; border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}
.es-chip b { color: #1b2330; }

@media (max-width: 640px) {
  .ec-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .ec-cell { padding: 10px 8px 6px; border-radius: 14px; }
  .ec-label { font-size: 12px; }
  .ec-cell input { height: 72px; font-size: 28px; }
  .ec-name { height: 46px; font-size: 16px; }
}
.entry-tbl input.invalid {
  border: 1px solid var(--danger);
  background: #fff5f5;
  color: var(--danger);
}
.entry-tbl .th-tip {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  font-weight: 400;
  color: var(--text-3);
  background: #eef3fb;
  border-radius: 4px;
  padding: 0 4px;
}
.entry-row-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.entry-tbl td, .entry-tbl th { padding: 6px 6px; }
.entry-tbl .del {
  border: none; background: none; color: var(--text-3);
  cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 5px;
}
.entry-tbl .del:hover { background: var(--danger-soft); color: var(--danger); }
.entry-tbl tfoot td { background: #fafbfd; }
.tag-new {
  font-size: 11px; color: var(--ok); background: #ecfdf5;
  border: 1px solid #c6f0dc; border-radius: 4px; padding: 1px 5px; margin-left: 6px;
}
/* hidden 属性必须生效：否则设置了 display 的浮层会一直盖在页面上 */
[hidden] { display: none !important; }

/* ---------------- 添加到桌面引导 ---------------- */
.install-bar {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 60;
  display: flex; align-items: center; gap: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, .16);
}
.ib-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 9px; background: #1876ee; color: #fff;
  font-size: 17px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.ib-text { flex: 1; min-width: 0; }
.ib-text b { display: block; font-size: 14px; }
.ib-text span { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }
.ib-add { flex-shrink: 0; touch-action: manipulation; }
.ib-add:active { opacity: .85; transform: scale(.97); }
.ib-close {
  flex-shrink: 0; border: none; background: transparent;
  color: var(--text-3); font-size: 16px; cursor: pointer; padding: 8px 6px;
  touch-action: manipulation;
}
.ib-close:active { color: var(--text); }
.install-steps { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; }
.is-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.is-panel {
  position: relative; width: 100%;
  background: #fff; border-radius: 16px 16px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
}
.is-panel h4 { margin: 0 0 14px; font-size: 16px; }
.is-panel p { font-size: 14px; line-height: 1.9; color: var(--text-2); margin: 0 0 6px; }
.is-panel b { color: var(--text); }

.phone-td { white-space: nowrap; }
.tbl td.txt { min-width: 0; }

.left-txt {
  font-size: 11px; color: #b45309; background: #fff7ed;
  border: 1px solid #fed7aa; border-radius: 4px; padding: 1px 6px;
}

/* ---------------- 在职 / 离职汇总 ---------------- */
.split-block {
  border: 1px solid var(--border-soft); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 12px; background: #fcfdff;
}
.split-block.left { background: #fffaf5; border-color: #fde3c8; }
.sb-head {
  font-size: 14px; font-weight: 600; margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.sb-head span { font-size: 12px; color: var(--text-3); font-weight: 400; }
.sb-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.sb-item {
  background: #fff; border: 1px solid var(--border-soft);
  border-radius: 8px; padding: 8px 6px; text-align: center;
}
.sb-item span { display: block; font-size: 11px; color: var(--text-3); white-space: nowrap; }
.sb-item b { display: block; font-size: 20px; color: var(--text); line-height: 1.3; }
.sb-item i { display: block; font-style: normal; font-size: 11px; color: var(--text-3); }
.sb-item.sb-hl b { color: var(--primary); }
.sb-item.sb-conn { background: #f2f6fd; border-color: #dbe6fb; }
@media (max-width: 640px) {
  .sb-grid { grid-template-columns: repeat(3, 1fr); }
  .sb-item b { font-size: 18px; }
}

/* ---------------- 待加入 ---------------- */
.howto {
  margin: 0 0 18px;
  padding-left: 20px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.9;
}
.howto b { color: var(--text); }
.pending-actions { display: flex; gap: 10px; }
.pending-actions .btn { flex: 1; }

/* ---------------- 成员管理 ---------------- */
.member-add {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}
.member-add h4 { margin: 0 0 10px; font-size: 13.5px; }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.add-row input { flex: 1 1 120px; width: auto; }
.add-row select { flex: 0 0 116px; width: auto; }
.add-row .btn { flex: none; }
.member-tip { margin: 10px 0 0; font-size: 12px; color: var(--text-3); }
.select-xs { height: 30px; width: 104px; font-size: 13px; padding: 0 8px; }
.select-xs.dept-sel { width: 168px; }
.name-edit { height: 30px; width: 96px; font-size: 13px; padding: 0 8px; }
.ok-txt { color: var(--ok); font-size: 12.5px; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: #0f172a; color: #fff;
  padding: 10px 18px; border-radius: 8px;
  font-size: 13.5px; z-index: 90;
  box-shadow: 0 8px 30px rgba(15, 23, 42, .28);
}
.toast.err { background: var(--danger); }

.foot-note { text-align: center; font-size: 12px; color: var(--text-3); padding: 8px 0 24px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1000px) {
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .wrap { padding: 14px max(14px, env(safe-area-inset-left)) 0 max(14px, env(safe-area-inset-right)); }
  .topbar {
    padding: calc(12px + env(safe-area-inset-top)) max(14px, env(safe-area-inset-left)) 10px max(14px, env(safe-area-inset-right));
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .topbar-right { padding-top: 2px; border-top: 1px solid var(--border-soft); }
  .topbar-left { flex: 1 1 100%; min-width: 0; }
  .topbar-left > div { min-width: 0; }
  .app-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-right { flex: 1 1 100%; min-width: 0; flex-wrap: wrap; row-gap: 6px; }
  .topbar-right .select-sm { flex: 1 1 120px; min-width: 96px; width: auto; max-width: 100%; }
  .topbar-right .btn { flex-shrink: 0; white-space: nowrap; padding: 6px 10px; font-size: 12.5px; }
  .user-chip {
    max-width: 34vw;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    flex-shrink: 1; min-width: 0;
  }
  .user-chip .chip-role { display: none; }
  .user-chip .chip-name { font-weight: 600; }
  .btn { white-space: nowrap; }
  .stat-strip { grid-template-columns: 1fr 1fr; gap: 12px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .filter-card { flex-direction: column; align-items: stretch; }
  .filter-actions { justify-content: flex-end; }
  .f-stage { grid-template-columns: 80px 1fr; }
  .f-num { grid-column: 2; text-align: left; }
  .entry-tbl input { height: 42px; font-size: 16px; }
  .entry-tbl input.name-in { min-width: 120px; }
  .add-row input, .add-row select { height: 42px; font-size: 16px; }
  .name-edit { height: 36px; font-size: 15px; width: 110px; }
  .dept-admin { margin-top: 8px; }
}

/* ---------------- 启动态 / 企业微信内置浏览器适配 ---------------- */
.boot-spin { display: flex; justify-content: center; padding: 10px 0 2px; }
.boot-spin span {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--primary);
  animation: boot-rotate .8s linear infinite;
}
@keyframes boot-rotate { to { transform: rotate(360deg); } }

body { overscroll-behavior-y: contain; -webkit-text-size-adjust: 100%; }
body.in-wxwork { -webkit-tap-highlight-color: transparent; }
body.in-wxwork .app { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
body.in-wxwork .login-wrap { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
/* 已用 user-scalable=no 禁缩放，无需全局放大字号，只放大登录页输入框便于点按 */
body.in-wxwork .login-card input { font-size: 16px; }
