/* ============================================================
   分组任务完成台账 · Fluent 蓝白玻璃平面风格
   ============================================================ */
:root {
  --accent: #0f6cbd;
  --accent-hover: #115ea3;
  --accent-press: #0c3b5e;
  --accent-soft: #eaf2fc;
  --accent-soft-2: #dcebfd;
  --accent-line: #bcd8f5;

  --bg: #f1f5fb;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-solid: #ffffff;
  --surface-soft: rgba(247, 250, 254, 0.9);

  --ink: #182430;
  --muted: #5b6675;
  --faint: #8a94a3;

  --line: rgba(16, 42, 78, 0.11);
  --line-strong: rgba(16, 42, 78, 0.17);
  --line-soft: rgba(16, 42, 78, 0.065);

  --success: #0e7a3d;
  --success-soft: #e5f4ea;
  --success-line: #a6d5b8;
  --danger: #c4314b;
  --danger-soft: #fdecef;
  --danger-line: #eab5bf;
  --warn: #9a6700;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --shadow-1: 0 1px 2px rgba(12, 34, 62, 0.05), 0 8px 24px rgba(12, 34, 62, 0.06);
  --shadow-2: 0 2px 6px rgba(12, 34, 62, 0.08), 0 18px 48px rgba(12, 34, 62, 0.16);
  --blur: blur(24px) saturate(150%);

  --topbar-h: 60px;
  --font: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei",
    "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 560px at 8% -12%, #dbeafe 0%, rgba(219, 234, 254, 0) 62%),
    radial-gradient(900px 520px at 106% 4%, #e4efff 0%, rgba(228, 239, 255, 0) 58%),
    linear-gradient(180deg, #f7faff 0%, #f1f5fb 42%, #edf2f9 100%);
  background-attachment: fixed;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }

.icon {
  width: 18px; height: 18px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}

::selection { background: #cfe4fb; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 通用按钮 / 表单 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .06s ease;
  backdrop-filter: blur(8px);
}
.btn:hover { border-color: var(--accent-line); background: #fff; color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 1px 2px rgba(12, 59, 94, .18);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-primary:active { background: var(--accent-press); border-color: var(--accent-press); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a92740; border-color: #a92740; color: #fff; }
.btn-danger-ghost { color: var(--danger); border-color: transparent; background: transparent; }
.btn-danger-ghost:hover { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.btn-block { width: 100%; }
.btn-lg { height: 46px; font-size: 14.5px; border-radius: 10px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 500; }
.field > span em { color: var(--danger); font-style: normal; }
.field input, .field select, .select {
  height: 38px; padding: 0 11px; width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .92);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field input:hover, .field select:hover, .select:hover { border-color: #a9bdd6; }
.field input:focus, .field select:focus, .select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 108, 189, .14);
  background: #fff;
}
.field input::placeholder { color: #a6aebb; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-error {
  padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--danger-soft); border: 1px solid var(--danger-line);
  color: var(--danger); font-size: 12.5px;
}
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- 登录 ---------- */
.login-view {
  position: relative; min-height: 100dvh;
  display: grid; place-items: center; padding: 28px 18px;
  overflow: hidden;
}
.login-mesh { position: absolute; inset: 0; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .6; }
.blob.b1 { width: 520px; height: 520px; left: -140px; top: -160px; background: #c3dcff; }
.blob.b2 { width: 460px; height: 460px; right: -120px; top: 8%; background: #d9e9ff; }
.blob.b3 { width: 620px; height: 620px; left: 30%; bottom: -320px; background: #cfe2ff; }
.login-card {
  position: relative; z-index: 1;
  width: min(420px, 100%);
  padding: 34px 34px 26px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, .85);
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(30px) saturate(160%);
  box-shadow: 0 30px 80px rgba(17, 52, 94, .16), inset 0 1px 0 rgba(255, 255, 255, .9);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 13.5px; color: var(--accent); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  display: inline-grid; place-items: center;
  background: linear-gradient(145deg, #1a7fd4, #0c5aa3);
  box-shadow: 0 6px 16px rgba(15, 108, 189, .28), inset 0 1px 0 rgba(255, 255, 255, .35);
  color: #fff; flex: 0 0 auto;
}
.brand-mark .icon { width: 20px; height: 20px; stroke-width: 2.6; }
.brand-mark.sm { width: 30px; height: 30px; border-radius: 9px; }
.brand-mark.sm .icon { width: 17px; height: 17px; }
.login-card h1 { margin: 22px 0 6px; font-size: 27px; font-weight: 650; letter-spacing: -.02em; }
.login-sub { margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.login-card form { display: grid; gap: 15px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .icon { position: absolute; left: 12px; color: var(--faint); width: 17px; height: 17px; pointer-events: none; }
.input-wrap input {
  height: 46px; width: 100%; padding: 0 58px 0 38px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: rgba(255, 255, 255, .9);
  transition: border-color .15s, box-shadow .15s;
}
.input-wrap input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 108, 189, .14); background: #fff; }
.input-wrap input::placeholder { color: #a6aebb; }
.reveal {
  position: absolute; right: 6px; height: 32px; padding: 0 9px;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--accent); font-size: 12px; cursor: pointer;
}
.reveal:hover { background: var(--accent-soft); }
.login-foot {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--line-soft);
  color: var(--faint); font-size: 11.5px;
}
.login-foot .icon { width: 13px; height: 13px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 22px;
  padding: 0 24px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8), 0 6px 24px rgba(16, 42, 78, .04);
}
.brand-mini { display: flex; align-items: center; gap: 10px; color: var(--ink); flex: 0 0 auto; }
.brand-name { font-size: 14.5px; font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav-item {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 13px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-item .icon { width: 17px; height: 17px; }
.nav-item:hover { background: rgba(15, 108, 189, .07); color: var(--accent); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; position: relative; }
.sync-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 11px; border-radius: 999px;
  background: rgba(255, 255, 255, .7); border: 1px solid var(--line);
  color: var(--muted); font-size: 11.5px; white-space: nowrap;
}
.sync-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(14, 122, 61, .12); }
.sync-pill.saving .dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(15, 108, 189, .14); animation: pulse 1s infinite; }
.sync-pill.error { color: var(--danger); }
.sync-pill.error .dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(196, 49, 75, .14); }
.sync-pill.offline .dot { background: var(--faint); box-shadow: none; }
@keyframes pulse { 50% { opacity: .35; } }
.avatar-btn {
  display: inline-flex; align-items: center; gap: 3px;
  border: 0; background: transparent; padding: 2px; border-radius: 999px; cursor: pointer;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: linear-gradient(145deg, #dcebfd, #c7def8);
  color: var(--accent); font-size: 12.5px; font-weight: 700;
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}
.avatar-btn .chev { width: 14px; height: 14px; color: var(--faint); }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 3px rgba(15, 108, 189, .12); }
.user-menu {
  position: absolute; right: 0; top: 48px; z-index: 60;
  width: 224px; padding: 6px;
  border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow-2);
  animation: pop .14s ease-out;
}
.um-head { padding: 10px 11px 11px; border-bottom: 1px solid var(--line-soft); margin-bottom: 5px; display: grid; gap: 2px; }
.um-head strong { font-size: 13px; font-weight: 600; }
.um-head span { font-size: 11.5px; color: var(--muted); }
.user-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 11px; border: 0; border-radius: 7px;
  background: transparent; color: var(--ink); font-size: 13px; text-align: left; cursor: pointer;
}
.user-menu button:hover { background: var(--accent-soft); color: var(--accent); }
.user-menu .icon { width: 16px; height: 16px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.99); } }

