/**
 * 丂渐活动管家 · 产品 UI
 *
 * 语言：冷静专业的中文 B2B 作业台（非营销落地页）
 * 字体：HarmonyOS Sans SC
 * 色系：冷灰底 + 青绿主色（避免 AI 紫、米奶油陶土默认盘）
 * 圆角：统一 8px；按钮/输入同系
 */

/* 自托管 woff2（同域走 EdgeOne），勿再用全量 ttf（约 8MB×3）或国外 jsDelivr */
@font-face {
  font-family: "HarmonyOS Sans SC";
  src: url("../fonts/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Regular.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "HarmonyOS Sans SC";
  src: url("../fonts/HarmonyOS_Sans_SC/HarmonyOS_Sans_SC_Bold.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;

  /* 作业台：浅灰内容区 + 宝塔系深绿强调 */
  --bg: #f0f2f5;
  --bg-soft: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f5f6f8;
  --line: #e4e7ed;
  --line-strong: #d0d5dd;
  --text: #1f2329;
  --text-2: #4e5969;
  --muted: #86909c;
  --placeholder: #a0a7b0;

  --accent: #20a53a;
  --accent-hover: #198c31;
  --accent-soft: #e8f8ec;
  --accent-ink: #0f6b24;

  --ok: #20a53a;
  --ok-soft: #e8f8ec;
  --ok-line: #a8e0b4;
  --warn: #e6a23c;
  --warn-soft: #fff7e8;
  --warn-line: #f3d19e;
  --danger: #f56c6c;
  --danger-soft: #fef0f0;
  --danger-line: #fbc4c4;

  --radius: 4px;
  --radius-sm: 3px;
  --radius-lg: 6px;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 2px 8px rgb(0 0 0 / .04);
  --shadow-lg: 0 8px 24px rgb(0 0 0 / .1);
  --focus: 0 0 0 2px rgb(32 165 58 / .22);

  --sidebar-w: 200px;
  --sidebar-w-folded: 64px;
  --sidebar-bg: #2c3136;
  --sidebar-bg-2: #25292e;
  --sidebar-text: #c0c4cc;
  --sidebar-text-strong: #ffffff;
  --sidebar-hover: rgb(255 255 255 / .06);
  --sidebar-line: rgb(255 255 255 / .08);
  --topbar-h: 50px;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* 斜向水印：铺满视口，不挡点击；文案在服务端写死，刷新才变 */
.kj-watermark {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background-repeat: repeat;
  background-size: 560px 400px;
  opacity: 1;
}
@media print {
  .kj-watermark {
    position: fixed;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
code, .kj-build {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
}

/* ---- 布局（宝塔式：深色侧栏 + 浅内容区） ---- */
.layout { display: flex; min-height: 100dvh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  flex-shrink: 0;
  z-index: 40;
  transition: width .2s var(--ease);
  scrollbar-width: thin;
  scrollbar-color: rgb(255 255 255 / .15) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgb(255 255 255 / .15); border-radius: 4px; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }

/* ---- 侧栏 ---- */
.brand {
  padding: 14px 14px 12px;
  background: var(--sidebar-bg-2);
  border-bottom: 1px solid var(--sidebar-line);
  flex-shrink: 0;
}
.brand .name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--sidebar-text-strong);
  white-space: nowrap;
  overflow: hidden;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.brand-text { overflow: hidden; text-overflow: ellipsis; }
.brand .co { font-size: 12px; color: rgb(255 255 255 / .45); margin-top: 8px; }
.brand .co b { color: #7dcea0; font-weight: 500; }
.brand .co-link { display: block; transition: opacity .15s var(--ease); }
.brand .co-link:hover { opacity: .85; }
.brand .co-role {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 2px;
  background: rgb(255 255 255 / .08);
  color: rgb(255 255 255 / .65);
  font-size: 11px;
  border: 0;
}

.nav { padding: 8px 0 12px; flex: 1; }
.nav-section { margin-bottom: 2px; }
.nav-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 11px;
  color: rgb(255 255 255 / .38);
  padding: 10px 16px 6px;
  letter-spacing: .04em;
  font-weight: 500;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: color .15s var(--ease);
}
.nav-group:hover { color: rgb(255 255 255 / .6); }
.nav-chevron {
  width: 14px;
  height: 14px;
  opacity: .7;
  margin-right: 2px;
  flex-shrink: 0;
}
.nav-section.is-open .nav-chevron { opacity: .95; }
.nav-items {
  display: none;
  padding: 0;
}
.nav-section.is-open .nav-items { display: block; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px 9px 16px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  margin: 0;
  border-radius: 0;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-strong);
}
.nav-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 500;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #9ce6ab;
}
.nav-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: .85;
  line-height: 0;
}
.nav-item.active .nav-icon { opacity: 1; }

/* morphicons 宿主：单 path，currentColor 随侧栏/顶栏继承 */
.kj-morph-icon {
  display: block;
  width: 18px;
  height: 18px;
  overflow: visible;
  flex-shrink: 0;
}
.nav-icon .kj-morph-icon {
  width: 18px;
  height: 18px;
}
.topbar-menu .kj-morph-icon {
  width: 18px;
  height: 18px;
}
.sidebar-fold .kj-morph-icon {
  width: 16px;
  height: 16px;
}
.ai-buddy-fab .kj-morph-icon,
.ai-buddy-fab .ai-buddy-face {
  width: 22px;
  height: 22px;
}
.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-badge {
  margin-left: auto;
  background: rgb(245 108 108 / .25);
  color: #f89898;
  font-size: 11px;
  padding: 0 6px;
  border-radius: 999px;
  font-weight: 600;
}
.nav-badge.gray { background: rgb(255 255 255 / .1); color: rgb(255 255 255 / .55); }

.side-foot {
  padding: 8px 8px 10px;
  border-top: 1px solid var(--sidebar-line);
  background: var(--sidebar-bg-2);
  flex-shrink: 0;
}
.side-foot .nav-item {
  border-radius: var(--radius);
  margin-bottom: 2px;
  padding-left: 12px;
}
.side-foot .nav-item.active::before { display: none; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  margin: 6px 0 8px;
  background: rgb(255 255 255 / .05);
  border: 1px solid var(--sidebar-line);
}
.user-chip .avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.user-chip .u { flex: 1; min-width: 0; }
.user-chip .n {
  font-size: 13px;
  font-weight: 500;
  color: var(--sidebar-text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chip .r { font-size: 11px; color: rgb(255 255 255 / .4); }

/* 个人信息 · 注册编号 */
.profile-id-card {
  background: linear-gradient(165deg, #f3faf5 0%, var(--surface) 55%);
  border-color: rgb(32 165 58 / .22);
}
.profile-id-label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 6px;
}
.profile-id-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.profile-id-hash {
  color: var(--accent);
  margin-right: 2px;
}
.profile-id-hint {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
}

.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--sidebar-line);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--sidebar-text);
  background: transparent;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.logout-btn:hover {
  background: rgb(245 108 108 / .15);
  color: #f89898;
  border-color: rgb(245 108 108 / .35);
}

.sidebar-fold {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius);
  background: rgb(255 255 255 / .04);
  color: rgb(255 255 255 / .45);
  cursor: pointer;
  font-size: 12.5px;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.sidebar-fold:hover {
  background: rgb(255 255 255 / .08);
  color: var(--sidebar-text-strong);
}

/* 折叠侧栏：仅图标（宝塔同款） */
html.sidebar-folded .sidebar { width: var(--sidebar-w-folded); }
html.sidebar-folded .brand { padding: 12px 0; text-align: center; }
html.sidebar-folded .brand .name { justify-content: center; }
html.sidebar-folded .brand-text,
html.sidebar-folded .brand .co,
html.sidebar-folded .nav-group,
html.sidebar-folded .nav-label,
html.sidebar-folded .user-chip .u {
  display: none;
}
html.sidebar-folded .nav-section.is-open .nav-items,
html.sidebar-folded .nav-items { display: block !important; }
html.sidebar-folded .nav-item {
  justify-content: center;
  padding: 11px 0;
}
html.sidebar-folded .nav-item.active::before { width: 2px; }
html.sidebar-folded .side-foot { padding: 8px 6px; }
html.sidebar-folded .user-chip { justify-content: center; padding: 8px; }
html.sidebar-folded .logout-btn { padding: 8px; }
html.sidebar-folded .sidebar-fold .nav-label { display: none; }

/* ---- 顶栏 ---- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 2px rgb(0 0 0 / .03);
}
.topbar-menu {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  width: 34px;
  height: 34px;
  padding: 0;
  cursor: pointer;
  color: var(--text-2);
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topbar-menu:hover { color: var(--text); border-color: var(--line-strong); }
.topbar-menu:focus-visible { outline: none; box-shadow: var(--focus); }
.topbar h1 { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: .01em; color: var(--text); }
.crumb { font-size: 12px; color: var(--muted); }
.crumb a:hover { color: var(--accent); }
.spacer { flex: 1; }

/* ---- 内容 ---- */
.content { padding: 16px 18px 48px; flex: 1; }

.flash {
  padding: 11px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13.5px;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.flash-ok { background: var(--ok-soft); border-color: var(--ok-line); color: #034c2e; }
.flash-err { background: var(--danger-soft); border-color: var(--danger-line); color: #7a1a14; }
.flash-warn { background: var(--warn-soft); border-color: var(--warn-line); color: #6b4700; }

/* ---- 卡片 ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: none;
}
.card-title {
  font-size: 14.5px;
  font-weight: 600;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.card-title .desc { font-size: 12.5px; color: var(--muted); font-weight: 400; }

/* ---- 表格 ---- */
/* 固定布局 + 短列给够 rem：主列吃剩余，避免「中间大空、右侧挤成竖排字」 */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
.card > table { max-width: 100%; }
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13.5px;
}
th {
  background: var(--surface-2);
  text-align: left;
  padding: 11px 14px;
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
  font-size: 12.5px;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid #eef2f5;
  vertical-align: middle;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 主列（标题/项目名）：占剩余宽度，可两行 */
th.col-main, td.col-main {
  width: auto;
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
}
td.col-main > a {
  color: inherit;
  text-decoration: none;
}
td.col-main > a:hover { color: var(--accent-ink, var(--accent)); text-decoration: underline; }
/* 短列：固定够用的宽度，禁止竖排断字 */
th.col-date, td.col-date {
  width: 7.25rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
th.col-datetime, td.col-datetime {
  width: 9rem;
  white-space: nowrap;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
th.col-status, td.col-status {
  width: 6.75rem; /* 「公司承担」「计划中」一行放下 */
  white-space: nowrap;
}
th.col-num, td.col-num {
  width: 6.25rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
th.col-user, td.col-user {
  width: 7.5rem;
  white-space: nowrap;
}
th.col-customer, td.col-customer {
  width: 13rem;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
  overflow: hidden;
}
td.col-customer .cell-clamp,
td.col-note .cell-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
th.col-meta, td.col-meta {
  width: 6.5rem;
  white-space: nowrap;
}
th.col-note, td.col-note {
  width: 12rem;
  white-space: normal;
  word-break: break-word;
}
th.col-actions, td.col-actions {
  width: 9.5rem;
  text-align: right;
  white-space: nowrap;
  overflow: visible;
}
th.col-actions-wide, td.col-actions-wide {
  width: 14.5rem;
  min-width: 14.5rem;
}
td.col-actions .cell-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}
td.col-actions-wide .cell-actions {
  flex-wrap: wrap;
}
tbody tr { transition: background .12s var(--ease); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fbfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* 项目列表：列更多，加最小宽横滚 */
table.jobs-table { min-width: 980px; font-size: 13px; }
table.jobs-table th,
table.jobs-table td { padding: 10px 12px; }
table.jobs-table th.col-main,
table.jobs-table td.col-main { width: 22%; white-space: nowrap; }
table.jobs-table td.col-main > a {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
table.jobs-table th.col-datetime,
table.jobs-table td.col-datetime { width: 8.6rem; }
table.jobs-table th.col-status,
table.jobs-table td.col-status { width: 5.5rem; }
table.jobs-table th.col-num,
table.jobs-table td.col-num { width: 4.5rem; }
table.jobs-table th.col-customer,
table.jobs-table td.col-customer { width: 14%; }
table.jobs-table th.col-meta,
table.jobs-table td.col-meta { width: 7rem; }
table.jobs-table th.col-actions,
table.jobs-table td.col-actions { width: 5.5rem; }
.empty {
  padding: 42px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

/* ---- 标签 ---- */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.tag-err { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.tag-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.tag-info { background: var(--accent-soft); color: var(--accent-ink); border-color: #b6dde5; }
.tag-gray { background: var(--surface-2); color: var(--text-2); border-color: var(--line); }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  min-height: 32px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
  transition:
    background .15s var(--ease),
    border-color .15s var(--ease),
    color .15s var(--ease),
    transform .1s var(--ease),
    box-shadow .15s var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 0 rgb(255 255 255 / .12) inset;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.btn-soft {
  background: var(--accent-soft);
  border-color: #b6dde5;
  color: var(--accent-ink);
}
.btn-soft:hover { background: #d2ebf0; }

.btn-danger {
  color: var(--danger);
  border-color: var(--danger-line);
  background: var(--surface);
}
.btn-danger:hover { background: var(--danger-soft); }

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-sm { padding: 4px 10px; min-height: 28px; font-size: 12.5px; }
.btn-lg { padding: 10px 16px; min-height: 38px; font-size: 14px; }
.btn-block { width: 100%; }

/* 筛选条内按钮与表单控件视觉齐高 */
.card form .btn,
.form-bar .btn,
.filter-bar .btn {
  min-height: 32px;
}

.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* 表格操作列：按钮横排，列宽够放「详情 + 编辑」 */
.cell-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}
.cell-actions form {
  display: inline-flex;
  margin: 0;
  gap: 6px;
  align-items: center;
}
.cell-actions .btn { margin: 0; }
td.col-actions {
  width: 10rem;
  text-align: right;
  white-space: nowrap;
  overflow: visible;
}
th.col-actions { width: 10rem; text-align: right; }

/* 成员管理表：联系方式两行展示，操作列加宽横排 */
table.members-table { min-width: 1080px; }
table.members-table th.col-id,
table.members-table td.col-id {
  width: 5.5rem;
  white-space: nowrap;
}
table.members-table th.col-contact,
table.members-table td.col-contact {
  width: 12rem;
  min-width: 11rem;
  max-width: 16rem;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  vertical-align: middle;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.35;
}
table.members-table .contact-line {
  word-break: break-all;
}
table.members-table .contact-email {
  margin-top: 2px;
  color: var(--muted);
}
table.members-table th.col-role,
table.members-table td.col-role {
  width: 6rem;
  white-space: nowrap;
}
table.members-table th.col-actions-wide,
table.members-table td.col-actions-wide {
  width: 15rem;
  min-width: 14rem;
  max-width: none;
  text-align: right;
  white-space: nowrap;
  overflow: visible;
  vertical-align: middle;
}
.member-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.member-role-form,
.member-status-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.member-role-select {
  max-width: 7.5rem;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 400;
}

/* ---- 操作日志（单行白话） ---- */
.logs-intro {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.logs-filter {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.logs-feed {
  list-style: none;
  margin: 0;
  padding: 0;
}
.logs-item {
  display: grid;
  grid-template-columns: 6.75rem minmax(0, 1fr);
  gap: 6px 14px;
  align-items: baseline;
  padding: 8px 2px;
  border-bottom: 1px solid #eef2f5;
}
.logs-item:last-child { border-bottom: none; }
.logs-when {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.logs-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  min-width: 0;
}
.logs-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  align-items: baseline;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--text);
  flex: 1 1 18rem;
  min-width: 0;
}
.logs-who { font-weight: 600; color: var(--text); flex-shrink: 0; }
.logs-what { color: var(--text); }
.logs-side {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  flex: 0 1 auto;
}
.logs-menu {
  color: var(--text-2);
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logs-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid #b6dde5;
  font-weight: 500;
}
.logs-ip { font-variant-numeric: tabular-nums; opacity: 0.85; }
.logs-raw-toggle {
  min-height: 22px !important;
  padding: 1px 7px !important;
  font-size: 12px !important;
}
.logs-raw {
  grid-column: 1 / -1;
  margin: 0 0 4px;
  padding: 8px 10px;
  background: #f4f6f8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 180px;
  overflow: auto;
}
@media (max-width: 720px) {
  .logs-item {
    grid-template-columns: 1fr;
    gap: 2px 0;
    padding: 10px 2px;
  }
  .logs-side { margin-left: 0; }
  .logs-menu { max-width: 100%; white-space: normal; }
}

/* 横排表单条（邀请码等）：标签/输入/提示垂直对齐 */
.form-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: flex-start;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.form-bar .field {
  margin: 0;
  min-width: 0;
}
.form-bar .field label {
  display: block;
  margin-bottom: 6px;
  min-height: 1.2em;
}
.form-bar .field .hint {
  min-height: 1.2em;
}
.form-bar .form-bar-action {
  margin-top: 24px; /* 与有 label 的输入底边对齐 */
  flex: 0 0 auto;
}

/* 行内可点编辑：始终一行；只读无框，点了才出现编辑边框 */
.cell-note {
  min-width: 7rem;
  max-width: 14rem;
}
.cell-note-form {
  margin: 0;
  display: block;
}
.cell-note-field {
  display: block;
  width: 100%;
  margin: 0;
  padding: 4px 2px;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: text;
  transition: border-color .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
}
.cell-note-field.is-empty:read-only {
  color: var(--muted);
  font-size: 12.5px;
}
.cell-note-field:read-only:hover {
  border-bottom-color: var(--line-strong);
  color: var(--accent-ink);
}
.cell-note-field:not(:read-only),
.cell-note-field.is-editing {
  padding: 4px 8px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--focus);
}
.cell-note-field:not(:read-only):focus,
.cell-note-field.is-editing:focus {
  outline: none;
}

/* 凭证缩略图 */
.voucher-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.voucher-thumb {
  display: block;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  cursor: zoom-in;
}
.voucher-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.voucher-thumbs-lg .voucher-thumb {
  width: 72px;
  height: 72px;
}
.voucher-file {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}
.voucher-file:hover { border-color: var(--accent); color: var(--accent-ink); }

/* 拖拽 / 粘贴上传区 */
.dropzone {
  position: relative;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-soft);
  padding: 18px 14px;
  text-align: center;
  transition: border-color .15s var(--ease), background .15s var(--ease);
  outline: none;
}
.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: var(--focus);
}
.dropzone-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.dropzone.has-file .dropzone-input { pointer-events: none; }
.dropzone-title { font-size: 13.5px; font-weight: 500; color: var(--text); }
.dropzone-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.dropzone-idle[hidden],
.dropzone-preview[hidden],
.dropzone-preview img[hidden],
.dropzone-filemeta[hidden] {
  display: none !important;
}
.dropzone-preview:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}
.dropzone-preview img:not([hidden]) {
  display: block;
  max-width: 100%;
  max-height: 160px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  cursor: zoom-in;
  background: var(--surface);
}
.dropzone-filemeta:not([hidden]) {
  display: block;
  font-size: 12.5px;
  color: var(--text-2);
  word-break: break-all;
  white-space: pre-line;
  text-align: center;
  max-width: 100%;
}

/* 已有凭证：封面 + 删除 */
.voucher-thumb-wrap {
  position: relative;
  display: inline-block;
}
.voucher-thumb-del {
  position: absolute;
  top: -7px;
  right: -7px;
  z-index: 2;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid #e8a0a0;
  border-radius: 999px;
  background: #fff;
  color: #b42318;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 3px rgb(0 0 0 / .12);
}
.voucher-thumb-del:hover {
  background: #b42318;
  border-color: #b42318;
  color: #fff;
}

/* 大图灯箱 */
.lightbox {
  z-index: 90;
  background: rgb(10 16 22 / .82);
  padding: 24px;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: min(96vw, 1100px);
  max-height: 88dvh;
  margin: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  object-fit: contain;
  background: #111;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 18px;
  border: none;
  background: rgb(255 255 255 / .12);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgb(255 255 255 / .22); }

/* 设置页元信息 */
.settings-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 16px;
  margin: 0 0 16px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
}
.settings-meta-k {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}
.settings-meta .hint {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}
.settings-meta code {
  font-size: 13px;
}

/* 面板式弹窗（新建/编辑报销） */
.panel-modal .modal { width: min(560px, 100%); padding: 0; overflow: hidden; }
.panel-modal .modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.panel-modal .modal-head .modal-title { margin: 0; }
.panel-modal .modal-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.panel-modal .modal-close:hover { background: var(--surface-2); color: var(--text); }
.panel-modal .modal-body { padding: 16px 20px 8px; margin: 0; }
.panel-modal .modal-actions {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
  margin: 0;
}

/* ---- 表单 ---- */
.field { margin-bottom: 15px; }
.field label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text-2);
  font-weight: 500;
}
.field input[type=text],
.field input[type=password],
.field input[type=number],
.field input[type=date],
.field input[type=datetime-local],
.field input[type=email],
.field input[type=tel],
.field input[type=search],
.field input[type=file],
.field select,
.field textarea,
.input,
.select,
.textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field textarea, .textarea { min-height: 96px; resize: vertical; }
.field input::placeholder,
.field textarea::placeholder,
.input::placeholder { color: var(--placeholder); }
.field input:hover,
.field select:hover,
.field textarea:hover,
.input:hover,
.select:hover { border-color: #a8b6c2; }
.field input:focus,
.field select:focus,
.field textarea:focus,
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus);
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.field .err,
.field .e { font-size: 12px; color: var(--danger); margin-top: 5px; }
.field label .req {
  color: var(--danger);
  margin-left: 3px;
  font-weight: 600;
}
.field label .opt-note {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  margin-left: 4px;
}

.field select,
.select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 2px),
    calc(100% - 11px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }

/* ---- 下拉菜单 ---- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 40;
  display: none;
}
.dropdown.open .dropdown-menu,
.dropdown-menu[data-open="1"] { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-sep { height: 1px; background: var(--line); margin: 4px 6px; }

/* ---- 弹窗 ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(15 23 32 / .42);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 80;
  backdrop-filter: blur(2px);
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 20px 22px;
  animation: modalIn .22s var(--ease);
}
.modal-lg { width: min(640px, 100%); }
.modal-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
}
.modal-body {
  color: var(--text-2);
  font-size: 13.5px;
  margin-bottom: 18px;
  line-height: 1.65;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .modal { animation: none; }
  .btn, .nav-item, tbody tr { transition: none; }
}

/* ---- 统计块 ---- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 15px 17px;
  box-shadow: var(--shadow);
}
.stat .l { font-size: 12.5px; color: var(--muted); }
.stat .v {
  font-size: 24px;
  font-weight: 600;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  letter-spacing: -.02em;
}
.stat .d { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---- 工具条 / 筛选条 ---- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.toolbar .spacer { flex: 1; }
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin-bottom: 14px;
}
.filters .field { margin-bottom: 0; min-width: 140px; }

/* ---- 月历 ---- */
.cal {
  --cal-gap: 6px;
  --cal-day-min: 84px;
}
.cal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.cal-head .cal-ym {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .02em;
  min-width: 7em;
  text-align: center;
}
.cal-weekdays,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--cal-gap);
}
.cal-weekdays {
  margin-bottom: 6px;
}
.cal-weekday {
  text-align: center;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  padding: 4px 0;
  letter-spacing: .04em;
}
.cal-weekday.is-weekend { color: #9aa8b5; }
.cal-day {
  min-height: var(--cal-day-min);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 7px 6px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
}
.cal-day.is-pad {
  background: var(--surface-2);
  border-color: transparent;
  min-height: calc(var(--cal-day-min) * .55);
}
.cal-day.is-today {
  border-color: rgb(14 116 144 / .45);
  background: linear-gradient(180deg, var(--accent-soft), #fff 55%);
  box-shadow: inset 0 0 0 1px rgb(14 116 144 / .08);
}
.cal-day.has-jobs:not(.is-pad) {
  border-color: #c9d9e0;
}
.cal-day-num {
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  line-height: 1.2;
}
.cal-day.is-today .cal-day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
}
.cal-day.is-weekend .cal-day-num { color: #7d8c99; }
.cal-day.is-today.is-weekend .cal-day-num { color: #fff; }
.cal-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
}
/* 按干活 ID 固定色相（job-tint-0…7）：表格行与日历条共用 */
.job-tint-0 { --job-bg: #e3f4f7; --job-bd: #6eb8c8; --job-fg: #0a4f5c; }
.job-tint-1 { --job-bg: #fff1e0; --job-bd: #e0a86a; --job-fg: #7a4510; }
.job-tint-2 { --job-bg: #e7f5ea; --job-bd: #7fc090; --job-fg: #1b5e20; }
.job-tint-3 { --job-bg: #fdecef; --job-bd: #e39aaa; --job-fg: #8b2e3d; }
.job-tint-4 { --job-bg: #e8eef8; --job-bd: #8fa6d0; --job-fg: #243b6b; }
.job-tint-5 { --job-bg: #f2f0e3; --job-bd: #bdb07a; --job-fg: #5a5126; }
.job-tint-6 { --job-bg: #e8f6f1; --job-bd: #7ec4a8; --job-fg: #1a5c40; }
.job-tint-7 { --job-bg: #f4ebe7; --job-bd: #c9a08c; --job-fg: #6b3a28; }

tr.job-row {
  background: var(--job-bg, transparent);
}
tr.job-row > td:first-child {
  box-shadow: inset 3px 0 0 var(--job-bd, transparent);
}
tr.job-row:hover {
  filter: brightness(.985);
}

.cal-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 11px;
  line-height: 1.25;
  padding: 3px 4px 3px 3px;
  border-radius: 5px;
  text-decoration: none;
  border: 1px solid var(--job-bd, transparent);
  background: var(--job-bg, var(--surface-2));
  color: var(--job-fg, var(--text));
  min-height: 1.6em;
  transition: filter .12s var(--ease), transform .1s var(--ease);
}
.cal-chip:hover { filter: brightness(.97); }
.cal-chip:active { transform: scale(.98); }

/* 标题：占满剩余宽度，超出格子省略，不撑破格子 */
.cal-chip-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.cal-chip-pay,
.cal-chip-day {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 650;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 3px;
  white-space: nowrap;
}
.cal-chip-day {
  background: rgb(0 0 0 / .06);
  color: inherit;
  opacity: .85;
}

/* 结款只看角标，底色留给干活色相 */
.cal-chip.is-pay-unpaid .cal-chip-pay {
  background: #f5a623;
  color: #fff;
}
.cal-chip.is-pay-paid .cal-chip-pay {
  background: #2e7d32;
  color: #fff;
}

/* 进度态：进行中左边条；已取消降饱和 */
.cal-chip.is-doing {
  box-shadow: inset 3px 0 0 currentColor;
}
.cal-chip.is-done .cal-chip-title { opacity: .85; }
.cal-chip.is-cancelled {
  opacity: .55;
  text-decoration: line-through;
  filter: grayscale(.35);
}
.cal-chip.is-cancelled .cal-chip-title { text-decoration: line-through; }

.cal-more {
  font-size: 10.5px;
  color: var(--muted);
  padding-left: 2px;
}
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid transparent;
}
.cal-dot.is-pay-unpaid { background: #f5a623; border-color: #d4891a; }
.cal-dot.is-pay-paid { background: #2e7d32; border-color: #1b5e20; }

.cal-compact { --cal-day-min: 76px; }
.cal-compact .cal-chip { font-size: 10.5px; padding: 2px 3px; }
.cal-compact .cal-chip-pay,
.cal-compact .cal-chip-day { font-size: 9.5px; padding: 2px 3px; }

@media (max-width: 720px) {
  .cal { --cal-day-min: 68px; --cal-gap: 4px; }
  .cal-chip { font-size: 10px; }
}

/* ---- 登录 / 注册（auth-shell） ---- */
.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
  background:
    radial-gradient(900px 420px at 10% 0%, rgb(14 116 144 / .14), transparent 55%),
    radial-gradient(700px 360px at 90% 20%, rgb(21 32 43 / .06), transparent 50%),
    var(--bg);
}
.auth-wrap {
  width: min(420px, 100%);
}
.auth-wrap-wide {
  width: min(640px, 100%);
}
.auth-brand {
  text-align: center;
  margin-bottom: 20px;
}
.auth-brand-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}
.auth-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
}
.auth-brand-name {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: .02em;
  line-height: 1.2;
}
.auth-brand-sub {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
}
.auth-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 28px 24px;
  box-shadow: var(--shadow-lg);
  box-sizing: border-box;
}
.auth-card-wide {
  width: 100%;
}
/* 旧写法兜底：勿再把整段系统名塞进侧栏用的 .brand-mark */
.auth-card > .brand-mark {
  display: none;
}
.auth-card > .brand-sub {
  display: none;
}
.auth-foot {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}
.auth-foot a { color: var(--accent); font-weight: 500; }
.auth-foot a:hover { text-decoration: underline; }
.auth-link { font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.auth-link a { color: var(--accent); }
.auth-cmd {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 14px 0 8px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 2;
  border: 1px solid var(--line);
}
.auth-help-list {
  margin: 0;
  padding-left: 22px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.9;
}
.auth-note {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 14px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.75;
  margin-bottom: 18px;
}
.auth-note b { color: var(--text); font-weight: 500; }
.auth-entry {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  padding: 3px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  border: 1px solid var(--line);
}
.auth-entry-link {
  flex: 1;
  text-align: center;
  padding: 9px 6px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.35;
}
.auth-entry-link.on {
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  box-shadow: 0 1px 3px rgb(21 32 43 / .08);
}
.code-input {
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 2px;
  font-size: 16px !important;
  text-align: center;
}
.captcha-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.captcha-row input {
  flex: 1;
  min-width: 0;
}
.captcha-img-btn {
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  line-height: 0;
  overflow: hidden;
}
.captcha-img-btn img {
  display: block;
  width: 120px;
  height: 40px;
}
.captcha-img-btn:hover { border-color: var(--accent); }

@media (max-width: 560px) {
  .auth-card { padding: 24px 18px 22px; }
  .auth-entry-link { font-size: 12px; padding: 8px 4px; }
  .auth-wrap { width: min(100%, 100%); }
}

@media (max-width: 900px) {
  .topbar-menu { display: inline-flex; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(80vw, 240px);
    transform: translateX(-105%);
    transition: transform .22s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  html.sidebar-open .sidebar { transform: translateX(0); }
  html.sidebar-folded .sidebar { width: min(80vw, 240px); }
  /* 窄屏抽屉始终展开文案，不受桌面折叠影响 */
  html.sidebar-folded .brand-text { display: inline; }
  html.sidebar-folded .brand .co { display: block; }
  html.sidebar-folded .nav-group { display: flex; }
  html.sidebar-folded .nav-label { display: inline; }
  html.sidebar-folded .user-chip .u { display: block; }
  html.sidebar-folded .nav-item {
    justify-content: flex-start;
    padding: 9px 14px 9px 16px;
  }
  html.sidebar-folded .sidebar-fold { display: none; }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / .35);
    z-index: 35;
  }
  html.sidebar-open .sidebar-backdrop { display: block; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .content { padding: 14px; }
  .topbar { padding: 0 14px; }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ---- 小渐渐（右下角浮窗 + 完整页） ---- */
.ai-status-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  vertical-align: middle;
  color: #8a6d3b;
  background: #fff7e8;
  border: 1px solid #f3d19e;
}
.ai-status-pill.is-live {
  color: #0f6b24;
  background: #e8f8ec;
  border-color: #a8e0b4;
}
.ai-mode-tag {
  margin-left: 6px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}
.ai-mode-tag.ai-mode-live { color: var(--accent-ink); }
.kj-ai-buddy {
  position: fixed;
  z-index: 1200;
  right: 20px;
  bottom: 20px;
  /* 始终以浮钮为锚点；面板绝对定位向左上展开，避免 is-open 拉宽容器导致溢出视口 */
  width: 56px;
  height: 56px;
  touch-action: none;
  user-select: none;
}
.kj-ai-buddy.is-dragging { cursor: grabbing; }
.kj-ai-buddy.is-open {
  width: 56px;
  height: 56px;
}
.ai-buddy-fab {
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  cursor: grab;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #20a53a 0%, #16892e 100%);
  color: #fff;
  box-shadow: 0 8px 24px rgb(32 165 58 / .28), 0 2px 6px rgb(0 0 0 / .08);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
  position: relative;
  z-index: 2;
}
.ai-buddy-fab:hover { transform: translateY(-1px) scale(1.03); }
.ai-buddy-fab:active { cursor: grabbing; transform: scale(.98); }
.ai-buddy-fab:focus-visible { outline: none; box-shadow: var(--focus), 0 8px 24px rgb(32 165 58 / .28); }
.ai-buddy-face {
  width: 28px;
  height: 28px;
  display: block;
}
.ai-buddy-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f0c14a;
  border: 2px solid #fff;
  opacity: .9;
}
.kj-ai-buddy.is-thinking .ai-buddy-dot {
  animation: ai-pulse 1s ease-in-out infinite;
}
@keyframes ai-pulse {
  0%, 100% { transform: scale(1); opacity: .9; }
  50% { transform: scale(1.25); opacity: .55; }
}

.ai-buddy-panel {
  display: none;
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: min(360px, calc(100vw - 24px));
  max-height: min(480px, calc(100vh - 96px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgb(20 30 40 / .14);
  flex-direction: column;
  overflow: hidden;
}
.kj-ai-buddy.is-open .ai-buddy-panel {
  display: flex;
}
/* 靠近左缘时面板改向右展开，由 JS 加 is-panel-left */
.kj-ai-buddy.is-panel-left .ai-buddy-panel {
  right: auto;
  left: 0;
}
.ai-buddy-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.ai-buddy-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  line-height: 1.35;
}
.ai-buddy-head .ai-buddy-sub {
  display: block;
  width: 100%;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 0;
}
.ai-buddy-head .ai-status-pill {
  order: 2;
}
.ai-buddy-head-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 4px;
}
.ai-buddy-limit-hint {
  color: var(--muted);
  font-size: 11px;
}
.ai-buddy-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 180px;
  max-height: 280px;
  background: #f7f9fb;
}
.ai-buddy-empty {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.65;
  padding: 8px 4px;
}
.ai-buddy-warn { color: #9a3412; font-size: 12.5px; }
.ai-buddy-ctx {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 4px;
  line-height: 1.4;
  opacity: .92;
}
.ai-buddy-msg-user .ai-buddy-ctx { text-align: right; }
.ai-buddy-msg {
  margin-bottom: 10px;
  max-width: 92%;
}
.ai-buddy-msg-user { margin-left: auto; }
.ai-buddy-msg-assistant { margin-right: auto; }
.ai-buddy-msg-meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 3px;
}
.ai-buddy-msg-user .ai-buddy-msg-meta { text-align: right; }
.ai-buddy-msg-body {
  font-size: 13px;
  line-height: 1.55;
  padding: 8px 11px;
  border-radius: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-buddy-msg-user .ai-buddy-msg-body {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-buddy-msg-assistant .ai-buddy-msg-body {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.ai-buddy-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.ai-buddy-form input[type="text"] {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.ai-buddy-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 0 10px 10px;
  font-size: 12px;
}
.ai-buddy-foot a { color: var(--accent); }

/* 完整 AI 页（借鉴宝塔：留白欢迎语 + 容器式输入，不抄侧栏历史） */
.kj-ai-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 120px);
  max-width: 720px;
  margin: 0 auto;
  padding: 4px 4px 8px;
}
.ai-page-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 12px;
  flex-shrink: 0;
}
.ai-page-top-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.ai-page-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.ai-page-soft-tip {
  margin: 0 0 8px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  flex-shrink: 0;
}
.ai-page-admin {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--surface-2);
  flex-shrink: 0;
}
.ai-page-admin summary {
  cursor: pointer;
  color: var(--text-2);
}
.ai-page-admin ul {
  margin: 6px 0 0;
  padding-left: 1.2em;
  line-height: 1.5;
}
.ai-page-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 8px 4px 16px;
  min-height: 280px;
  background: transparent;
  border: none;
}
.ai-page-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: min(42vh, 360px);
  padding: 24px 16px;
}
.ai-page-welcome-hi {
  margin: 0 0 10px;
  font-size: clamp(22px, 3.2vw, 28px);
  font-weight: 650;
  color: var(--text);
  letter-spacing: 0.02em;
}
.ai-page-welcome-sub {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
}
.ai-page-composer {
  flex-shrink: 0;
  margin-top: 4px;
  padding: 12px 14px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 4px 18px rgb(15 23 42 / .06);
}
.ai-page-composer textarea.ai-page-input {
  display: block;
  width: 100%;
  min-height: 52px;
  max-height: 180px;
  resize: none;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  font-size: 14.5px;
  line-height: 1.55;
  outline: none;
}
.ai-page-composer textarea.ai-page-input:focus {
  border: none;
  box-shadow: none;
}
.ai-page-composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding-top: 2px;
}
.ai-page-composer-hint {
  font-size: 12px;
  color: var(--muted);
}
.ai-page-send {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #fff;
  background: var(--accent, #20a53a);
  box-shadow: 0 2px 8px rgb(32 165 58 / .35);
  transition: transform .12s ease, filter .12s ease;
}
.ai-page-send:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}
.ai-page-send:active { transform: scale(.96); }
.kj-ai-page.is-thinking .ai-page-title::after {
  content: " · 正在想…";
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
}
.kj-ai-buddy.is-thinking .ai-buddy-sub::after {
  content: " · 正在想…";
}

@media (max-width: 720px) {
  .kj-ai-buddy,
  .kj-ai-buddy.is-open {
    width: 56px;
    height: 56px;
  }
  .ai-buddy-panel {
    width: min(360px, calc(100vw - 16px));
    max-height: min(70vh, calc(100vh - 96px));
  }
}

/* ---- 合同与打款 · 分期行 ---- */
.contract-block {
  border: 1px solid var(--border, #e8e6e1);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

/* 费用报销 / 在线文档 / 协作组：表更宽，避免客户名与操作钮被裁切 */
table.expenses-table { min-width: 920px; }
table.expenses-table th.col-main,
table.expenses-table td.col-main { width: 18%; }
table.documents-table { min-width: 1080px; }
table.documents-table th.col-main,
table.documents-table td.col-main { width: 22%; }
table.documents-table th.col-actions-wide,
table.documents-table td.col-actions-wide { width: 15rem; min-width: 15rem; }
table.projects-table { min-width: 720px; }
table.contracts-table { min-width: 860px; }

.project-member-pick {
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--surface);
}
.project-member-pick-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 7px 6px;
  font-size: 13.5px;
  cursor: pointer;
  border-radius: 6px;
}
.project-member-pick-item:hover { background: var(--bg-soft); }
.project-member-pick-name { font-weight: 500; color: var(--text); min-width: 4em; }

/* 工钱：按活动分组 */
.wage-job-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.wage-job-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.wage-job-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.wage-job-title {
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
  text-decoration: none;
}
.wage-job-title:hover {
  color: var(--accent-ink);
  text-decoration: underline;
}
.wage-job-lines {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 10px 12px 12px;
}
.wage-line-block {
  margin: 0 0 10px;
}
.wage-line-block:last-child {
  margin-bottom: 0;
}

/* ---- 开关（替代原生 checkbox） ---- */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.switch-ui {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #c5cad3;
  flex-shrink: 0;
  transition: background .18s var(--ease);
}
.switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / .18);
  transition: transform .18s var(--ease);
}
.switch input:checked + .switch-ui {
  background: var(--accent);
}
.switch input:checked + .switch-ui::after {
  transform: translateX(18px);
}
.switch input:focus-visible + .switch-ui {
  box-shadow: var(--focus);
}
.switch-label { font-weight: 500; color: var(--text); }

/* ---- 平台超管开关 ---- */
.platform-flag-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.platform-flag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface, #fff);
}
.platform-flag-row:last-child { border-bottom: 0; }
.platform-flag-text { min-width: 0; flex: 1; }
.platform-flag-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.platform-flag-row .hint { margin: 0; }

