/* =================================================================
 * FX Sales — 设计系统
 * 8px 间距栅格 · 统一控件高度 · 支持简繁英越四语与深浅色
 * ================================================================= */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text", "PingFang SC", "PingFang TC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;

  /* 间距栅格 */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

  /* 控件高度 */
  --h-sm: 30px;
  --h-md: 36px;
  --h-lg: 44px;

  --bg: #f4f5f9;
  --bg-soft: #ebedf4;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --surface-hover: #f4f5fa;
  --border: #e6e8f0;
  --border-strong: #d5d9e5;

  --text: #161925;
  --text-2: #474d61;
  --muted: #7f8699;
  --faint: #a6acbd;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef0fe;
  --primary-ring: rgba(79, 70, 229, .16);

  --success: #059669;
  --success-soft: #e6f6f0;
  --warn: #c2700a;
  --warn-soft: #fdf3e4;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --info: #0369a1;
  --info-soft: #e7f3fb;

  --sidebar-bg: #141827;
  --sidebar-bg-2: #1a1f31;
  --sidebar-text: #a5adc2;
  --sidebar-text-hover: #dfe3ee;
  --sidebar-text-active: #ffffff;
  --sidebar-border: #262b3d;
  --sidebar-hover: rgba(255, 255, 255, .055);
  --sidebar-active: rgba(99, 102, 241, .18);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(16, 20, 35, .05);
  --shadow-sm: 0 1px 3px rgba(16, 20, 35, .07), 0 1px 2px rgba(16, 20, 35, .04);
  --shadow: 0 4px 14px rgba(16, 20, 35, .08), 0 1px 3px rgba(16, 20, 35, .04);
  --shadow-lg: 0 18px 48px rgba(16, 20, 35, .16), 0 4px 12px rgba(16, 20, 35, .08);

  --sidebar-w: 236px;
  --topbar-h: 60px;
  --page-x: 24px;
}

html[data-theme="dark"] {
  --bg: #0c0e15;
  --bg-soft: #12151e;
  --surface: #161923;
  --surface-2: #1b1f2b;
  --surface-hover: #212533;
  --border: #262a38;
  --border-strong: #343a4b;

  --text: #e9ebf2;
  --text-2: #b8bece;
  --muted: #848b9f;
  --faint: #676e82;

  --primary: #7f7bf1;
  --primary-hover: #948ff6;
  --primary-soft: #22213e;
  --primary-ring: rgba(127, 123, 241, .25);

  --success: #34d399;
  --success-soft: #10281f;
  --warn: #fbbf24;
  --warn-soft: #2c2110;
  --danger: #f87171;
  --danger-soft: #2d1618;
  --info: #38bdf8;
  --info-soft: #0c2233;

  --sidebar-bg: #090b11;
  --sidebar-bg-2: #10131b;
  --sidebar-border: #1d212e;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .5);
  --shadow: 0 4px 16px rgba(0, 0, 0, .45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.011em; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
button { font: inherit; color: inherit; }
hr { border: none; border-top: 1px solid var(--border); margin: var(--sp-4) 0; }
::selection { background: var(--primary-ring); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* ============================== 布局 ============================== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 40;
}
.sidebar-brand {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--sp-5); border-bottom: 1px solid var(--sidebar-border);
}
.brand-logo { width: 30px; height: 30px; flex: 0 0 30px; display: flex; }
.brand-logo img {
  width: 100%; height: 100%; object-fit: contain; border-radius: 7px;
  background: rgba(255, 255, 255, .94); padding: 2px;
}
.brand-mark {
  width: 100%; height: 100%; min-width: 30px; border-radius: 9px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; letter-spacing: .02em;
  box-shadow: 0 3px 10px rgba(99, 102, 241, .4);
}
.brand-mark.lg { width: 56px; height: 56px; min-width: 56px; border-radius: 14px; font-size: 18px; }

/* 设定页的 Logo 编辑器 */
.logo-editor { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.logo-preview {
  width: 56px; height: 56px; flex: 0 0 56px; border-radius: 14px; overflow: hidden;
  display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border);
}
.logo-preview img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.logo-editor .hint { margin-top: 6px; max-width: 380px; }
.brand-text {
  color: #fff; font-weight: 600; font-size: 14.5px; letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: var(--sp-3) var(--sp-3) var(--sp-5); }
.nav::-webkit-scrollbar-thumb { background: #2b3145; background-clip: content-box; }
.nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: #5b6380; padding: var(--sp-4) var(--sp-3) var(--sp-2);
}
.nav-label:first-child { padding-top: var(--sp-2); }

.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: var(--h-md); padding: 0 11px; margin-bottom: 2px;
  border: none; background: transparent; border-radius: 9px; text-align: left;
  color: var(--sidebar-text); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: background .15s, color .15s; position: relative;
}
.nav-item:hover { background: var(--sidebar-hover); color: var(--sidebar-text-hover); }
.nav-item.active { background: var(--sidebar-active); color: var(--sidebar-text-active); font-weight: 600; }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: #818cf8;
}
.nav-item .ico { width: 17px; height: 17px; flex: 0 0 17px; opacity: .92; }
.nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-dot {
  flex: 0 0 auto; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700;
  padding: 1px 6px; border-radius: 20px; line-height: 1.5; font-variant-numeric: tabular-nums;
}