/* ---------- 页面 ---------- */
.main { padding-bottom: 46px; }
.view { max-width: 1320px; margin: 0 auto; padding: 24px 28px 8px; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px;
  margin-bottom: 18px;
}
.page-head h1 { margin: 0; font-size: 23px; font-weight: 650; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.card {
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, .72);
  background: var(--surface);
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255, 255, 255, .75);
}

/* ---------- 概览 ---------- */
.hero { display: grid; grid-template-columns: minmax(300px, .92fr) minmax(380px, 1.28fr); gap: 16px; }
.kpi-card { padding: 22px 24px 20px; }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--accent); letter-spacing: .08em; }
.kpi-label::before {
  content: ""; display: inline-block; width: 16px; height: 2px;
  background: var(--accent); border-radius: 2px;
  margin-right: 8px; vertical-align: middle;
}
.kpi-value {
  margin: 12px 0 4px; font-size: 68px; line-height: .92; font-weight: 650;
  color: var(--accent); letter-spacing: -.035em; font-variant-numeric: tabular-nums;
}
.kpi-value span { font-size: 26px; font-weight: 600; margin-left: 2px; letter-spacing: 0; }
.kpi-meta { color: var(--muted); font-size: 12.5px; }
.kpi-meta b { color: var(--ink); font-variant-numeric: tabular-nums; }
.class-bars { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft); display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 84px 1fr 48px; align-items: center; gap: 10px; }
.bar-tag { font-size: 12px; color: var(--muted); }
.bar { height: 8px; border-radius: 999px; background: #e7eef8; overflow: hidden; }
.bar .fill { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .35s ease; }
.bar .fill.c1 { background: linear-gradient(90deg, #0f6cbd, #3f92e0); }
.bar .fill.c2 { background: linear-gradient(90deg, #2f6b9f, #5ea6d8); }
.bar-pct { text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.group-card { padding: 20px 22px; }
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 14px; font-weight: 650; }
.card-head span { font-size: 11.5px; color: var(--faint); }
.group-list { display: grid; gap: 9px; }
.g-row {
  display: grid; grid-template-columns: 78px 44px minmax(70px, .9fr) minmax(80px, 1.3fr) 44px;
  align-items: center; gap: 9px; font-size: 12px;
}
.g-cls {
  font-size: 10.5px; padding: 2px 6px; border-radius: 5px; text-align: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 500; white-space: nowrap;
}
.g-name { color: var(--muted); }
.g-lead {
  color: var(--accent); font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.g-lead::before { content: "组长 "; font-size: 10px; font-weight: 400; color: var(--faint); }
.g-bar { height: 7px; background: #e7eef8; border-radius: 999px; overflow: hidden; }
.g-bar .fill { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .35s ease; }
.g-pct { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  margin-top: 16px; padding: 10px 12px;
}
.seg {
  display: inline-flex; align-items: center; padding: 3px; gap: 2px;
  background: #e9eff7; border: 1px solid var(--line-soft); border-radius: 999px;
}
.seg button {
  height: 30px; padding: 0 15px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: background .15s, color .15s, box-shadow .15s;
}
.seg button:hover { color: var(--accent); }
.seg button[aria-pressed="true"] {
  background: var(--accent); color: #fff;
  box-shadow: 0 1px 3px rgba(12, 59, 94, .22);
}
.select { width: auto; min-width: 118px; height: 36px; padding-right: 30px; font-size: 12.5px; }
.search {
  position: relative; display: flex; align-items: center;
  height: 36px; min-width: 210px;
}
.search .icon { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search input {
  width: 100%; height: 36px; padding: 0 12px 0 34px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .9); font-size: 12.5px;
  transition: border-color .15s, box-shadow .15s;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 108, 189, .14); background: #fff; }
.search input::placeholder { color: #a6aebb; }
.search.grow { flex: 1 1 260px; }
.count-note { font-size: 11.5px; color: var(--faint); margin-left: auto; white-space: nowrap; }

/* ---------- 台账表格 ---------- */
.table-shell {
  margin-top: 14px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .72);
  background: var(--surface);
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255, 255, 255, .75);
}
.table-scroll { overflow: auto; max-height: calc(100vh - 350px); min-height: 220px; overscroll-behavior: contain; }
table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
#mainTable { min-width: 1080px; }
thead th {
  position: sticky; top: 0; z-index: 3;
  padding: 10px 6px; text-align: center;
  background: rgba(247, 250, 254, .94);
  backdrop-filter: blur(12px);
  color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .03em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
thead th.t-name { cursor: pointer; color: var(--accent); }
thead th.t-name:hover { background: var(--accent-soft); }
tbody td {
  height: 38px; padding: 5px 6px; text-align: center;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px; vertical-align: middle;
}
tbody td.left { text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(15, 108, 189, .035); }
tbody tr.leader td { background: rgba(15, 108, 189, .055); }
tbody tr.leader td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
tbody tr.leader:hover td { background: rgba(15, 108, 189, .085); }
tbody tr.grp-start td { border-top: 2px solid #d5e2f1; }
td.idx { color: var(--faint); font-variant-numeric: tabular-nums; }
.chip {
  display: inline-block; padding: 2px 7px; border-radius: 5px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.chip.c2 { background: #e4f0fb; color: #21618f; }
.chip.lead { background: #d7e8fb; color: var(--accent-press); }
td.cls-cell.k1 { background: rgba(15, 108, 189, .025); }
td.cls-cell.k2 { background: rgba(47, 107, 159, .03); }
.name { font-weight: 450; }
.leader .name { font-weight: 700; color: var(--accent-press); }
.task {
  width: 100%; height: 27px; padding: 0 3px;
  border: 1px dashed #c7d4e4; border-radius: var(--radius-xs);
  background: transparent; color: var(--faint);
  font-size: 11.5px; cursor: pointer;
  transition: background .13s, border-color .13s, color .13s;
}
.task:hover { border: 1px solid var(--accent); color: var(--accent); background: rgba(15, 108, 189, .05); }
.task.done { background: var(--success-soft); border: 1px solid var(--success-line); color: var(--success); font-weight: 600; }
.task.undo { background: var(--danger-soft); border: 1px solid var(--danger-line); color: var(--danger); font-weight: 600; }
.cnt { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.rate { font-variant-numeric: tabular-nums; color: var(--muted); }
.rate.hi { color: var(--success); font-weight: 700; }
.rate.zero { color: var(--faint); }
.note {
  display: block; min-height: 24px; padding: 3px 6px;
  border: 1px solid transparent; border-radius: 5px;
  font-size: 12px; color: #3d4957; text-align: left; outline: none;
  overflow-wrap: anywhere;
}
.note:empty::before { content: "—"; color: #c3cad4; }
.note:hover { border-color: var(--line); background: rgba(255, 255, 255, .6); }
.note:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(15, 108, 189, .12); }
.empty-row td { padding: 48px; color: var(--faint); font-size: 13px; }

/* ---------- 移动端成员卡片 ---------- */
.mobile-list { display: none; }

/* ---------- 页脚 ---------- */
.foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; margin-top: 18px; flex-wrap: wrap; }
.note-box { max-width: 620px; color: var(--muted); font-size: 11.5px; line-height: 1.8; }
.note-box h3 { margin: 0 0 4px; color: var(--ink); font-size: 12px; font-weight: 600; }
.note-box p { margin: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 13px; align-items: center; color: var(--muted); font-size: 11.5px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 20px; height: 12px; border-radius: 4px; border: 1px solid var(--line); }
.sw.lead { background: rgba(15, 108, 189, .1); border-color: var(--accent-line); }
.sw.c1 { background: var(--accent-soft); }
.sw.c2 { background: #e4f0fb; }
.sw.done { background: var(--success-soft); border-color: var(--success-line); }
.sw.undo { background: var(--danger-soft); border-color: var(--danger-line); }

/* ---------- 用户 / 日志 ---------- */
.users-table { min-width: 900px; }
.users-table td, .audit-table td { text-align: left; }
.users-table thead th, .audit-table thead th { text-align: left; padding-left: 12px; }
.users-table td { padding: 9px 12px; }
.user-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.avatar-sm {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  display: inline-grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 700;
}
.user-cell .uc-main { min-width: 0; display: grid; }
.user-cell b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-cell small { color: var(--faint); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; background: var(--accent-soft); color: var(--accent);
}
.badge.owner { background: #dcebfd; color: var(--accent-press); }
.badge.admin { background: #e7f0fb; color: #235f96; }
.badge.member { background: #eef2f7; color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--success); }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.disabled { color: var(--faint); }
.email-cell { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.verified { font-size: 10px; color: var(--success); background: var(--success-soft); padding: 1px 5px; border-radius: 4px; }
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.row-actions .btn { height: 28px; padding: 0 8px; font-size: 11.5px; }
.audit-table { min-width: 780px; }
.audit-table td { padding: 8px 12px; font-size: 12px; vertical-align: top; }
.audit-table td.detail { color: var(--muted); overflow-wrap: anywhere; }
.audit-table .op { font-weight: 600; color: var(--ink); }
.load-more { display: flex; justify-content: center; margin: 16px 0 0; }

/* ---------- 对话框 ---------- */
dialog.dlg {
  width: min(560px, calc(100vw - 32px));
  max-height: min(90dvh, 860px);
  padding: 0; border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 16px; background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
dialog.dlg[open] { animation: dlgIn .18s cubic-bezier(.2, .9, .3, 1); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(10px) scale(.985); } }
dialog.dlg::backdrop { background: rgba(11, 32, 58, .38); backdrop-filter: blur(4px); }
dialog.dlg-sm { width: min(440px, calc(100vw - 32px)); }
dialog.dlg-wide { width: min(720px, calc(100vw - 32px)); }
dialog form { display: flex; flex-direction: column; max-height: min(90dvh, 860px); }
.dlg-head { padding: 22px 24px 0; }
.dlg-head h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.dlg-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.dlg-body { padding: 18px 24px 4px; display: grid; gap: 13px; overflow: auto; }
.dlg-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 24px 20px; margin-top: 8px;
  border-top: 1px solid var(--line-soft);
}
.temp-pass {
  padding: 16px; border-radius: 10px; background: var(--accent-soft);
  border: 1px dashed var(--accent-line);
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 19px; letter-spacing: .06em; text-align: center; color: var(--accent-press);
  user-select: all; overflow-wrap: anywhere;
}
.profile-body { gap: 0; padding-top: 6px; }
.p-section { padding: 17px 0; border-bottom: 1px solid var(--line-soft); display: grid; gap: 11px; }
.p-section:last-child { border-bottom: 0; }
.p-section h3 { margin: 0; font-size: 13px; font-weight: 650; }
.inline-form { display: flex; flex-direction: row; align-items: flex-end; gap: 10px; }
.inline-form.wrap { flex-wrap: wrap; }
.inline-form .grow { flex: 1 1 150px; }
.email-state { font-size: 12.5px; color: var(--muted); padding: 10px 12px; background: var(--surface-soft); border: 1px solid var(--line-soft); border-radius: 8px; }
.email-state b { color: var(--ink); font-weight: 600; }
.email-state .ok { color: var(--success); font-weight: 600; }
.email-state .no { color: var(--warn); font-weight: 600; }
.email-actions { display: flex; align-items: flex-end; gap: 8px; }
.email-actions .grow { flex: 1 1 auto; }
.email-actions .btn { height: 38px; }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed; right: 22px; bottom: 22px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 9px;
  max-width: 360px; padding: 11px 15px;
  border-radius: 10px;
  background: rgba(24, 36, 48, .94);
  color: #fff; font-size: 12.5px;
  box-shadow: 0 12px 32px rgba(12, 34, 62, .24);
  backdrop-filter: blur(12px);
  animation: toastIn .2s ease-out;
  overflow-wrap: anywhere;
}
.toast .icon { width: 16px; height: 16px; }
.toast.success { border-left: 3px solid #51c07c; }
.toast.error { border-left: 3px solid #ff8095; }
.toast.info { border-left: 3px solid #6db3f2; }
.toast.leaving { animation: toastOut .18s ease-in forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* ---------- 移动端 ---------- */
.tabbar { display: none; }

@media (max-width: 960px) {
  .brand-name { display: none; }
  .topbar { gap: 12px; padding: 0 14px; }
  .nav { gap: 2px; }
  .nav-item { padding: 0 10px; }
}

@media (max-width: 900px) {
  .nav { display: none; }
  .view { padding: 16px 14px 6px; }
  .main { padding-bottom: 86px; }
  .page-head { align-items: flex-start; margin-bottom: 14px; }
  .page-head h1 { font-size: 20px; }
  .page-head p { font-size: 11.5px; }
  .page-actions { gap: 6px; }
  .page-actions .btn { height: 34px; padding: 0 10px; }
  #view-ledger .page-actions .btn span { display: none; }
  .hero { grid-template-columns: 1fr; gap: 12px; }
  .kpi-card { padding: 18px 18px 16px; }
  .kpi-value { font-size: 54px; }
  .group-card { padding: 16px 16px; }
  .g-row {
    grid-template-columns: 78px 42px minmax(0, 1fr) 42px;
    grid-template-areas: "cls name lead pct" "bar bar bar bar";
    row-gap: 6px; column-gap: 8px;
  }
  .g-cls { grid-area: cls; }
  .g-name { grid-area: name; }
  .g-lead { grid-area: lead; }
  .g-pct { grid-area: pct; }
  .g-bar { grid-area: bar; height: 8px; }
  .toolbar { padding: 9px 10px; gap: 8px; margin-top: 12px; }
  .toolbar .count-note { order: 9; margin-left: 0; }
  .seg { flex: 0 0 auto; }
  .seg button { padding: 0 13px; }
  .select { flex: 1 1 110px; }
  .search { order: 5; flex: 1 1 100%; min-width: 0; }
  #view-ledger .table-shell,
  #view-users .table-shell { display: none; }
  #mobileList, #usersMobile { display: block; margin-top: 14px; }
  .foot { flex-direction: column; gap: 12px; }
  .sync-pill { padding: 0 8px; }
  .sync-pill #syncText { max-width: 128px; overflow: hidden; text-overflow: ellipsis; }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    display: flex; align-items: stretch;
    height: calc(58px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .86);
    backdrop-filter: var(--blur);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 24px rgba(16, 42, 78, .05);
  }
  .tabbar button {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; background: transparent; color: var(--faint);
    font-size: 10.5px; font-weight: 500; cursor: pointer;
    position: relative;
  }
  .tabbar button .icon { width: 20px; height: 20px; }
  .tabbar button.active { color: var(--accent); }
  .tabbar button.active::before {
    content: ""; position: absolute; top: 4px; width: 22px; height: 3px;
    border-radius: 999px; background: var(--accent);
  }

  .m-group-head {
    display: flex; align-items: center; gap: 8px;
    margin: 18px 2px 8px; padding-left: 9px;
    border-left: 3px solid var(--accent);
    font-size: 12px; color: var(--muted); font-weight: 500;
  }
  .m-group-head:first-child { margin-top: 0; }
  .m-group-head b { color: var(--ink); font-weight: 650; }
  .m-group-head span { color: var(--faint); font-size: 11px; }
  .m-card {
    padding: 13px 14px 12px; margin-bottom: 10px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, .8);
    background: rgba(255, 255, 255, .8);
    backdrop-filter: blur(18px) saturate(140%);
    box-shadow: 0 1px 2px rgba(12, 34, 62, .04), 0 6px 18px rgba(12, 34, 62, .05);
  }
  .m-card.leader { border-color: var(--accent-line); background: rgba(240, 247, 255, .88); box-shadow: inset 3px 0 0 var(--accent), 0 6px 18px rgba(12, 34, 62, .05); }
  .m-top { display: flex; align-items: center; gap: 10px; }
  .m-avatar {
    width: 36px; height: 36px; border-radius: 10px; flex: 0 0 auto;
    display: inline-grid; place-items: center;
    background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 700;
  }
  .m-card.leader .m-avatar { background: var(--accent); color: #fff; }
  .m-person { flex: 1; min-width: 0; }
  .m-name { display: flex; align-items: center; gap: 6px; font-size: 14.5px; font-weight: 600; }
  .m-meta { margin-top: 1px; color: var(--faint); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-rate { text-align: right; flex: 0 0 auto; }
  .m-rate b { display: block; font-size: 16px; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1.1; }
  .m-rate span { font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
  .m-tasks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 11px; }
  .m-task {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    min-height: 40px; padding: 5px 10px;
    border: 1px dashed #c9d5e4; border-radius: 8px;
    background: rgba(255, 255, 255, .55); color: var(--faint);
    cursor: pointer; text-align: left;
  }
  .m-task .mt-name { font-size: 10.5px; color: var(--faint); max-width: 58%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-task .mt-state { font-size: 12px; font-weight: 600; }
  .m-task.done { background: var(--success-soft); border: 1px solid var(--success-line); color: var(--success); }
  .m-task.done .mt-name { color: #3e7a56; }
  .m-task.undo { background: var(--danger-soft); border: 1px solid var(--danger-line); color: var(--danger); }
  .m-task.undo .mt-name { color: #96545f; }
  .m-task:last-child { grid-column: 1 / -1; }
  .m-task:active { transform: scale(.99); }
  .m-note { margin-top: 9px; display: flex; align-items: flex-start; gap: 8px; }
  .m-note > span:first-child { flex: 0 0 auto; padding-top: 4px; font-size: 10.5px; color: var(--faint); }
  .m-note .note { flex: 1; font-size: 12px; min-height: 26px; }

  .users-table, .audit-table { min-width: 820px; }
  .toast-wrap { left: 14px; right: 14px; bottom: calc(72px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; }
  dialog.dlg { width: calc(100vw - 20px); max-height: 92dvh; }
  .dlg-head { padding: 18px 18px 0; }
  .dlg-body { padding: 14px 18px 4px; }
  .dlg-foot { padding: 14px 18px 16px; }
  .profile-body { padding-top: 4px; }
  .inline-form { flex-wrap: wrap; }
  .email-actions { flex-wrap: wrap; }
  .email-actions .btn { flex: 1 1 100%; }
}

@media (max-width: 460px) {
  .kpi-value { font-size: 48px; }
  .page-head { flex-direction: column; gap: 10px; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .bar-row { grid-template-columns: 76px 1fr 42px; }
}

@media (max-width: 340px) {
  .m-tasks { grid-template-columns: 1fr; }
  .m-task:last-child { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .topbar, .tabbar, .toolbar, .page-actions, .foot, .sync-pill, .toast-wrap { display: none !important; }
  body { background: #fff; }
  .view { padding: 0; max-width: none; }
  .card, .table-shell { box-shadow: none; backdrop-filter: none; background: #fff; }
  .table-shell { border: 1px solid #ccc; }
  .table-scroll { max-height: none; overflow: visible; }
  #mobileList { display: none !important; }
  .table-shell { display: block !important; }
  thead th { position: static; }
  tbody tr { break-inside: avoid; }
}
