/* ============================================================
 * 联合经营系统 · Apple 设计语言主题
 * 依据 Apple Human Interface Guidelines:
 *  - 浅色、克制、大量留白; 颜色只用于状态, 不用于装饰
 *  - SF 字体栈 + 紧凑数字字距; 毛玻璃顶栏/侧栏 (frosted glass)
 *  - 柔光分层阴影, 大圆角卡片, 细线图标, 胶囊按钮
 *  - 系统色: 蓝 #0071e3 / 绿 #34c759 / 红 #ff3b30 / 橙 #ff9500
 * 全部 CSS 手写, 零外部依赖。
 * ============================================================ */

:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --line: rgba(0, 0, 0, .06);
  --line-soft: rgba(60, 60, 67, .12);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, .1);
  --green: #248a3d;
  --green-tint: rgba(52, 199, 89, .12);
  --red: #d70015;
  --red-tint: rgba(255, 59, 48, .08);
  --amber: #b25000;
  --amber-tint: rgba(255, 149, 0, .14);
  --sky: #0060df;
  --sky-tint: rgba(0, 122, 255, .1);
  --violet: #8944ab;
  --violet-tint: rgba(175, 82, 222, .12);
  --gray-fill: #f2f2f7;
  --gray-fill-hover: #e8e8ed;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .05), 0 14px 32px rgba(0, 0, 0, .09);
  --font-sf: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-sf);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.num, .stat-value, td.money {
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

::selection { background: rgba(0, 113, 227, .22); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .18); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, .3); background-clip: content-box; }

/* ===== 顶栏(毛玻璃) ===== */
.cs-offibar {
  position: sticky !important;
  top: 0 !important;
  z-index: 10001 !important;
  flex-wrap: nowrap !important;
}
.topbar {
  position: sticky; top: 40px; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--line);
  padding: 10px 22px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 38px; height: 38px; border-radius: 11px;
  background: #1d1d1f;
  color: #fff; font-size: 19px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