.sidebar-foot { padding: var(--sp-3); border-top: 1px solid var(--sidebar-border); }
.sidebar-user {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: var(--sp-2); border: none; background: transparent; border-radius: 9px;
  cursor: pointer; transition: background .15s; color: #6f7794; text-align: left;
}
.sidebar-user:hover { background: var(--sidebar-hover); }
.sidebar-user .avatar { flex: 0 0 30px; width: 30px; height: 30px; }
.su-text { flex: 1; min-width: 0; }
.u-name { color: #e6e9f1; font-size: 13px; font-weight: 600; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-role { color: #6f7794; font-size: 11.5px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--page-x);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 16.5px; font-weight: 650; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title .sub { color: var(--muted); font-size: 12px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-spacer { flex: 1; }
.clock-chip {
  font-family: var(--font-mono); font-size: 12.5px; color: var(--muted);
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
  padding: 4px 9px; background: var(--bg-soft); border-radius: 7px;
}
/* 团队时区与系统时区不一致时，在时钟后缀上标出来（如 UTC+7）。
   不标的话海外同事会以为系统时间错了——他们看到的是本地时间，
   而客户创建时间、审计日志这些仍是系统时区。 */
.clock-chip.has-tz::after {
  content: attr(data-tz);
  margin-left: 6px; padding-left: 6px;
  border-left: 1px solid var(--line);
  font-size: 10.5px; opacity: .75;
}
@media (max-width: 620px) { .clock-chip { display: none; } }

.page { padding: var(--sp-5) var(--page-x) var(--sp-10); max-width: 1560px; width: 100%; }

/* 页头：标题左、动作右，底部对齐 */
.page-head {
  display: flex; align-items: flex-end; gap: var(--sp-4);
  margin-bottom: var(--sp-4); flex-wrap: wrap; min-height: var(--h-md);
}
.page-head .grow { flex: 1 1 260px; min-width: 0; }

/* ============================== 卡片 ============================== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 54px; padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.card-head > .ico { color: var(--muted); flex: 0 0 auto; }
.card-head h3 { font-size: 14.5px; font-weight: 650; line-height: 1.35; }
.card-head .desc { color: var(--muted); font-size: 12.5px; line-height: 1.45; margin-top: 1px; }
.card-head .head-text { flex: 1; min-width: 0; }
.card-head .spacer { flex: 1; }
.card-body { padding: var(--sp-5); }
.card-body.tight { padding: 0; }
.card-body.list { padding: 2px var(--sp-5); }
.card-foot {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border);
  background: var(--surface-2); min-height: 54px;
}

.grid { display: grid; gap: var(--sp-4); }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.aside { grid-template-columns: minmax(0, 1fr) 336px; align-items: start; }
@media (max-width: 1280px) { .grid.aside { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1100px) { .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .grid.c2, .grid.c3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .grid.c4 { grid-template-columns: minmax(0, 1fr); } }

/* ============================== 统计卡 ============================== */
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-5) var(--sp-4) calc(var(--sp-5) - 3px);
  box-shadow: var(--shadow-xs); position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; min-height: 104px;
}
.stat .accent { position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--primary); }
.stat .label {
  color: var(--muted); font-size: 12.5px; font-weight: 500; line-height: 1.4;
  display: block; overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.stat .value {
  font-size: 26px; font-weight: 650; letter-spacing: -.028em; line-height: 1.15;
  margin-top: var(--sp-2); font-variant-numeric: tabular-nums;
}
.stat .foot {
  color: var(--faint); font-size: 11.5px; line-height: 1.45; margin-top: var(--sp-1);
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.stat.ok .accent { background: var(--success); } .stat.ok .value { color: var(--success); }
.stat.warn .accent { background: var(--warn); } .stat.warn .value { color: var(--warn); }
.stat.danger .accent { background: var(--danger); } .stat.danger .value { color: var(--danger); }
.stat.info .accent { background: var(--info); } .stat.info .value { color: var(--info); }

.mini-stat { padding: 10px 12px; background: var(--surface-2); border-radius: 9px; border: 1px solid var(--border); }
.mini-stat .l { color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.mini-stat .v { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.3; }

/* ============================== 按钮 ============================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--h-md); padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 13.5px; font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background .14s, border-color .14s, box-shadow .14s, transform .06s;
  box-shadow: var(--shadow-xs);
}
.btn .ico { flex: 0 0 auto; margin-left: -2px; }
.btn:hover { background: var(--surface-hover); border-color: var(--muted); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }

.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 3px var(--primary-ring); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(1.08); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.success:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-hover); border-color: transparent; }
.btn.sm { height: var(--h-sm); padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 6px; font-weight: 500; }
.btn.lg { height: var(--h-lg); padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.icon { width: var(--h-md); padding: 0; }
.btn.icon .ico { margin-left: 0; }
.btn-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.btn-row.tight { gap: 5px; }

.icon-btn {
  width: var(--h-md); height: var(--h-md); flex: 0 0 var(--h-md);
  display: grid; place-items: center; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  cursor: pointer; transition: background .14s, color .14s;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.lang-flag { font-size: 16px; line-height: 1; }

/* ============================== 表单 ============================== */
.field { margin-bottom: var(--sp-4); min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field > label, .form-label {
  display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2);
  margin-bottom: 5px; line-height: 1.4;
}
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.55; }
.req::after { content: ' *'; color: var(--danger); }

.input, .select, .textarea {
  width: 100%; height: var(--h-md); padding: 0 11px;
  font: inherit; font-size: 13.5px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .14s, box-shadow .14s; outline: none;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--bg-soft); color: var(--muted); cursor: not-allowed; }
.textarea { height: auto; min-height: 80px; padding: 9px 11px; resize: vertical; line-height: 1.6; }
input[type="color"].input { padding: 3px; cursor: pointer; }
input[type="date"].input, input[type="time"].input, input[type="datetime-local"].input { padding-right: 8px; }

.select {
  appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237f8699' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 11px;
}
.input.sm, .select.sm { height: var(--h-sm); font-size: 12.5px; padding: 0 9px; }
.select.sm { padding-right: 26px; background-position: right 8px center; }
.input.auto, .select.auto { width: auto; min-width: 130px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--sp-4); }
.form-grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-all { grid-column: 1 / -1; }
@media (max-width: 820px) { .form-grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .form-grid, .form-grid.c3 { grid-template-columns: minmax(0, 1fr); } }

