:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e5e9f0;
  --line-2: #eef2f7;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff4ff;
  --pos: #dc2626;
  --neg: #111827;
  --ok: #059669;
  --warn: #d97706;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -12px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 12% -10%, #e8efff 0%, rgba(232, 239, 255, 0) 60%),
    radial-gradient(700px 400px at 100% 100%, #eaf7f1 0%, rgba(234, 247, 241, 0) 55%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 26px 22px;
  box-shadow: 0 24px 60px -30px rgba(15, 23, 42, 0.35);
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-mark {
  width: 42px; height: 42px; flex: 0 0 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  color: #fff; font-weight: 700; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 14px -6px rgba(37, 99, 235, 0.7);
}
.brand-title h1 { font-size: 17px; margin: 0 0 3px; letter-spacing: .3px; }
.brand-title p { margin: 0; font-size: 12px; color: var(--ink-3); }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.field input, .field select, .field textarea, .select, .txt {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfcfe;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  font-family: inherit;
}
textarea.txt { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.field input:focus, .txt:focus, .select:focus {
  border-color: #93b4fd;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.login-error {
  min-height: 18px;
  color: var(--pos);
  font-size: 12.5px;
  margin: -4px 0 10px;
}

/* 记住我 / 验证码 */
.chk-row {
  display: flex; align-items: flex-start; gap: 7px;
  font-size: 11.5px; color: var(--ink-2); line-height: 1.5;
  margin: -4px 0 12px; cursor: pointer; user-select: none;
}
.chk-row input { margin: 2px 0 0; width: 14px; height: 14px; accent-color: var(--brand); flex: 0 0 auto; }

.captcha-row { display: flex; gap: 10px; align-items: stretch; margin-bottom: 12px; }
.captcha-row.hidden { display: none; }
.captcha-input {
  flex: 0 0 118px; height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 9px; background: #fbfcfe;
  font-size: 16px; letter-spacing: 3px; text-align: center; color: var(--ink);
  outline: none; font-family: ui-monospace, Consolas, monospace; text-transform: uppercase;
}
.captcha-input:focus { border-color: #93b4fd; background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.captcha-img {
  flex: 1; min-width: 0; padding: 0; border: 1px solid var(--line); border-radius: 9px;
  background: #f7fafc; cursor: pointer; overflow: hidden; line-height: 0;
  display: flex; align-items: center; justify-content: center;
}
.captcha-img:hover { border-color: #c9d6ea; }
.captcha-img svg { width: 100%; height: 40px; display: block; }

.btn {
  height: 38px;
  padding: 0 15px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  white-space: nowrap;
}
.btn:hover { border-color: #c9d6ea; background: #fafcff; }
.btn:active { transform: translateY(0.5px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .8); }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.primary:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink-2); }
.btn.danger { color: var(--pos); border-color: #f3d5d5; background: #fff8f8; }
.btn.danger:hover { background: #fdeeee; }
.btn.block { width: 100%; height: 42px; font-size: 14.5px; letter-spacing: 2px; }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { background: #047857; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.login-tip { text-align: center; font-size: 11.5px; color: var(--ink-3); margin: 14px 0 0; }

/* ---------------- 顶栏 ---------------- */
.app { min-height: 100vh; padding-bottom: 40px; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand.small { margin: 0; gap: 10px; }
.brand.small .brand-mark { width: 32px; height: 32px; flex-basis: 32px; font-size: 16px; border-radius: 9px; }
.brand-text { display: flex; align-items: center; gap: 8px; }
.brand-text strong { font-size: 14.5px; letter-spacing: .2px; }

.badge {
  font-size: 11.5px; color: var(--ink-2);
  background: #f1f5f9; border: 1px solid var(--line);
  padding: 2px 8px; border-radius: 20px;
  white-space: nowrap;
}
.badge.closed { background: #fff7ed; border-color: #fed7aa; color: #b45309; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.select { height: 32px; width: auto; min-width: 150px; font-size: 12.5px; border-radius: 8px; padding: 0 8px; cursor: pointer; }

.user-chip {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--ink);
  padding-left: 10px; border-left: 1px solid var(--line);
}
.user-chip em {
  font-style: normal; font-size: 11px;
  padding: 1px 7px; border-radius: 20px;
  background: var(--brand-soft); color: var(--brand);
  border: 1px solid #dbe6ff;
}

.menu { position: relative; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid transparent; background: transparent;
  font-size: 18px; line-height: 1; color: var(--ink-2);
  cursor: pointer;
}
.icon-btn:hover { background: #f1f5f9; }
.menu-pop {
  position: absolute; right: 0; top: 38px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow);
  overflow: hidden; min-width: 132px; z-index: 40;
}
.menu-pop button {
  display: block; width: 100%; text-align: left;
  padding: 9px 14px; border: 0; background: #fff;
  font-size: 13px; color: var(--ink); cursor: pointer; font-family: inherit;
}
.menu-pop button:hover { background: #f6f9fd; }
.menu-ver {
  padding: 7px 14px 8px;
  border-top: 1px solid var(--line-2);
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ---------------- 工具栏 ---------------- */
.toolbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 18px 18px 12px;
  max-width: 1680px; margin: 0 auto;
}
.toolbar-left h2 { margin: 0 0 5px; font-size: 18px; letter-spacing: .2px; }
.stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-3); flex-wrap: wrap; }
.stats b { color: var(--ink-2); font-weight: 600; }
.stats .ok { color: var(--ok); }
.stats .warn { color: var(--warn); }
.toolbar-right { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar-groups { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-left: auto; }

/* ---------------- 表格 ---------------- */
.grid-wrap {
  max-width: 1680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.grid-card {
  max-width: 1680px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.grid-wrap .grid-card { width: 100%; }

/* 管理员分组版面的卡片头（可点击展开/收起） */
.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  padding: 11px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .12s;
}
.group-head:hover { background: #f3f7fd; }
.group-head:focus-visible { outline: 2px solid rgba(37, 99, 235, .35); outline-offset: -2px; }
.group-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.group-name { display: block; min-width: 0; }
.group-name strong { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.group-name em { display: block; font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.group-mark {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.group-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); }
.group-meta b { color: var(--ink-2); font-weight: 600; }
.group-meta b.ok { color: var(--ok); }
.group-meta b.warn { color: var(--warn); }
.group-meta b.pos { color: var(--pos); }
.group-meta .chev { color: var(--brand); font-size: 11.5px; }
.grid-card.collapsed .grid-scroll { display: none; }

.grid-scroll { overflow: auto; max-height: calc(100vh - 250px); }
.grid-wrap.grouped .grid-scroll { max-height: 54vh; }

.grid-foot-card { margin-top: 14px; }
.foot-right { display: inline-flex; align-items: center; gap: 14px; }
.ver { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ver b { color: var(--ink-2); font-weight: 600; }

table.grid-table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 720px; }

.grid-table thead th {
  position: sticky; top: 0; z-index: 5;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  text-align: center;
  padding: 11px 10px;
  white-space: nowrap;
  height: 42px;
}
.grid-table thead th:first-child { left: 0; z-index: 7; text-align: left; padding-left: 16px; }
.grid-table thead th.sum-col { background: #f1f5fb; color: #334155; }
.grid-table thead th.confirm-col { position: sticky; right: 0; z-index: 7; background: #f8fafc; border-left: 1px solid var(--line); }

.grid-table tbody td {
  border-bottom: 1px solid var(--line-2);
  padding: 0 10px;
  height: 46px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.grid-table tbody tr:last-child td { border-bottom: 0; }
.grid-table tbody tr:hover td { background: #fbfdff; }
.grid-table tbody tr:hover td.sticky-col, .grid-table tbody tr:hover td.confirm-cell { background: #fbfdff; }

td.sticky-col {
  position: sticky; left: 0; z-index: 3;
  background: #fff;
  text-align: left !important;
  padding-left: 16px !important;
  border-right: 1px solid var(--line-2);
  min-width: 132px;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
}
td.sticky-col .uname { font-weight: 500; color: var(--ink); display: block; overflow: hidden; text-overflow: ellipsis; }
td.sticky-col .ulogin { font-size: 11px; color: var(--ink-3); }

.grid-table tbody td.num, tr.cum-row td.num { color: var(--neg); text-align: center; }
td.num.pos { color: var(--pos); }
td.sum-col { background: #fafbfe; font-weight: 600; }
td.total-col { background: #f5f8fd; font-weight: 700; border-left: 1px solid var(--line-2); }
td.carry-col { color: var(--ink-2); }

td.num input {
  width: 100%;
  min-width: 58px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  text-align: center;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: inherit;
  padding: 0 6px;
  outline: none;
  font-family: inherit;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
td.num input:hover { background: #f4f7fc; border-color: #e2e8f2; }
td.num input:focus {
  background: #fff;
  border-color: #93b4fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .13);
  color: var(--ink);
}
td.num input.neg { color: var(--neg); }
td.num input.pos { color: var(--pos); }

td.confirm-cell {
  position: sticky; right: 0; z-index: 3;
  background: #fff;
  border-left: 1px solid var(--line);
  text-align: center !important;
}
.tag-ok { color: var(--ok); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.tag-wait { color: var(--ink-3); font-size: 12px; }
.tag-ok::before { content: "✓"; font-size: 12px; }
.tag-wait::before { content: "○"; font-size: 12px; }

.grid-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 9px 16px;
  border-top: 1px solid var(--line);
  background: #fcfdff;
  font-size: 11.5px; color: var(--ink-3);
}
.legend { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-left: 8px; }
.dot.pos { background: var(--pos); }
.dot.neg { background: var(--neg); }
.save-state { color: var(--ok); transition: opacity .2s; }

.hint {
  max-width: 1680px; margin: 12px auto 0; padding: 0 18px;
  font-size: 12px; color: var(--ink-3); line-height: 1.7;
}

/* ---------------- 模态框 ---------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, .38);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 30px 70px -30px rgba(15, 23, 42, .55);
  animation: pop .18s cubic-bezier(.2,.9,.3,1);
  overflow: hidden;
}
.modal.wide { max-width: 780px; }
@keyframes pop { from { transform: translateY(10px) scale(.985); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 15.5px; }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot {
  padding: 12px 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 8px; background: #fcfdff;
}
.close-x { border: 0; background: transparent; font-size: 20px; color: var(--ink-3); cursor: pointer; line-height: 1; padding: 2px 4px; }
.close-x:hover { color: var(--ink); }

.tabs { display: flex; gap: 4px; padding: 4px; background: #f1f5f9; border-radius: 9px; margin-bottom: 16px; }
.tabs button {
  flex: 1; height: 30px; border: 0; background: transparent; border-radius: 7px;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer; font-family: inherit;
}
.tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15,23,42,.1); font-weight: 600; }

.form-row { display: flex; gap: 10px; }
.form-row > .field { flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .full { grid-column: 1 / -1; }

table.mini { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.mini th {
  text-align: left; font-weight: 600; color: var(--ink-3);
  padding: 7px 8px; border-bottom: 1px solid var(--line); font-size: 11.5px;
  background: #fbfcfe; position: sticky; top: 0;
}
table.mini th .th-filter { margin-top: 5px; font-weight: 400; }
table.mini th .th-filter .txt { height: 27px; padding: 0 8px; font-size: 12px; width: 122px; border-radius: 7px; }
table.mini th .th-filter .select { height: 27px; padding: 0 6px; font-size: 12px; width: 138px; border-radius: 7px; }
table.mini th .th-filter input::placeholder { color: #b6c0ce; }
table.mini td { padding: 7px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.mini tr:hover td { background: #fbfdff; }
table.mini .ops { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.list-wrap { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.role-pill { font-size: 11px; padding: 1px 7px; border-radius: 20px; background: #f1f5f9; color: var(--ink-2); white-space: nowrap; }
.role-pill.super { background: #fef3c7; color: #92400e; }
.role-pill.admin { background: var(--brand-soft); color: var(--brand); }
.role-pill.admin2 { background: #ecfdf5; color: #047857; }
.role-pill.admin3 { background: #f5f3ff; color: #6d28d9; }
.role-pill.off { background: #f3f4f6; color: #9ca3af; text-decoration: line-through; }

.section-title {
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  margin: 18px 0 8px; display: flex; align-items: center; gap: 8px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.note { font-size: 12px; color: var(--ink-3); line-height: 1.65; margin: 8px 0 0; }
.kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line-2); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv b { font-variant-numeric: tabular-nums; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
  background: rgba(15, 23, 42, .93); color: #fff;
  padding: 10px 18px; border-radius: 9px; font-size: 13px;
  z-index: 200; box-shadow: 0 12px 30px -12px rgba(0,0,0,.5);
  animation: toastIn .2s ease;
  max-width: 88vw; text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast.err { background: #b91c1c; }

/* ---------------- 站内消息 ---------------- */
/* 外观与工具栏其他按钮（项目管理/用户管理）一致，仅保留角标定位 */
.msg-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.msg-badge {
  position: absolute; top: -7px; right: -9px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 20px; background: #dc2626; color: #fff;
  font-size: 10.5px; font-weight: 600; line-height: 17px; text-align: center;
  box-shadow: 0 2px 6px rgba(220, 38, 38, .4);
}

.msg-layout { display: flex; gap: 0; height: 420px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.msg-peers {
  flex: 0 0 168px; overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
  display: flex; flex-direction: column;
}
.msg-peer {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  width: 100%; border: 0; background: transparent;
  padding: 11px 12px; cursor: pointer; text-align: left;
  border-bottom: 1px solid var(--line-2);
  font-family: inherit; font-size: 13px; color: var(--ink);
}
.msg-peer:hover { background: #f4f7fd; }
.msg-peer.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.msg-peer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-unread {
  flex: 0 0 auto;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 20px; background: #dc2626; color: #fff;
  font-size: 10.5px; font-weight: 600; line-height: 18px; text-align: center;
}
.msg-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.msg-thread { flex: 1; overflow-y: auto; padding: 14px 16px; background: #fff; }
.msg-item { display: flex; flex-direction: column; margin-bottom: 12px; }
.msg-item.mine { align-items: flex-end; }
.msg-item.theirs { align-items: flex-start; }
.msg-bubble {
  max-width: 78%;
  padding: 8px 12px; border-radius: 12px;
  font-size: 13px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}
.msg-item.mine .msg-bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg-item.theirs .msg-bubble { background: #f1f5f9; color: var(--ink); border-bottom-left-radius: 4px; }
.msg-time { font-size: 10.5px; color: var(--ink-3); margin-top: 4px; }
.msg-compose {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 10px 12px; border-top: 1px solid var(--line); background: #fcfdff;
}
.msg-compose textarea { flex: 1; resize: none; min-height: 44px; max-height: 110px; }
.msg-toolbar {
  display: flex; justify-content: flex-end;
  padding: 6px 10px; border-bottom: 1px solid var(--line); background: #fcfdff;
}

/* ---------------- 累计行 ---------------- */
.grid-table tr.cum-row td {
  background: #fdf9ef;
  border-top: 1px solid #f0e6cf;
  border-bottom: 0;
  height: 40px;
  font-size: 12.5px;
  font-weight: 600;
  color: #92700c;
  font-variant-numeric: tabular-nums;
}
.grid-table tr.cum-row td.sticky-col { background: #fdf9ef; border-right-color: #f0e6cf; }
.grid-table tr.cum-row td.confirm-cell { background: #fdf9ef; }
.grid-table tr.cum-row:hover td { background: #fdf6e3; }
.grid-table tr.cum-row:hover td.sticky-col, .grid-table tr.cum-row:hover td.confirm-cell { background: #fdf6e3; }
.cum-label { color: #92700c; font-weight: 700; font-size: 12px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 760px) {
  .topbar { padding: 0 12px; height: 54px; }
  .brand-text strong { font-size: 13.5px; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .brand-text .badge { display: none; }
  .select { min-width: 0; max-width: 138px; font-size: 11.5px; }
  .user-chip em { display: none; }
  .toolbar { padding: 14px 12px 10px; }
  .toolbar-right { width: 100%; }
  .toolbar-right .btn { flex: 1; padding: 0 8px; font-size: 12.5px; }
  .grid-scroll { max-height: calc(100vh - 260px); }
  table.grid-table { min-width: 660px; }
  .modal { max-width: none; border-radius: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .hint { padding: 0 12px; }
  .msg-layout { height: 62vh; }
  .msg-peers { flex-basis: 116px; }
  .msg-peer { padding: 10px 8px; font-size: 12px; }
}

/* ---------------- 数据备份弹窗 ---------------- */
.bk-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.bk-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: #fbfcfe; min-width: 0;
}
.bk-card em { display: block; font-style: normal; font-size: 11.5px; color: var(--ink-3); margin-bottom: 4px; }
.bk-card b { display: block; font-size: 14.5px; color: var(--ink); font-weight: 600; margin-bottom: 3px; }
.bk-card b.ok { color: var(--ok); }
.bk-card b.warn { color: var(--warn); }
.bk-card span { display: block; font-size: 11px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bk-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.bk-mirror { border: 1px dashed #cdd9ea; border-radius: 10px; padding: 11px 12px; background: #fafcff; margin-bottom: 14px; }
.bk-label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 7px; }
.bk-row { display: flex; gap: 8px; align-items: center; }
.bk-row-sub { margin-top: 8px; }
.bk-row-sub input { height: 32px; font-size: 12px; }
.bk-row input {
  flex: 1; min-width: 0; height: 34px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; font-size: 12.5px; color: var(--ink);
  font-family: ui-monospace, Consolas, monospace;
}
.bk-row input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.bk-mirror .note { margin: 8px 0 0; font-size: 11.5px; color: var(--ink-3); }

.bk-listwrap { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table.bk-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.bk-table th {
  text-align: left; font-weight: 600; color: var(--ink-3); font-size: 11.5px;
  padding: 8px 10px; border-bottom: 1px solid var(--line); background: #fbfcfe;
  position: sticky; top: 0; z-index: 1;
}
table.bk-table td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); color: var(--ink-2); }
table.bk-table tr:last-child td { border-bottom: none; }
table.bk-table td.num { text-align: right; }
table.bk-table th.num { text-align: right; }
table.bk-table .bk-ops { text-align: right; white-space: nowrap; }
table.bk-table .bk-ops .btn { margin-left: 6px; }
.bk-tag {
  display: inline-block; padding: 1px 7px; border-radius: 20px;
  font-size: 11px; line-height: 17px; background: var(--brand-soft); color: var(--brand);
}
.bk-tag.manual { background: #fff5e8; color: var(--warn); }
.bk-tag.legacy { background: #f1f5f9; color: var(--ink-3); }
.bk-empty { text-align: center; color: var(--ink-3); padding: 22px 0 !important; }
.bk-err { color: var(--pos); font-size: 13px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 11.5px; border-radius: 6px; }
.bk-body > .note { margin: 10px 0 0; font-size: 11px; color: var(--ink-3); word-break: break-all; }

@media (max-width: 760px) {
  .bk-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bk-row { flex-direction: column; align-items: stretch; }
}

/* ---------------- 看板：账号列 / 固定列 / 列宽（v20261106-22） ---------------- */

/* 每列给足宽度，数字和名称都能完整显示 */
.grid-table thead th { min-width: 100px; }
.grid-table thead th.proj-col,
.grid-table thead th.sum-col { min-width: 108px; }
.grid-table thead th.confirm-col { min-width: 96px; }
.grid-table tbody td { min-width: 100px; }
.grid-table tbody td.num { min-width: 108px; }
td.num input { min-width: 86px; }

/* 账号列（管理员视角，放在「用户」列前面，横向滚动时一起固定） */
.grid-table thead th.acct-col {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 9;
  width: 96px;
  min-width: 96px;
  max-width: 96px;
  text-align: left;
  padding-left: 16px;
  background: #f8fafc;
  border-right: 1px solid var(--line-2);
}
.grid-table tbody td.acct-col {
  position: sticky;
  left: 0;
  z-index: 4;
  width: 96px;
  min-width: 96px;
  max-width: 96px;
  background: #fff;
  text-align: left !important;
  padding-left: 16px !important;
  border-right: 1px solid var(--line-2);
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: .2px;
}

/* 用户列：有账号列时右移 96px */
.grid-table thead th.sticky-col {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 8;
  text-align: left;
  padding-left: 16px;
  background: #f8fafc;
  border-right: 1px solid var(--line-2);
}
.grid-table.has-acct thead th.sticky-col,
.grid-table.has-acct tbody td.sticky-col { left: 96px; }

/* 累计行 / 悬停时固定列背景跟随 */
.grid-table tr.cum-row td.acct-col { background: #fdf9ef; border-right-color: #f0e6cf; }
.grid-table tbody tr:hover td.acct-col { background: #fbfdff; }
.grid-table tr.cum-row:hover td.acct-col { background: #fdf6e3; }

/* 用户列保持足够宽度（姓名完整显示） */
.grid-table thead th.sticky-col,
.grid-table tbody td.sticky-col { min-width: 140px; max-width: 220px; }