/* ---- 费用类目行 ---- */
.cat-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 14px;
  align-items: flex-end;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.cat-add-name { margin: 0; flex: 1 1 180px; min-width: 160px; }
.cat-add-sort { margin: 0; width: 96px; flex: 0 0 96px; }
.cat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 14px;
  align-items: flex-end;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
}
.cat-row-name { margin: 0; flex: 1 1 160px; min-width: 140px; }
.cat-row-sort { margin: 0; width: 88px; flex: 0 0 88px; }
.cat-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding-bottom: 2px;
}
.cat-code {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}
.cat-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-height: 38px;
  padding-bottom: 2px;
}
@media (max-width: 720px) {
  .cat-row-actions { margin-left: 0; width: 100%; }
}
.contract-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.contract-meta-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  width: 100%;
  margin: 0;
}
.contract-title-input {
  width: 160px;
  max-width: 40vw;
  font-weight: 600;
}
.contract-note-input {
  width: 180px;
  max-width: 36vw;
}
.contract-upload-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 10px;
}
.contract-ins-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.contract-ins-labels,
.contract-ins-row {
  display: grid;
  grid-template-columns:
    minmax(72px, 0.9fr)
    minmax(88px, 0.85fr)
    minmax(88px, 0.85fr)
    64px
    minmax(120px, 1.1fr)
    minmax(100px, 1fr)
    auto;
  gap: 8px;
  align-items: center;
}
.contract-ins-labels {
  padding: 0 10px;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.contract-ins-row {
  padding: 8px 10px;
  background: #fafaf8;
  border-radius: 8px;
}
.contract-ins-form {
  display: contents;
}
.contract-ins-form .ci-name,
.contract-ins-form .ci-amt,
.contract-ins-form .ci-note {
  min-width: 0;
  width: 100%;
}
.contract-ins-form .ci-note { max-width: 200px; }
.contract-ins-form .ci-recv {
  font-size: 12.5px;
  white-space: nowrap;
  margin: 0;
}
.contract-ins-form .ci-voucher {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: 12px;
}
.contract-ins-form .ci-voucher input[type="file"] {
  max-width: 100%;
  font-size: 11.5px;
}
.contract-ins-form .ci-dash { color: var(--muted); }
.ci-actions {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}
.ci-actions .ci-delete {
  display: inline;
  margin: 0;
}
.contract-add-ins {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}
.contract-add-ins input[type="text"] { width: 120px; }
.contract-add-ins input[type="number"] { width: 100px; }
.contract-foot {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border, #eee);
}

@media (max-width: 960px) {
  .contract-ins-labels { display: none; }
  .contract-ins-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
  }
  .contract-ins-form .ci-name,
  .contract-ins-form .ci-voucher,
  .contract-ins-form .ci-note,
  .ci-actions {
    grid-column: 1 / -1;
  }
  .contract-ins-form .ci-note { max-width: none; }
  .ci-actions { justify-content: flex-start; }
}