.form-section {
  grid-column: 1 / -1; display: flex; align-items: center; gap: var(--sp-3);
  margin: var(--sp-2) 0 var(--sp-4); color: var(--muted);
  font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
}
.form-section::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.form-section:first-child { margin-top: 0; }

/* ------------------------------------------------------------------ *
 * 分区表单：字段多的表单（登记客户）按主题切成小块，宽屏两块并排 —— 每块
 * 内部还是两列，合起来一行四列。行距也收紧一点，目标是一屏看完不用滚。
 * ------------------------------------------------------------------ */
.form-blocks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4) var(--sp-6); }
.form-blocks > .form-block { min-width: 0; }
.form-blocks > .span-all { grid-column: 1 / -1; }
.form-blocks .form-section { margin: 0 0 var(--sp-2); }
.form-blocks .field { margin-bottom: var(--sp-3); }
.form-blocks .field > label { font-size: 12px; margin-bottom: 4px; }
.form-blocks .field .hint { margin-top: 3px; }
.form-blocks .textarea { min-height: 68px; }
@media (max-width: 900px) { .form-blocks { grid-template-columns: minmax(0, 1fr); } }

.switch, .field > label.switch {
  position: relative; display: inline-flex; align-items: center; gap: 9px;
  cursor: pointer; user-select: none; font-size: 13px; font-weight: 500; margin-bottom: 0;
  min-height: var(--h-md); color: var(--text-2);
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  display: block; width: 38px; height: 21px; border-radius: 20px; background: var(--border-strong);
  transition: background .18s; flex: 0 0 38px; position: relative;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .18s;
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--primary-ring); }
.switch .txt { line-height: 1.4; }

/* 朴素勾选框（含下级、随人迁移这类开关性选项）。
   必须带上 .field > label.check，否则 .field > label 的块级样式会把它拉成整行。 */
.check, .field > label.check {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none;
  font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 0; white-space: nowrap;
}
.check input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; margin: 0; }
.check[hidden] { display: none; }

.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.check-pill {
  display: inline-flex; align-items: center; gap: 6px; height: var(--h-sm); padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 20px; cursor: pointer;
  font-size: 12.5px; color: var(--text-2); background: var(--surface);
  transition: background .14s, border-color .14s, color .14s; user-select: none; white-space: nowrap;
}
.check-pill:hover { border-color: var(--muted); }
.check-pill input { display: none; }
.check-pill.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }

/* ============================== 表格 ============================== */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.tbl th {
  text-align: left; font-weight: 600; font-size: 11.5px; color: var(--muted);
  padding: 9px var(--sp-4); border-bottom: 1px solid var(--border); white-space: nowrap;
  background: var(--surface-2); position: sticky; top: 0; z-index: 1;
  letter-spacing: .01em;
}
/* 可排序表头：默认只留一个淡箭头，悬停才提亮；当前排序列高亮 */
table.tbl th.sortable { cursor: pointer; user-select: none; }
table.tbl th.sortable > span { display: inline-flex; align-items: center; gap: 4px; }
table.tbl th.sortable .ico { opacity: 0; transition: opacity .12s; flex: none; }
table.tbl th.sortable:hover { color: var(--text-2); }
table.tbl th.sortable:hover .ico { opacity: .45; }
table.tbl th.sortable.on { color: var(--primary); }
table.tbl th.sortable.on .ico { opacity: 1; }
/* 窄的数字列不需要 16px 的左右留白 */
table.tbl th.tight-col, table.tbl td.tight-col { padding-left: var(--sp-2); padding-right: var(--sp-2); }
table.tbl th:first-child, table.tbl td:first-child { padding-left: var(--sp-5); }
table.tbl th:last-child, table.tbl td:last-child { padding-right: var(--sp-5); }
table.tbl td { padding: 10px var(--sp-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr { transition: background .12s; }
table.tbl tbody tr:hover { background: var(--surface-hover); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.mid, table.tbl th.mid { text-align: center; }
/* 资料完整度 —— 列表里只有一个带色数字，详情/弹窗里才展开成进度条 */
.qnum {
  display: inline-block; min-width: 30px; text-align: center; padding: 2px 5px;
  border-radius: 6px; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.qnum.good { color: var(--success); background: var(--success-soft); }
.qnum.fair { color: var(--warn);    background: var(--warn-soft); }
.qnum.poor { color: var(--danger);  background: var(--danger-soft); }

.qscore { display: flex; align-items: center; gap: 7px; max-width: 160px; }
.qscore .qs-num { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 20px; }
.qscore .qs-bar { flex: 1; height: 4px; border-radius: 2px; background: var(--bg-soft); overflow: hidden; }
.qscore .qs-bar i { display: block; height: 100%; border-radius: 2px; transition: width .2s; }
.qscore.good .qs-num { color: var(--success); }
.qscore.good .qs-bar i { background: var(--success); }
.qscore.fair .qs-num { color: var(--warn); }
.qscore.fair .qs-bar i { background: var(--warn); }
.qscore.poor .qs-num { color: var(--danger); }
.qscore.poor .qs-bar i { background: var(--danger); }

.qmeter { min-width: 210px; max-width: 300px; }
.qmeter .qm-top { display: flex; align-items: baseline; gap: 5px; }
.qmeter .qm-label { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-right: auto; }
.qmeter .qm-num { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.qmeter .qm-max { font-size: 11px; color: var(--faint); }
.qmeter .qm-bar { height: 5px; border-radius: 3px; background: var(--bg-soft); overflow: hidden; margin-top: 4px; }
.qmeter .qm-bar i { display: block; height: 100%; border-radius: 3px; transition: width .22s; }
.qmeter .qm-hint { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
/* 客户详情弹窗：左资料右动态；窄屏收成单列，右栏（OA/跟进）排到下面 */
.detail-grid { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: var(--sp-5); }
@media (max-width: 900px) { .detail-grid { grid-template-columns: minmax(0, 1fr); } }

/* 列多的表格给最小宽度：窄屏横向滚动，而不是把列压扁成竖排字 */
.table-wrap .tbl.minw { min-width: 640px; }

/* 详情页「平台账户（OA）」卡片：右栏顶部，statistic 条 + 全宽流水表 */
.oa-card { background: var(--surface-2); }
.oa-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.oa-head .spacer { flex: 1; }
.oa-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-3); margin-top: var(--sp-3);
}
.oa-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px; min-width: 0;
}
.oa-stat .lbl { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.oa-stat .val { font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.oa-stat .val.good { color: var(--success); font-weight: 700; }
@media (max-width: 900px) { .oa-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.oa-stats.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.oa-stats.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 640px) { .oa-stats.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 日报概览矩阵：一人一行，一格一天 */
.dr-row { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; padding: 2px 0; }
.dr-dot {
  display: inline-block; width: 13px; height: 13px; border-radius: 4px;
  background: var(--bg-soft); vertical-align: -1px; flex: none;
}
.dr-dot.done { background: var(--success); }
.dr-dot.makeup { background: var(--warn); }
.dr-dot.miss { background: var(--danger); opacity: .82; }
.dr-dot.pend { background: transparent; border: 1.5px dashed var(--muted); }
.dr-dot.off { background: var(--bg-soft); }
.dr-dot.com { box-shadow: 0 0 0 2px var(--primary-ring); }
.dr-dot.done:hover, .dr-dot.makeup:hover { transform: scale(1.25); }

/* 公告广播：铃铛角标 / 通知箱下拉 / 历史行 / 名单 */
.ann-badge {
  position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 8px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 15px; text-align: center;
}
.ann-panel {
  width: min(400px, calc(100vw - 16px));
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  z-index: 120; overflow: hidden; animation: slideUp .14s ease;
  display: flex; flex-direction: column; max-height: min(560px, 76vh);
}
.ann-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: 12px 16px; border-bottom: 1px solid var(--border); flex: none;
}
.ann-panel-title {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 650; white-space: nowrap;
}
.ann-panel-list { overflow-y: auto; }
.ann-panel-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 36px 16px; color: var(--faint); font-size: 12.5px;
}
.ann-item {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left;
  padding: 11px 16px; border: none; background: transparent; cursor: pointer;
  border-bottom: 1px solid var(--border); font: inherit; color: var(--text);
  transition: background .12s;
}
.ann-item:hover { background: var(--surface-hover); }
.ann-item:last-child { border-bottom: none; }
.ann-item.on { background: var(--primary-soft); }
.ann-item.on:hover { background: var(--surface-hover); }
.ann-item.on .ann-item-title { font-weight: 650; }
.ann-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex: none; }
.ann-dot.off { background: transparent; }
.ann-item-main { min-width: 0; display: block; flex: 1; }
.ann-item-row { display: flex; align-items: baseline; gap: var(--sp-3); }
.ann-item-title {
  flex: 1; min-width: 0; font-size: 13px; line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ann-item-time { flex: none; font-size: 11px; color: var(--faint); }
.ann-item-ex {
  display: block; font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ann-item-sub { display: block; font-size: 11px; color: var(--faint); margin-top: 3px; }
.ann-pop-title { font-size: 15px; font-weight: 650; line-height: 1.45; }
.ann-hist {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 16px; border: none; border-bottom: 1px solid var(--border);
  background: transparent; cursor: pointer; font: inherit; color: var(--text);
}
.ann-hist:hover { background: var(--surface-hover); }
.ann-hist:last-child { border-bottom: none; }
.ann-person {
  display: flex; gap: 8px; align-items: baseline; padding: 5px 0;
  border-bottom: 1px dashed var(--border); font-size: 13px;
}
.ann-person:last-child { border-bottom: none; }
.ann-person > span:first-child { min-width: 64px; }
.ann-img { max-width: 100%; max-height: 320px; border-radius: 9px; display: block; margin-top: 10px; border: 1px solid var(--border); }
.ann-file {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 6px 10px; margin: 4px 6px 0 0; border: 1px solid var(--border-strong); border-radius: 8px;
  font-size: 12.5px; color: var(--text); text-decoration: none; background: var(--surface);
}
.ann-file:hover { border-color: var(--primary); color: var(--primary); }
.ann-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; margin: 0 6px 6px 0;
  border: 1px solid var(--border); border-radius: 7px; font-size: 12px; background: var(--surface-2);
}
.ann-chip button {
  border: none; background: transparent; cursor: pointer; color: var(--muted);
  font-size: 14px; line-height: 1; padding: 0 2px;
}
.ann-chip button:hover { color: var(--danger); }

/* 团队树：单列 + 按层级缩进。两栏卡片排不出父子关系，多层级下必须单列。
   层级由行内 --d 传进来，缩进量在这里算，窄屏才好整体收窄（行内 margin 覆盖不掉）。 */
.team-tree { display: flex; flex-direction: column; gap: var(--sp-4, 12px); }
.team-node { position: relative; margin-left: calc(var(--d, 0) * 28px); }
.team-branch {
  position: absolute; left: -18px; top: 0; bottom: 50%; width: 12px;
  border-left: 2px solid var(--border); border-bottom: 2px solid var(--border);
  border-bottom-left-radius: 8px; pointer-events: none;
}
/* 5 层 × 28px 在手机上会把卡片挤没，收到 10px 只保留层级暗示 */
@media (max-width: 720px) {
  .team-node { margin-left: calc(var(--d, 0) * 10px); }
  .team-branch { left: -8px; width: 5px; }
}

/* 我的日报：表单双栏 + 记录卡片 */
.daily-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: var(--sp-6); }
@media (max-width: 900px) { .daily-form-grid { grid-template-columns: minmax(0, 1fr); } }
.daily-card { cursor: pointer; transition: border-color .14s, box-shadow .14s; }
.daily-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm, 0 2px 8px rgba(0,0,0,.08)); }
.daily-clamp, .daily-clamp2 {
  display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 13px; line-height: 1.65; white-space: pre-wrap;
}
.daily-clamp { -webkit-line-clamp: 3; }
.daily-clamp2 { -webkit-line-clamp: 2; }
.dr-comment {
  background: var(--primary-soft); border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 8px 11px; font-size: 12.5px; line-height: 1.6;
}
.dr-comment > b { color: var(--primary); font-size: 12px; }

/* 日报正文展示块 + 团队日报统计条里的红色数字 */
.daily-text {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 13px; line-height: 1.7; white-space: pre-wrap;
}
.oa-stat .val.bad { color: var(--danger); font-weight: 700; }

.qmeter.good .qm-num { color: var(--success); } .qmeter.good .qm-bar i { background: var(--success); }
.qmeter.fair .qm-num { color: var(--warn); }    .qmeter.fair .qm-bar i { background: var(--warn); }
.qmeter.poor .qm-num { color: var(--danger); }  .qmeter.poor .qm-bar i { background: var(--danger); }
@media (max-width: 620px) { .qmeter { display: none; } }

table.tbl .cell-main { font-weight: 600; color: var(--text); line-height: 1.4; }
table.tbl .cell-sub { color: var(--muted); font-size: 11.5px; line-height: 1.45; }
table.tbl.compact td { padding: 7px var(--sp-3); }
table.tbl.compact th { padding: 7px var(--sp-3); }
table.tbl.compact th:first-child, table.tbl.compact td:first-child { padding-left: var(--sp-5); }
table.tbl input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; vertical-align: middle; }
.row-click { cursor: pointer; }
.cell-actions { display: flex; gap: 5px; justify-content: flex-end; align-items: center; }