.brand-name { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.brand-sub { font-size: 11.5px; color: var(--ink-3); letter-spacing: .02em; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.identity { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.identity select {
  border: none; border-radius: 10px; padding: 6px 9px;
  font-size: 13px; background: var(--gray-fill); color: var(--ink);
  font-family: inherit;
}
select option { background: #fff; color: var(--ink); }
.salary-countdown {
  background: var(--amber-tint); color: var(--amber);
  border-radius: 999px; padding: 4px 13px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}

/* ===== 徽章 ===== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 3px 12px; font-size: 12px; font-weight: 600;
}
.badge-open { background: var(--green-tint); color: var(--green); }
.badge-open::before { content: "●"; font-size: 7px; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ===== 演示提示条 ===== */
.demo-banner {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
  text-align: center; font-size: 12px; padding: 5px 12px;
}

/* ===== 布局 ===== */
.layout { display: flex; min-height: calc(100vh - 101px); }
.sidebar {
  width: 176px; flex: 0 0 176px;
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-right: 1px solid var(--line);
  padding: 16px 10px;
  position: sticky; top: 99px; height: calc(100vh - 99px); overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  color: var(--ink-2); text-decoration: none;
  padding: 8px 12px; border-radius: 10px; margin-bottom: 2px;
  font-size: 13.5px; cursor: pointer; border: none;
  background: none; width: 100%; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(0, 0, 0, .045); color: var(--ink); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent); font-weight: 600;
}
.nav-icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.nav-icon svg { width: 18px; height: 18px; }
.sidebar-foot {
  margin-top: 18px; padding: 12px 12px 4px;
  border-top: 1px solid var(--line);
  font-size: 11px; color: var(--ink-3);
  display: flex; align-items: center; gap: 7px;
}
.dot-live {
  width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto;
  background: #34c759;
  animation: pulse 2s infinite;
}

.content { flex: 1; padding: 26px 28px; min-width: 0; }
.view { display: none; animation: fadeIn .18s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; } }

/* ===== 页面标题(大字距标题 + 灰色副标题) ===== */
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.page-head p { font-size: 13px; color: var(--ink-3); margin-top: 3px; }

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
  transition: box-shadow .2s;
}
.card-title {
  font-size: 15px; font-weight: 600; letter-spacing: -.01em;
  margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.card-title .hint { font-size: 12px; font-weight: 400; color: var(--ink-3); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: 1fr 1fr; } .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ===== 大数字卡片 ===== */
.stat-card { padding: 18px 20px; }
.stat-label { font-size: 12px; color: var(--ink-3); letter-spacing: .02em; margin-bottom: 7px; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.12; }
.stat-value.big { font-size: 33px; }
.stat-sub { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.c-green { color: var(--green); }
.c-red { color: var(--red); }
.c-amber { color: var(--amber); }
.c-accent { color: var(--accent); }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; color: var(--ink-3); font-weight: 600; font-size: 11.5px;
  letter-spacing: .04em; padding: 9px 10px;
  border-bottom: 1px solid var(--line-soft); white-space: nowrap;
}
td { padding: 11px 10px; border-bottom: 1px solid rgba(60, 60, 67, .08); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--bg); }
tr.row-me { background: rgba(0, 113, 227, .05); }
tr.row-me:hover { background: rgba(0, 113, 227, .09); }
td.money { text-align: right; font-weight: 600; }
th.money { text-align: right; }
.money-in { color: var(--green); }
.money-out { color: var(--red); }

/* ===== 芯片(胶囊) ===== */
.chip {
  display: inline-block; border-radius: 999px; padding: 1.5px 10px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  letter-spacing: .01em;
}
.chip-green { background: var(--green-tint); color: var(--green); }
.chip-red { background: var(--red-tint); color: var(--red); }
.chip-amber { background: var(--amber-tint); color: var(--amber); }
.chip-sky { background: var(--sky-tint); color: var(--sky); }
.chip-violet { background: var(--violet-tint); color: var(--violet); }
.chip-gray { background: var(--gray-fill); color: #3c3c43; }

/* ===== 进度条 ===== */
.progress { background: #e5e5ea; border-radius: 999px; height: 6px; overflow: hidden; min-width: 60px; }
.progress > span {
  display: block; height: 100%; border-radius: 999px;
  background: var(--accent); transition: width .3s;
}
.progress.green > span { background: #34c759; }
.progress.amber > span { background: #ff9500; }
.progress.red > span { background: #ff3b30; }

/* ===== 按钮与表单(胶囊按钮) ===== */
.btn {
  border: none; background: var(--gray-fill); color: var(--ink);
  border-radius: 999px; padding: 6px 15px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: inherit; transition: background .15s, transform .15s;
}
.btn:hover { background: var(--gray-fill-hover); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-sm { padding: 3.5px 12px; font-size: 12px; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--gray-fill); }
.btn-danger { background: transparent; color: var(--red); }
.btn-danger:hover { background: var(--red-tint); }
input, select, textarea {
  border: none; border-radius: 10px; padding: 8px 12px;
  font-size: 13px; font-family: inherit;
  background: var(--gray-fill); color: var(--ink);
  transition: box-shadow .15s, background .15s;
}
input::placeholder { color: var(--ink-3); }
input:focus, select:focus {
  outline: none; background: #fff;
  box-shadow: 0 0 0 3.5px rgba(0, 113, 227, .28);
}
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.form-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--ink-2); }
.form-field input, .form-field select { min-width: 110px; }

/* ===== 看板列 ===== */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1100px) { .kanban { grid-template-columns: repeat(2, 1fr); } }
.kanban-col {
  background: var(--bg);
  border-radius: 16px; padding: 12px; min-height: 130px;
}
.kanban-head {
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  padding: 2px 8px 10px; display: flex; justify-content: space-between; align-items: center;
}
.kanban-count {
  background: var(--gray-fill-hover); border-radius: 999px; font-size: 11px;
  padding: 0 9px; color: var(--ink-2); font-weight: 600;
}
.task-card {
  background: var(--card);
  border-radius: 13px; padding: 12px 14px; margin-bottom: 9px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
  transition: box-shadow .18s, transform .18s;
}
.task-card:hover { box-shadow: 0 8px 20px rgba(0, 0, 0, .09); transform: translateY(-1px); }
.task-title { font-weight: 600; font-size: 13px; margin-bottom: 7px; }
.task-meta { font-size: 11.5px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.task-meta .due { color: var(--ink-3); }
.task-meta .due.overdue { color: var(--red); font-weight: 600; }
.task-actions { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.task-blocked-note {
  background: var(--red-tint); color: var(--red);
  border-radius: 10px; font-size: 11.5px; padding: 7px 10px; margin-top: 10px;
}
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; color: #fff;
  font-size: 11px; font-weight: 600; flex: 0 0 auto;
}

/* ===== 组织树 ===== */
.org-tree { display: flex; flex-direction: column; gap: 8px; }
.org-node {
  background: var(--card); border-radius: 13px; padding: 11px 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  display: flex; align-items: center; gap: 11px;
}
.org-node.root { background: var(--accent-soft); }
.org-node .org-icon { width: 20px; height: 20px; color: var(--ink-2); display: flex; align-items: center; }
.org-node .org-icon svg { width: 19px; height: 19px; }
.org-node.root .org-icon { color: var(--accent); }
.org-node .org-info { flex: 1; min-width: 0; }
.org-node .org-name { font-weight: 600; font-size: 13px; }
.org-node .org-desc { font-size: 11.5px; color: var(--ink-3); }
.org-node.child { margin-left: 26px; }

/* ===== 图表 ===== */
.chart-box { width: 100%; }
.chart-box svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.chart-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }

/* ===== KPI ===== */
.kpi-member { margin-bottom: 14px; }
.kpi-member-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.kpi-member-name { font-weight: 600; }
.kpi-row {
  display: grid; grid-template-columns: 1.6fr .9fr .9fr 1.4fr .7fr; gap: 10px;
  align-items: center; padding: 8px 0;
  border-bottom: 1px solid rgba(60, 60, 67, .07); font-size: 13px;
}
.kpi-row:last-child { border-bottom: none; }
.kpi-row .kpi-t { font-size: 12px; color: var(--ink-3); }
@media (max-width: 900px) { .kpi-row { grid-template-columns: 1fr 1fr; } }

/* ===== 投票 ===== */
.vote {
  background: var(--card); border-radius: 13px; padding: 14px 16px; margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.vote-title { font-weight: 600; margin-bottom: 5px; }
.vote-meta { font-size: 12px; color: var(--ink-3); margin-bottom: 10px; }
.vote-options { display: flex; gap: 8px; flex-wrap: wrap; }
.vote-opt {
  border: none; border-radius: 999px; padding: 5px 16px;
  font-size: 12.5px; cursor: pointer; background: var(--gray-fill);
  color: var(--ink); font-family: inherit; transition: background .15s;
}
.vote-opt:hover { background: var(--gray-fill-hover); }
.vote-opt.voted { background: var(--accent); color: #fff; font-weight: 600; }
.vote-opt.disabled { cursor: default; opacity: .5; }
.vote-opt.disabled:hover { background: var(--gray-fill); }

/* ===== 规则 ===== */
details.rule {
  background: var(--card); border-radius: 13px; margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
details.rule summary {
  padding: 13px 16px; cursor: pointer; font-weight: 600; font-size: 13.5px;
  list-style: none; display: flex; align-items: center; gap: 8px;
}
details.rule summary::-webkit-details-marker { display: none; }
details.rule summary::before { content: "›"; color: var(--ink-3); font-size: 15px; transition: transform .15s; }
details.rule[open] summary::before { transform: rotate(90deg); color: var(--accent); }
.rule-body { padding: 0 16px 14px 38px; font-size: 13px; color: var(--ink-2); white-space: pre-line; }

/* ===== 审计日志 ===== */
.audit-entry {
  display: flex; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid rgba(60, 60, 67, .06);
  font-size: 12.5px; align-items: baseline;
}
.audit-entry:last-child { border-bottom: none; }
.audit-ts { color: var(--ink-3); font-size: 11.5px; white-space: nowrap; min-width: 110px; }
.audit-actor { font-weight: 600; white-space: nowrap; }
.audit-action { color: var(--accent); font-weight: 600; white-space: nowrap; }

/* ===== 提示气泡(毛玻璃 HUD) ===== */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: rgba(250, 250, 252, .85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(0, 0, 0, .06);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
  color: var(--ink); border-radius: 14px; padding: 10px 18px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 100;
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty { color: var(--ink-3); text-align: center; padding: 26px 0; font-size: 13px; }
.footer-note { font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.section-label { font-size: 12px; color: var(--ink-3); margin: 14px 0 8px; font-weight: 600; letter-spacing: .04em; }

/* ===== 项目卡片(任务看板首页) ===== */
.project-card { cursor: pointer; transition: box-shadow .2s, transform .2s; }
.project-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.project-customer { font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px; }
.project-desc { font-size: 12.5px; color: var(--ink-3); margin-bottom: 11px; }
.project-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 11px; }
.project-stats { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.project-progress { margin-left: auto; display: flex; align-items: center; }