.pager {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border); flex-wrap: wrap;
}
.pager .info { color: var(--muted); font-size: 12.5px; }

/* ============================== 徽章 ============================== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600;
  line-height: 1.65; background: var(--bg-soft); color: var(--text-2); white-space: nowrap;
}
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }
.badge.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 6px; }
.badge.block { display: block; white-space: normal; text-align: left; line-height: 1.55; }

.tag {
  display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 5px;
  font-size: 11.5px; font-weight: 600; border: 1px solid; white-space: nowrap; line-height: 1.7;
}

.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px;
  display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 600;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); letter-spacing: .01em;
}
.avatar.sm { width: 28px; height: 28px; flex-basis: 28px; font-size: 11px; }
.avatar.lg { width: 52px; height: 52px; flex-basis: 52px; font-size: 19px; }
.user-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.user-cell > div { min-width: 0; }

/* ============================== 打卡 ============================== */
.punch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-3); }
.punch-card {
  border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-4);
  background: var(--surface-2); text-align: center; position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 2px;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.punch-card .p-name { font-size: 13.5px; font-weight: 650; line-height: 1.4; }
.punch-card .p-kind { color: var(--faint); font-size: 11px; font-weight: 500; }
.punch-card .p-window {
  color: var(--muted); font-size: 11px; margin-top: 2px;
  font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.punch-card .p-time {
  font-size: 25px; font-weight: 650; letter-spacing: -.03em;
  margin: 9px 0 3px; font-variant-numeric: tabular-nums; line-height: 1.1;
}
.punch-card .p-state { min-height: 22px; margin-bottom: 10px; display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.punch-card .btn { width: 100%; margin-top: auto; }
.punch-card.done { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 32%, transparent); }
.punch-card.done .p-time { color: var(--success); }
.punch-card.late, .punch-card.early_leave { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 38%, transparent); }
.punch-card.late .p-time, .punch-card.early_leave .p-time { color: var(--warn); }
.punch-card.missing { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 32%, transparent); }
.punch-card.missing .p-time { color: var(--danger); }
.punch-card.ready { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); background: var(--surface); }
.punch-card.upcoming { opacity: .6; }
.punch-card .ip-flag { position: absolute; top: 8px; right: 8px; }

/* 打卡矩阵 */
.m-chip {
  display: inline-block; min-width: 50px; padding: 2px 7px; border-radius: 6px;
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.6;
}
.m-chip.normal { background: var(--success-soft); color: var(--success); }
.m-chip.late, .m-chip.early_leave { background: var(--warn-soft); color: var(--warn); }
.m-chip.missing { background: var(--danger-soft); color: var(--danger); }
.m-chip.pending { background: var(--bg-soft); color: var(--muted); }
.m-chip.upcoming, .m-chip.closed { background: transparent; color: var(--faint); }

/* ============================== 时间轴 ============================== */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 7px; bottom: 7px; width: 2px; background: var(--border); border-radius: 2px; }
.tl-item { position: relative; padding-bottom: var(--sp-4); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ''; position: absolute; left: -21px; top: 5px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--primary);
}
.tl-item.muted::before { border-color: var(--border-strong); }
.tl-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.tl-title { font-weight: 600; font-size: 13px; }
.tl-time { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; margin-left: auto; white-space: nowrap; }
.tl-body { color: var(--text-2); font-size: 12.5px; margin-top: 3px; white-space: pre-wrap; word-break: break-word; line-height: 1.6; }

/* ============================== 弹窗 ============================== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(12, 15, 24, .5);
  backdrop-filter: blur(3px); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding: min(5vh, 34px) var(--sp-4) var(--sp-4); overflow-y: auto;
  animation: fadeIn .16s ease;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 540px;
  animation: slideUp .2s cubic-bezier(.2, .8, .3, 1);
  /* 弹窗整体不超过一屏，内容区自己滚 —— 矮屏幕上也不会把按钮顶出视野 */
  display: flex; flex-direction: column; max-height: calc(100vh - min(5vh, 34px) - var(--sp-4));
}
.modal.wide { max-width: 900px; }
.modal.xwide { max-width: 1140px; }
.modal.narrow { max-width: 420px; }
.modal-head {
  display: flex; align-items: center; gap: var(--sp-3); flex: 0 0 auto;
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border);
}
.modal-head .mh-text { flex: 1; min-width: 0; }
.modal-head h3 { font-size: 15.5px; font-weight: 650; line-height: 1.35; }
.modal-head .desc { color: var(--muted); font-size: 12.5px; margin-top: 2px; line-height: 1.45; }
.modal-body { padding: var(--sp-5); overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-foot {
  display: flex; gap: var(--sp-2); justify-content: flex-end; align-items: center; flex: 0 0 auto;
  padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border); background: var(--surface-2);
}
.modal-foot .spacer { flex: 1; }
.confirm-text { font-size: 13.5px; line-height: 1.7; color: var(--text-2); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(14px) scale(.985); } }

/* 在岗提醒弹窗 */
.idle-modal { text-align: center; padding: var(--sp-2) 0; }
.idle-modal h3 { font-size: 17.5px; line-height: 1.45; }
.idle-modal p { color: var(--muted); font-size: 13px; margin: var(--sp-3) 0 var(--sp-5); line-height: 1.75; }
.idle-modal p b { color: var(--warn); }
.idle-ring { width: 108px; height: 108px; margin: 0 auto var(--sp-4); position: relative; }
.idle-ring svg { transform: rotate(-90deg); }
.idle-ring .num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 30px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--warn);
}

/* ============================== 提示条 ============================== */
.toasts {
  position: fixed; top: var(--sp-4); right: var(--sp-4); z-index: 200;
  display: flex; flex-direction: column; gap: 9px; max-width: 380px;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: var(--sp-3) var(--sp-4);
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: 13.5px; cursor: pointer;
  animation: toastIn .22s cubic-bezier(.2, .8, .3, 1);
}
.toast .t-body { flex: 1; min-width: 0; }
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast .t-title { font-weight: 600; line-height: 1.45; }
.toast .t-msg { color: var(--text-2); font-size: 12.5px; margin-top: 2px; word-break: break-word; line-height: 1.55; }
.toast.out { animation: toastOut .18s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); } }

.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px var(--sp-4); border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.65;
  background: var(--info-soft); color: var(--info); border: 1px solid color-mix(in srgb, var(--info) 22%, transparent);
}
.alert .ico { flex: 0 0 auto; margin-top: 2px; }
.alert > div { min-width: 0; }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 26%, transparent); }
.alert.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 26%, transparent); }
.alert.ok { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 26%, transparent); }
.alert b { font-weight: 700; }

/* ============================== 其它 ============================== */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 9px 15px; font-size: 13.5px; font-weight: 550; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap; transition: color .14s; user-select: none;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* 「直属 / 全线」这类范围切换。刻意不做成下划线 tab：它切的是数据范围不是页面，
   跟同屏的主 tabs 长得一样会让人以为点了会换页。 */
.tabs.sm {
  border-bottom: none; background: var(--bg-soft); border-radius: 9px;
  padding: 3px; gap: 2px; flex: 0 0 auto; align-self: center;
}
.tabs.sm .tab {
  display: inline-flex; align-items: center; height: calc(var(--h-sm) - 6px);
  padding: 0 12px; font-size: 12.5px; border-bottom: none; margin-bottom: 0; border-radius: 6px;
}
.tabs.sm .tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

.seg { display: inline-flex; background: var(--bg-soft); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button {
  height: calc(var(--h-sm) - 6px); padding: 0 12px; border: none; background: transparent; border-radius: 6px;
  font-size: 12.5px; font-weight: 550; color: var(--muted); cursor: pointer; transition: all .14s; white-space: nowrap;
}
.seg button:hover { color: var(--text-2); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

.empty { text-align: center; padding: var(--sp-10) var(--sp-5); color: var(--muted); }
.empty .ico { font-size: 32px; opacity: .35; margin-bottom: var(--sp-2); line-height: 1; }
.empty .title { font-weight: 600; color: var(--text-2); font-size: 14px; }
.empty .desc { font-size: 12.5px; margin-top: var(--sp-1); }

.progress { height: 6px; background: var(--bg-soft); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 4px; transition: width .4s ease; }
.progress.ok > i { background: var(--success); }
.progress.warn > i { background: var(--warn); }
.progress.danger > i { background: var(--danger); }
.rate-cell { display: flex; align-items: center; gap: var(--sp-2); }
.rate-cell .progress { flex: 1; min-width: 48px; }
.rate-cell .rate-num { font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 40px; text-align: right; }

.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 128px; }
.bar-chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; min-width: 0; height: 100%; }
.bar-chart .bar .fill {
  width: 100%; max-width: 44px;
  background: linear-gradient(180deg, var(--primary), color-mix(in srgb, var(--primary) 55%, transparent));
  border-radius: 5px 5px 2px 2px; min-height: 3px; transition: height .4s ease;
}
.bar-chart .bar .lbl { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.bar-chart .bar .val { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; min-height: 15px; }

.funnel-row { display: flex; align-items: center; gap: var(--sp-3); padding: 5px 0; }
.funnel-row .name {
  flex: 0 0 92px; width: 92px; font-size: 12.5px; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.funnel-row .track { flex: 1; height: 22px; background: var(--bg-soft); border-radius: 5px; overflow: hidden; min-width: 0; }
.funnel-row .track > i { display: block; height: 100%; border-radius: 5px; min-width: 2px; transition: width .4s ease; }
.funnel-row .cnt { flex: 0 0 44px; text-align: right; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.funnel-row .cnt.sub { color: var(--muted); font-weight: 500; }

.kv { display: grid; grid-template-columns: minmax(88px, auto) minmax(0, 1fr); gap: 9px var(--sp-4); font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.kv dd { margin: 0; color: var(--text); word-break: break-word; line-height: 1.5; }

.mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.flex { display: flex; align-items: center; gap: var(--sp-2); }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.flex-col { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.spacer, .grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mt-4 { margin-top: var(--sp-1); }  .mt-8 { margin-top: var(--sp-2); }
.mt-12 { margin-top: var(--sp-3); } .mt-16 { margin-top: var(--sp-4); }
.mt-20 { margin-top: var(--sp-5); } .mt-24 { margin-top: var(--sp-6); }
.mb-4 { margin-bottom: var(--sp-1); }  .mb-8 { margin-bottom: var(--sp-2); }
.mb-12 { margin-bottom: var(--sp-3); } .mb-16 { margin-bottom: var(--sp-4); }
.mb-20 { margin-bottom: var(--sp-5); } .mb-24 { margin-bottom: var(--sp-6); }

/* 工具栏 / 筛选条 */
.toolbar {
  display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center;
  margin-bottom: var(--sp-4); min-height: var(--h-md);
}
.toolbar .input, .toolbar .select { width: auto; min-width: 132px; }
.search-box { position: relative; }
.search-box .input { padding-left: 33px; min-width: 232px; }
.search-box .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.range-sep { color: var(--faint); padding: 0 2px; }

.skeleton {
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--surface-hover) 37%, var(--bg-soft) 63%);
  background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.dropdown-menu {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 5px; z-index: 120;
  animation: slideUp .14s ease;
}
.dropdown-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  min-height: 34px; padding: 0 10px; border: none; background: transparent; border-radius: 6px;
  font-size: 13px; color: var(--text-2); cursor: pointer;
}
.dropdown-menu button:hover { background: var(--surface-hover); color: var(--text); }
.dropdown-menu button.danger { color: var(--danger); }
.dropdown-menu button.on { color: var(--primary); font-weight: 600; }
.dropdown-menu button .lang-check { margin-left: auto; display: flex; }
.dropdown-menu hr { margin: 5px 0; }

.list-row { display: flex; align-items: center; gap: var(--sp-3); padding: 11px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.list-row .grow { min-width: 0; }
.list-row .t { font-weight: 600; font-size: 13px; line-height: 1.45; }
.list-row .s { color: var(--muted); font-size: 11.5px; margin-top: 1px; line-height: 1.45; }

/* 可编辑列表（打卡时段 / 阶段 / 渠道） */
.editor-head, .editor-row { display: grid; gap: var(--sp-2); align-items: center; }
.editor-head {
  font-size: 11.5px; color: var(--muted); font-weight: 600; padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border); letter-spacing: .01em;
}
.editor-row { padding: 9px 0; border-bottom: 1px dashed var(--border); }
.editor-row:last-of-type { border-bottom: none; }
.editor-row .idx { color: var(--faint); font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.editor-row .switch { justify-content: center; min-height: var(--h-sm); }
.editor-scroll { overflow-x: auto; }
.editor-scroll > div { min-width: 720px; }

/* ============================ 快速检索 ============================ */
.ico.flip { transform: scaleX(-1); }

.kb-searchbar {
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 14px; padding: 0 var(--sp-4); height: 56px;
  box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s;
}
.kb-searchbar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.kb-searchbar > .ico { color: var(--muted); flex: 0 0 auto; }
.kb-searchbar input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font: inherit; font-size: 17px; color: var(--text); height: 100%;
}
.kb-searchbar input::placeholder { color: var(--faint); font-size: 15.5px; }
.kb-clear { flex: 0 0 auto; }

.kb-subbar { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-3); flex-wrap: wrap; }

.kb-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-cat {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 13px;
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 20px;
  font-size: 12.5px; color: var(--text-2); cursor: pointer; transition: all .14s; white-space: nowrap;
}
.kb-cat:hover { border-color: var(--muted); }
.kb-cat.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.kb-cat .n { color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.kb-cat.on .n { color: var(--primary); opacity: .7; }

.kb-count {
  font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .04em;
  text-transform: uppercase; margin-bottom: var(--sp-3);
}

.kb-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-3); box-shadow: var(--shadow-xs);
}
.kb-card-head { display: flex; align-items: flex-start; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.kb-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 650; line-height: 1.5; }
.kb-actions { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }
.kb-actions .btn.ok { background: var(--success); border-color: var(--success); color: #fff; }

.kb-fallback {
  font-size: 11.5px; color: var(--warn); background: var(--warn-soft);
  border-radius: 6px; padding: 3px 9px; display: inline-block; margin-bottom: var(--sp-2);
}

.kb-body { font-size: 13.5px; line-height: 1.75; color: var(--text-2); word-break: break-word; }
.kb-body p { margin: 0 0 6px; }
.kb-body p:last-child { margin-bottom: 0; }
.kb-body ul, .kb-body ol { margin: 4px 0 8px; padding-left: 20px; }
.kb-body li { margin-bottom: 3px; }
.kb-body a { word-break: break-all; }
.kb-body b { color: var(--text); }
.kb-body .kb-gap { height: 6px; }
.kb-body mark { background: color-mix(in srgb, var(--warn) 32%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

.kb-table-wrap { overflow-x: auto; margin: 8px 0; }
table.kb-table { border-collapse: collapse; font-size: 12.5px; min-width: 100%; }
table.kb-table th, table.kb-table td {
  border: 1px solid var(--border); padding: 6px 11px; text-align: left; white-space: nowrap;
}
table.kb-table th { background: var(--surface-2); font-weight: 600; color: var(--text); }

.kb-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: var(--sp-3); }
.kb-sec { font-size: 11px; font-weight: 700; color: var(--faint); letter-spacing: .05em; text-transform: uppercase; margin-right: 2px; }
.kb-link {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 4px 10px; border-radius: 7px; background: var(--bg-soft);
  font-size: 12.5px; color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kb-link:hover { background: var(--primary-soft); }

.kb-foot {
  display: flex; align-items: center; gap: var(--sp-2);
  margin-top: var(--sp-3); padding-top: var(--sp-2); border-top: 1px dashed var(--border);
  font-size: 11.5px; color: var(--faint);
}
.kb-foot .btn { margin-left: auto; }

@media (max-width: 900px) {
  :root { --page-x: 16px; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .22s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .modal-backdrop { padding: var(--sp-4) var(--sp-3); }
  .toolbar .input, .toolbar .select, .search-box .input { min-width: 0; flex: 1 1 140px; }
  .search-box { flex: 1 1 100%; }
}
/* 手机端侧栏遮罩：点空白处关菜单 */
.nav-backdrop {
  position: fixed; inset: 0; z-index: 39;
  background: rgba(10, 12, 20, .45); animation: fadeIn .18s ease;
}
@media (min-width: 901px) { .nav-backdrop { display: none; } }
.menu-toggle { display: none; }
@media (max-width: 900px) { .menu-toggle { display: grid; } }

/* ── 打卡方案选择器 ─────────────────────────────────────────
   多套作息/时差时用来切换方案。选中态用主色边框，
   窄屏自动换行，不做横向滚动（数量通常个位数）。 */
.sch-list { display: flex; flex-wrap: wrap; gap: 8px; }
.sch-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); cursor: pointer; text-align: left;
  font: inherit; color: inherit; transition: border-color .15s, background .15s;
}
.sch-chip:hover { border-color: var(--primary); }
.sch-chip.on { border-color: var(--primary); background: var(--primary-soft); }
.sch-chip b { font-weight: 600; }
@media (max-width: 620px) {
  .sch-chip { width: 100%; }
}
