/* ============================================================ 主题变量 */

:root {
  color-scheme: light;

  --bg: #f5f7fc;
  --bg-glow: radial-gradient(1100px 620px at 10% -12%, rgba(79, 70, 229, 0.1), transparent 60%),
    radial-gradient(900px 520px at 95% 0%, rgba(14, 165, 233, 0.08), transparent 58%);

  --surface: #ffffff;
  --surface-2: #f8fafe;
  --surface-3: #eef2fa;
  --surface-hover: #f1f5fc;
  --panel-bg: #ffffff;
  --task-bg: #ffffff;

  --border: #e4e9f3;
  --border-strong: #d2dbea;

  --text: #16203a;
  --text-soft: #2e3a55;
  --muted: #5a6884;

  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-soft: rgba(79, 70, 229, 0.09);
  --accent-border: rgba(79, 70, 229, 0.28);

  --ok: #059669;
  --ok-soft: rgba(5, 150, 105, 0.09);
  --ok-border: rgba(5, 150, 105, 0.26);
  --warn: #d97706;
  --danger: #e11d48;
  --danger-soft: rgba(225, 29, 72, 0.08);
  --danger-border: rgba(225, 29, 72, 0.24);

  --sidebar-bg: rgba(255, 255, 255, 0.88);
  --topbar-bg: rgba(245, 247, 252, 0.82);
  --modal-bg: #ffffff;
  --code-bg: #f6f8fd;
  --code-text: #26314d;

  --card-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
  --shadow: 0 24px 54px rgba(15, 23, 42, 0.18);
  --avatar-text: #ffffff;

  --p-low-bg: #f1f5f9;
  --p-low-fg: #64748b;
  --p-med-bg: #e0edff;
  --p-med-fg: #1d4ed8;
  --p-high-bg: #fef3c7;
  --p-high-fg: #b45309;
  --p-urgent-bg: #ffe4e6;
  --p-urgent-fg: #be123c;

  --toast-bg: #ecfdf5;
  --toast-fg: #047857;
  --toast-border: rgba(5, 150, 105, 0.3);
  --toast-err-bg: #fff1f2;
  --toast-err-fg: #be123c;
  --toast-err-border: rgba(225, 29, 72, 0.3);

  --radius: 16px;
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #080d1a;
  --bg-glow: radial-gradient(1100px 620px at 12% -10%, rgba(99, 102, 241, 0.22), transparent 62%),
    radial-gradient(900px 520px at 92% 0%, rgba(14, 165, 233, 0.14), transparent 60%);

  --surface: #101a2e;
  --surface-2: #14203a;
  --surface-3: #182643;
  --surface-hover: rgba(148, 163, 184, 0.1);
  --panel-bg: linear-gradient(180deg, rgba(20, 32, 58, 0.92), rgba(16, 26, 46, 0.92));
  --task-bg: linear-gradient(180deg, #17233d, #131e35);

  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.26);

  --text: #e9efff;
  --text-soft: #dfe6ff;
  --muted: #9dabcc;

  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(99, 102, 241, 0.16);
  --accent-border: rgba(99, 102, 241, 0.32);

  --ok: #10b981;
  --ok-soft: rgba(16, 185, 129, 0.08);
  --ok-border: rgba(16, 185, 129, 0.26);
  --warn: #f59e0b;
  --danger: #f43f5e;
  --danger-soft: rgba(244, 63, 94, 0.12);
  --danger-border: rgba(244, 63, 94, 0.3);

  --sidebar-bg: rgba(9, 14, 28, 0.82);
  --topbar-bg: rgba(8, 13, 26, 0.72);
  --modal-bg: #0e1729;
  --code-bg: rgba(4, 8, 18, 0.72);
  --code-text: #c7d4f5;

  --card-shadow: 0 10px 26px rgba(2, 6, 23, 0.22);
  --shadow: 0 18px 40px rgba(2, 6, 23, 0.45);
  --avatar-text: #0b1222;

  --p-low-bg: rgba(148, 163, 184, 0.14);
  --p-low-fg: #9fb0d0;
  --p-med-bg: rgba(59, 130, 246, 0.16);
  --p-med-fg: #93c5fd;
  --p-high-bg: rgba(245, 158, 11, 0.14);
  --p-high-fg: #fcd34d;
  --p-urgent-bg: rgba(244, 63, 94, 0.16);
  --p-urgent-fg: #fda4af;

  --toast-bg: #0f2a24;
  --toast-fg: #a7f3d0;
  --toast-border: rgba(16, 185, 129, 0.4);
  --toast-err-bg: #2b1120;
  --toast-err-fg: #fecdd3;
  --toast-err-border: rgba(244, 63, 94, 0.45);
}

/* ============================================================ 基础 */

* { box-sizing: border-box; }

/* 保证 hidden 属性优先于组件的 display 声明 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  background-image: var(--bg-glow);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }

/* ============================================================ 侧边栏 */

.sidebar {
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column; gap: 18px;
  padding: 22px 16px 18px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; }

.logo {
  width: 40px; height: 40px; flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12.5px; letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #8b5cf6);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.32);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand-text strong { font-size: 15px; letter-spacing: 0.2px; }
.brand-text span {
  font-size: 11px; color: var(--muted);
  letter-spacing: 1.4px; text-transform: uppercase;
}

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
[data-theme="dark"] .nav-item.active { color: #cdd3ff; }
.nav-item svg { flex: none; opacity: 0.9; }

.side-section { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; }

.side-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px;
  font-size: 11px; letter-spacing: 1px;
  color: var(--muted);
  text-transform: uppercase;
}

.mini-btn {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px; line-height: 1;
}
.mini-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-hover); }

.side-projects {
  display: flex; flex-direction: column; gap: 3px;
  overflow-y: auto; padding-right: 2px;
}
.side-projects::-webkit-scrollbar { width: 6px; }
.side-projects::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }

.side-project {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.side-project:hover { background: var(--surface-hover); color: var(--text); }
.side-project.active { background: var(--accent-soft); border-color: var(--accent-border); color: var(--text); }
.sp-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.sp-progress { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.dot { width: 9px; height: 9px; border-radius: 3px; flex: none; display: inline-block; }
.dot.lg { width: 12px; height: 12px; border-radius: 4px; }

.side-footer {
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}

.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.user-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.user-meta strong { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { font-size: 11px; color: var(--muted); }

.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 17px; line-height: 1;
  cursor: pointer;
  flex: none;
}
.icon-btn:hover { color: var(--text); background: var(--surface-hover); border-color: var(--border-strong); }


/* ============================================================ 主区域 */

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

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px 30px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

/* 顶栏空间不足时的收缩顺序：
   1) 搜索框先收窄到 min-width；2) 左侧标题截断；3) 按钮 / 图标按钮 / 头像保持原尺寸。
   反过来的话，按钮会被压到只剩一个字宽，文字竖排（历史缺陷）。 */
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 0; }
.topbar-titles { min-width: 0; }
.topbar-left h1 {
  font-size: 20px; font-weight: 650; letter-spacing: 0.2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-left p {
  margin-top: 4px; font-size: 12.5px; color: var(--muted);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.topbar-right { display: flex; align-items: center; gap: 12px; flex: 0 1 auto; min-width: 0; }
.topbar-right .btn { flex: 0 0 auto; }

.mobile-menu-btn { display: none; }
.sidebar-overlay { display: none; }

.search {
  display: flex; align-items: center; gap: 8px;
  flex: 0 1 242px; min-width: 132px;
  padding: 0 12px; height: 38px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  color: var(--muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus-within { border-color: var(--accent-border); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input {
  width: 100%; min-width: 0; border: 0; background: transparent;
  outline: none; color: var(--text);
}
.search input::placeholder { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
  transition: transform 0.12s, background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn-label { white-space: nowrap; }
.btn:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.26);
}
.btn.primary:hover { background: linear-gradient(135deg, #5b52ea, #8b5cf6); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-hover); }
.btn.danger {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger);
}
.btn.danger:hover { background: rgba(225, 29, 72, 0.14); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 9px; }
.plus { font-size: 16px; line-height: 1; margin-top: -2px; }

.avatar-stack { display: flex; align-items: center; }
.avatar {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 12px; font-weight: 600;
  color: var(--avatar-text);
  border: 2px solid var(--surface);
  background: #64748b;
}
.avatar-stack .avatar { margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; border-width: 1.5px; }
.avatar.empty { background: var(--surface-3); color: var(--muted); }
.avatar.lg { width: 44px; height: 44px; font-size: 16px; border-width: 0; }

.view { padding: 24px 30px 64px; max-width: 1560px; width: 100%; }

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.section-head h3 { font-size: 14px; font-weight: 600; letter-spacing: 0.2px; }
.section-head span { font-size: 12px; color: var(--muted); }

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ============================================================ 概览 */

.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px; margin-bottom: 22px;
}

.kpi { position: relative; padding: 18px 20px; overflow: hidden; }
.kpi::after {
  content: ""; position: absolute; right: -30px; top: -30px;
  width: 100px; height: 100px; border-radius: 50%;
  background: var(--tone, var(--accent)); opacity: 0.12;
}
.kpi-label { font-size: 12px; color: var(--muted); letter-spacing: 0.4px; }
.kpi-value {
  margin-top: 8px; font-size: 30px; font-weight: 700;
  letter-spacing: -0.5px; font-variant-numeric: tabular-nums;
}
.kpi-hint { margin-top: 6px; font-size: 12px; color: var(--muted); }
.kpi.indigo { --tone: #4f46e5; }
.kpi.sky { --tone: #0ea5e9; }
.kpi.rose { --tone: #e11d48; }
.kpi.emerald { --tone: #059669; }
.kpi.rose .kpi-value { color: var(--danger); }

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 16px; margin-bottom: 16px;
}
.dash-grid.equal { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

.card { padding: 18px 20px; }

.progress-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px 10px;
  border: 0; border-radius: 11px;
  background: transparent; cursor: pointer; text-align: left;
  transition: background 0.15s;
}
.progress-row:hover { background: var(--surface-hover); }
.progress-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.progress-row + .progress-row { border-top: 1px solid var(--border); }
.pr-main { flex: 1; min-width: 0; }
.pr-top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 7px;
}
.pr-top strong {
  font-size: 13.5px; font-weight: 550;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pr-top span { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.pr-pct { font-size: 13px; color: var(--accent); width: 38px; text-align: right; font-variant-numeric: tabular-nums; }

.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar i {
  display: block; height: 100%; border-radius: 99px;
  background: var(--accent); transition: width 0.4s ease;
}
.bar.big { height: 8px; margin-top: 14px; }

.workload-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; }
.wl-main { flex: 1; min-width: 0; }
.wl-top {
  display: flex; justify-content: space-between; gap: 8px;
  margin-bottom: 6px; font-size: 13px;
}
.wl-top span { color: var(--muted); font-size: 11.5px; }
.workload-row .bar { height: 5px; }
.workload-row .bar i { background: linear-gradient(90deg, #6366f1, #22d3ee); }

.activity { display: flex; gap: 11px; padding: 10px 0; }
.activity + .activity { border-top: 1px solid var(--border); }
.activity-body { min-width: 0; flex: 1; }
.activity-text { font-size: 13px; line-height: 1.5; }
.activity-text b { font-weight: 550; color: var(--text); }
.activity-meta {
  margin-top: 3px; font-size: 11.5px; color: var(--muted);
  display: flex; gap: 8px; align-items: center;
}

.milestone-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; }
.milestone-row + .milestone-row { border-top: 1px solid var(--border); }
.ms-date {
  width: 52px; flex: none; text-align: center;
  padding: 6px 0; border-radius: 9px;
  background: var(--surface-3);
  font-size: 11.5px; color: var(--accent); font-variant-numeric: tabular-nums;
}
.ms-body { min-width: 0; flex: 1; }
.ms-body strong { display: block; font-size: 13px; font-weight: 550; }
.ms-body span { font-size: 11.5px; color: var(--muted); }

.empty-state { padding: 34px 10px; text-align: center; color: var(--muted); font-size: 13px; }

/* ============================================================ 项目看板 */

.project-hero { display: flex; gap: 24px; padding: 22px 24px; margin-bottom: 14px; }
.hero-main { flex: 1; min-width: 0; }
.hero-title { display: flex; gap: 12px; align-items: flex-start; }
.hero-title h2 { font-size: 19px; font-weight: 650; }
.hero-title p {
  margin-top: 6px; font-size: 12.5px; line-height: 1.6;
  color: var(--muted); max-width: 720px;
}
.hero-delete { margin-left: auto; flex: none; }
.hero-meta {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px 16px; margin-top: 14px;
  font-size: 12px; color: var(--muted);
}
.project-members-bar { gap: 8px 10px; }
.project-members-bar .member-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft, var(--surface));
  color: var(--text);
  font-size: 12px;
}
.project-members-bar .btn { padding: 3px 10px; font-size: 12px; }
.member-pick-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 12px; max-height: 260px; overflow-y: auto;
  margin-top: 6px;
}
.member-pick {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 6px 8px; border: 1px solid var(--border);
  border-radius: 9px; font-size: 13px; cursor: pointer;
}
.member-pick:hover { background: var(--surface-soft, var(--surface)); }
/* 覆盖 .field input 的 width:100%，否则复选框会撑满整行把姓名挤成竖排 */
.member-pick input[type="checkbox"] {
  width: 16px; height: 16px; flex: none; accent-color: var(--accent);
}
.member-pick .avatar { flex: none; }
.member-pick > span:not(.avatar) {
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.member-pick > .muted { margin-left: auto; flex: none; font-size: 11px; }
.avatar.xs { width: 20px; height: 20px; font-size: 10px; border-width: 0; }
.hero-side { display: flex; gap: 10px; align-items: stretch; }
.mini-kpi {
  min-width: 82px; padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  display: flex; flex-direction: column; gap: 6px;
}
.mini-kpi span { font-size: 11px; color: var(--muted); }
.mini-kpi strong { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }

.pill {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  background: var(--surface-3);
  font-size: 12px;
  font-weight: 550;
  color: var(--text);
}
.pill.danger {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger);
}

.milestone-bar {
  display: flex; gap: 10px; overflow-x: auto;
  padding: 2px 2px 12px;
}
.ms-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 13px; flex: none;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  font-size: 12px;
  box-shadow: var(--card-shadow);
}
.ms-chip.done { opacity: 0.6; }
.ms-chip .ms-chip-date { color: var(--muted); font-size: 11px; }
.ms-chip .check { color: var(--ok); }
.ms-chip.editable { cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.ms-chip.editable:hover { border-color: var(--accent); box-shadow: var(--card-shadow), 0 0 0 1px var(--accent); }
.ms-empty { flex: none; padding: 8px 4px; font-size: 12px; color: var(--muted); }
.ms-add {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 8px 14px;
  border: 1px dashed var(--border);
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.ms-add:hover { color: var(--accent); border-color: var(--accent); }

.board-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin: 6px 2px 12px; flex-wrap: wrap;
}
.board-title { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.board-title .muted { font-weight: 400; font-size: 11.5px; }
.board-actions { display: flex; gap: 8px; }

select, input[type="date"], input[type="number"], input[type="text"], input[type="search"], input[type="password"], textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 9px 11px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select:focus, input:focus, textarea:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
select:disabled, input:disabled, textarea:disabled {
  color: var(--muted);
  background: var(--surface-3);
  cursor: not-allowed;
}
.board-actions select { height: 34px; padding: 0 10px; font-size: 12.5px; }

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(238px, 1fr));
  gap: 14px; align-items: start;
}
.kanban-col {
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  padding: 12px;
  min-height: 140px;
  transition: border-color 0.15s, background 0.15s;
}
.kanban-col.drop-target {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}
.kanban-col > header {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 4px 11px; font-size: 12.5px;
}
.col-dot { width: 7px; height: 7px; border-radius: 99px; background: #94a3b8; }
.col-dot.in_progress { background: #0ea5e9; }
.col-dot.review { background: #f59e0b; }
.col-dot.done { background: #10b981; }
.col-count {
  margin-left: auto; font-size: 11.5px; color: var(--muted);
  background: var(--surface-3); padding: 1px 8px; border-radius: 99px;
}
.col-body {
  display: flex; flex-direction: column; gap: 9px;
  max-height: 56vh; overflow-y: auto; padding: 1px;
}
.col-body::-webkit-scrollbar { width: 5px; }
.col-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
.col-empty {
  padding: 18px 8px; text-align: center; font-size: 12px;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
}

.task-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--task-bg);
  padding: 11px 12px;
  cursor: grab;
  box-shadow: var(--card-shadow);
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.task-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}
.task-card.dragging { opacity: 0.42; }
.task-card h4 { font-size: 13px; font-weight: 500; line-height: 1.45; margin: 7px 0 9px; }
.tc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tc-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; font-size: 11px;
}
.tc-assignee { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }

.prio { font-size: 10.5px; padding: 2px 7px; border-radius: 6px; border: 1px solid transparent; }
.prio.p-low { color: var(--p-low-fg); background: var(--p-low-bg); }
.prio.p-medium { color: var(--p-med-fg); background: var(--p-med-bg); }
.prio.p-high { color: var(--p-high-fg); background: var(--p-high-bg); }
.prio.p-urgent { color: var(--p-urgent-fg); background: var(--p-urgent-bg); }
.due { font-size: 11px; color: var(--muted); }
.due.overdue { color: var(--danger); }

/* ============================================================ 成员 / 搜索 */

.member-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.member-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.member-head { display: flex; align-items: center; gap: 12px; }
.member-head strong { display: block; font-size: 14.5px; font-weight: 600; }
.member-head span { font-size: 12.5px; color: var(--text-soft); }
.member-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.member-stats div {
  padding: 9px 4px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.member-stats b { display: block; font-size: 17px; font-weight: 650; }
.member-stats span { font-size: 11.5px; color: var(--text-soft); }
.member-mail { font-size: 12.5px; color: var(--text-soft); word-break: break-all; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.member-account { display: flex; align-items: center; gap: 8px; font-size: 12.5px; flex-wrap: wrap; }
.member-account .pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.member-account > span:not(.pill) { color: var(--text-soft); }

/* ============================================================ 我的任务 / 子任务 / 附件 */
.tag {
  display: inline-flex; align-items: center;
  margin-right: 4px; padding: 1px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px; font-weight: 550;
}
[data-theme="dark"] .tag { color: #cdd3ff; }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; padding: 0 6px; margin-left: 4px;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--text-soft);
  font-size: 11px; font-weight: 600;
}
.my-task-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 2px;
  cursor: pointer;
}
.my-task-row + .my-task-row { border-top: 1px solid var(--border); }
.my-task-row:hover strong { color: var(--accent); }
.my-task-main { flex: 1; min-width: 0; }
.my-task-main strong { display: block; font-size: 13.5px; font-weight: 550; }
.my-task-main > span { display: block; margin: 2px 0 4px; font-size: 11.5px; color: var(--muted); }
.my-task-side { display: flex; align-items: center; gap: 8px; flex: none; }
.subtask-list, .attachment-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.subtask-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.subtask-item.done .subtask-check span { text-decoration: line-through; color: var(--muted); }
.subtask-check { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; cursor: pointer; }
.subtask-check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-item { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.attachment-item a {
  flex: 1; min-width: 0; color: var(--accent); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.attachment-item a:hover { text-decoration: underline; }
.attachment-item .muted { flex: none; font-size: 11.5px; }
.icon-btn.tiny { width: 22px; height: 22px; border-radius: 6px; font-size: 13px; }
.blocked-tag { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.task-card.blocked h4 { color: var(--text-soft); }
.tc-tags { margin-top: 6px; }
.member-actions { display: flex; gap: 8px; }
.member-actions .btn { flex: 1; justify-content: center; }

.result-list { display: flex; flex-direction: column; gap: 8px; }
.result-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
  cursor: pointer; text-align: left;
}
.result-row:hover { border-color: var(--accent-border); background: var(--surface-hover); }
.result-main { flex: 1; min-width: 0; }
.result-main strong {
  display: block; font-size: 13.5px; font-weight: 550;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.result-main span { font-size: 11.5px; color: var(--muted); }
.result-row .pill { flex: none; }

/* ============================================================ MCP */

.mcp-hero {
  display: flex; gap: 20px; align-items: center; justify-content: space-between;
  flex-wrap: wrap; padding: 22px 24px; margin-bottom: 16px;
}
.endpoint-box {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; padding: 10px 14px;
  border: 1px solid var(--ok-border);
  border-radius: 11px;
  background: var(--ok-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: var(--ok);
  word-break: break-all;
}
.copy-btn {
  border: 1px solid var(--ok-border);
  background: transparent;
  color: var(--ok);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 11.5px;
  flex: none;
}
.copy-btn:hover { background: rgba(5, 150, 105, 0.14); }

.code-block {
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--code-bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.75;
  color: var(--code-text);
  overflow-x: auto;
  white-space: pre;
}

.tool-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.tool-card {
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.tool-card code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; color: var(--accent);
}
.tool-card strong { display: block; margin: 5px 0 6px; font-size: 13px; font-weight: 550; }
.tool-card p { font-size: 12px; line-height: 1.6; color: var(--muted); }

/* ============================================================ 弹窗 / 表单 */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(5px);
}
[data-theme="dark"] .modal-backdrop { background: rgba(4, 8, 18, 0.66); }
.modal-backdrop.show { display: flex; }

.modal {
  width: min(720px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: var(--modal-bg);
  box-shadow: var(--shadow);
  animation: pop 0.16s ease-out;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: none; }
}
.modal::-webkit-scrollbar { width: 8px; }
.modal::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 12px;
}
.modal-head h2 { font-size: 16px; font-weight: 650; }

.modal-body { display: flex; flex-direction: column; gap: 14px; padding: 6px 22px 20px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 11.5px; color: var(--muted); letter-spacing: 0.3px; }
.field input, .field select, .field textarea { background: var(--surface-2); width: 100%; }
.field textarea { resize: vertical; line-height: 1.6; }
.field input[type="color"] { height: 38px; padding: 3px; cursor: pointer; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field.checkbox-field { flex-direction: row; align-items: center; gap: 8px; }
.field.checkbox-field input[type="checkbox"] { width: auto; height: 16px; accent-color: #4f46e5; }
.field.checkbox-field > span { font-size: 12.5px; color: var(--text-soft); }

.readonly-note {
  display: flex; gap: 8px; align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.comments { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.comments-head { display: flex; align-items: baseline; gap: 8px; }
.comments-head h3 { font-size: 13px; font-weight: 600; }
.comment-list { display: flex; flex-direction: column; gap: 12px; max-height: 220px; overflow-y: auto; }
.comment-item { display: flex; gap: 9px; }
.comment-body { flex: 1; min-width: 0; }
.comment-meta {
  display: flex; gap: 8px; align-items: baseline;
  font-size: 11.5px; color: var(--muted); margin-bottom: 4px;
}
.comment-meta b { font-size: 12.5px; color: var(--text); font-weight: 550; }
.comment-text {
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
}
.worklog-list { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; }
.worklog-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--surface-2); font-size: 12.5px;
}
.worklog-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.worklog-hours { color: var(--text); font-weight: 600; }
.worklog-note { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.worklog-member { font-size: 11.5px; }
.worklog-form { display: flex; gap: 8px; flex-wrap: wrap; }
.worklog-form input[name="hours"] { width: 88px; }
.worklog-form input[name="note"] { flex: 1; min-width: 140px; }
.burndown-card { margin-top: 16px; }
.burn-stats { display: flex; align-items: flex-start; gap: 30px; margin: 8px 0 10px; }
.burn-stats > div {
  display: flex; flex-direction: column; gap: 1px;
  min-width: 72px; font-size: 11.5px; color: var(--muted);
}
.burn-stats strong {
  font-size: 20px; font-weight: 650; color: var(--text);
  line-height: 1.15; font-variant-numeric: tabular-nums;
}
.burn-stats strong em {
  margin-left: 5px; font-size: 11px; font-style: normal;
  font-weight: 500; color: var(--muted);
}
.burn-head-extra { display: inline-flex; align-items: center; gap: 18px; }
.burn-head-extra > span { font-size: 12px; color: var(--muted); }
.burn-legend { display: inline-flex; align-items: center; gap: 14px; font-size: 11.5px; }
.chart-box.burn-chart { height: 200px; margin-top: 4px; }
.burn-dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; margin-right: 5px; }
.burn-dot.actual { background: var(--accent); }
.burn-dot.scope { background: #94a3b8; }
.burn-dot.ideal { background: var(--muted); opacity: 0.7; }
.comment-actions { display: none; gap: 2px; margin-left: auto; }
.comment-item:hover .comment-actions { display: inline-flex; }
.comment-edit {
  width: 100%; min-height: 56px; resize: vertical;
  padding: 8px 10px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface);
  font: inherit; font-size: 12.5px; line-height: 1.6; color: var(--text);
}
.comment-edit-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.attachment-thumb {
  width: 30px; height: 30px; border-radius: 6px;
  object-fit: cover; border: 1px solid var(--border); flex: none;
}
.tiny-pill { font-size: 10.5px; padding: 1px 7px; }
.comment-form { display: flex; gap: 8px; }
.comment-form input { flex: 1; }
.comment-empty { font-size: 12px; color: var(--muted); padding: 6px 2px; }

.activity-list { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.activity-item {
  display: flex; gap: 9px; align-items: baseline;
  padding: 7px 2px; font-size: 12.5px;
}
.activity-item + .activity-item { border-top: 1px dashed var(--border); }
.activity-item .act-actor { font-weight: 550; color: var(--text); }
.activity-item .act-action { color: var(--text-soft); }
.activity-item .act-detail {
  color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 260px; display: inline-block; vertical-align: bottom;
}
.activity-item time { margin-left: auto; flex: none; font-size: 11.5px; color: var(--muted); }

/* 通知中心 */
.notify-wrap { position: relative; }
.notify-btn { position: relative; }
.notify-badge {
  position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 99px;
  background: #ef4444; color: #fff;
  font-size: 10px; line-height: 16px; font-weight: 600;
  text-align: center; box-shadow: 0 0 0 2px var(--surface);
}
.notify-panel {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 60;
  width: 340px; max-width: calc(100vw - 32px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-bg);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}
.notify-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.notify-head .mini-btn { width: auto; padding: 0 8px; height: 22px; font-size: 11.5px; }
.notify-list { max-height: 380px; overflow-y: auto; }
.notify-item {
  display: block; width: 100%; text-align: left;
  padding: 11px 14px; border: 0; background: transparent;
  border-bottom: 1px solid var(--border);
  cursor: pointer; color: var(--text);
}
.notify-item:hover { background: var(--surface-hover); }
.notify-item.unread { background: var(--accent-soft); }
.notify-item .n-title { font-size: 12.5px; font-weight: 550; }
.notify-item .n-body {
  margin-top: 3px; font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.notify-item .n-meta { margin-top: 4px; font-size: 11px; color: var(--muted); display: flex; gap: 6px; }
.notify-empty { padding: 22px 14px; text-align: center; font-size: 12px; color: var(--muted); }

.modal-foot { display: flex; align-items: center; gap: 10px; padding-top: 6px; }
.spacer { flex: 1; }

/* ============================================================ 其他 */

.toast {
  position: fixed; left: 50%; bottom: 28px;
  transform: translate(-50%, 20px);
  padding: 11px 20px;
  border-radius: 11px;
  border: 1px solid var(--toast-border);
  background: var(--toast-bg);
  color: var(--toast-fg);
  font-size: 13px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 90;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error {
  border-color: var(--toast-err-border);
  background: var(--toast-err-bg);
  color: var(--toast-err-fg);
}

.empty { padding: 60px 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* 首屏骨架屏，避免加载期间整页空白 */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}
.skeleton::after {
  content: "";
  position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.18), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skeleton-kpi { height: 112px; }
.skeleton-panel { height: 280px; }

.boot-fallback {
  position: fixed; left: 50%; bottom: 24px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  border: 1px solid var(--danger-border);
  border-radius: 12px;
  background: var(--toast-err-bg);
  color: var(--toast-err-fg);
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 95;
}

/* ============================================================ 登录页 */

.auth-body {
  display: grid; place-items: center;
  min-height: 100vh; padding: 28px;
}

.auth-shell {
  display: grid;
  grid-template-columns: 1.02fr 1fr;
  width: min(960px, 100%);
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-brand {
  position: relative;
  padding: 44px 40px;
  display: flex; flex-direction: column; gap: 18px;
  color: #fff;
  background: linear-gradient(150deg, #4f46e5, #7c3aed 55%, #2563eb);
  overflow: hidden;
}
.auth-brand::after {
  content: "";
  position: absolute; right: -70px; bottom: -90px;
  width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
}
.auth-brand .logo { background: rgba(255, 255, 255, 0.18); box-shadow: none; backdrop-filter: blur(4px); }
.auth-brand h1 { font-size: 26px; font-weight: 700; letter-spacing: 0.2px; }
.auth-brand p { font-size: 13.5px; line-height: 1.75; color: rgba(255, 255, 255, 0.86); max-width: 320px; }
.auth-points {
  margin: auto 0 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 10px;
  font-size: 12.5px; color: rgba(255, 255, 255, 0.9);
}
.auth-points li { display: flex; gap: 8px; align-items: center; }
.auth-points li::before {
  content: ""; width: 6px; height: 6px; border-radius: 99px;
  background: rgba(255, 255, 255, 0.75); flex: none;
}

.auth-panel {
  padding: 44px 40px;
  display: flex; flex-direction: column; gap: 18px;
}
.auth-head h2 { font-size: 22px; font-weight: 700; letter-spacing: 0.2px; }
.auth-head p { margin-top: 6px; font-size: 12.5px; color: var(--muted); }

#loginForm { display: flex; flex-direction: column; gap: 14px; }
.auth-submit { width: 100%; justify-content: center; height: 42px; margin-top: 4px; }
.auth-error {
  padding: 10px 12px;
  border: 1px solid var(--danger-border);
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12.5px;
}

.auth-theme {
  align-self: flex-start;
  border: 0; background: none; padding: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.auth-theme:hover { color: var(--text); }

/* ============================================================ 响应式 */

@media (max-width: 1180px) {
  .dash-grid, .dash-grid.equal { grid-template-columns: minmax(0, 1fr); }
  .kanban { grid-template-columns: repeat(2, minmax(240px, 1fr)); }
}

/* 笔记本窄屏：搜索框收窄，把空间让给标题与「新建任务」 */
@media (max-width: 1024px) {
  .search { flex-basis: 150px; }
}

/* 平板 / 手机：侧边栏改为抽屉 */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: min(78vw, 300px);
    height: 100vh;
    height: 100dvh;
    z-index: 60;
    padding: 20px 14px 18px;
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    border-right: 1px solid var(--border);
    border-bottom: 0;
    overflow-y: auto;
    box-shadow: 18px 0 40px rgba(15, 23, 42, 0.18);
  }
  .sidebar.open { transform: none; }

  .sidebar-overlay {
    display: block;
    position: fixed; inset: 0;
    z-index: 55;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .sidebar-overlay.show { opacity: 1; pointer-events: auto; }

  .nav { flex-direction: column; }
  .nav-item { padding: 12px; }

  .mobile-menu-btn { display: grid; }

  .topbar {
    position: sticky; top: 0;
    flex-wrap: wrap; gap: 12px;
    padding: 12px 16px;
  }
  .topbar-left { flex: 1; }
  .topbar-left h1 { font-size: 18px; }
  .topbar-left p { max-width: 100%; font-size: 12px; }
  .topbar-right { width: 100%; gap: 8px; }
  .search { flex: 1; min-width: 0; }
  .search input { width: 100%; }
  .avatar-stack { display: none; }

  .view { padding: 16px 14px 56px; }
  .project-hero { flex-direction: column; padding: 18px 16px; }
  .hero-side { flex-wrap: wrap; width: 100%; }
  .mini-kpi { flex: 1; min-width: 0; }
  .grid2 { grid-template-columns: 1fr; }
  .board-actions { width: 100%; }
  .board-actions select { flex: 1; min-width: 0; }
  .modal { width: min(720px, 100%); }
}

/* 手机：看板横向滑动、弹窗贴底 */
@media (max-width: 760px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px 15px; }
  .kpi-value { font-size: 24px; }
  .kpi-hint { font-size: 11px; }

  .kanban {
    grid-auto-flow: column;
    grid-auto-columns: minmax(78vw, 1fr);
    grid-template-columns: none;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .kanban-col { scroll-snap-align: start; }
  .col-body { max-height: 56vh; }

  .btn-label { display: none; }
  .topbar-right .btn.primary { padding: 0 12px; }

  .result-row { align-items: flex-start; }
  .member-grid { grid-template-columns: minmax(0, 1fr); }

  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
  }
  .modal-head { padding: 16px 18px 10px; }
  .modal-body { padding: 4px 18px calc(26px + env(safe-area-inset-bottom)); }
  .modal-foot { flex-wrap: wrap; }
  .comment-form { flex-direction: column; }

  .sidebar {
    width: min(86vw, 320px);
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }
  .auth-body { padding: 14px; }
  .auth-panel { padding: 24px 20px; }
  .auth-brand { padding: 22px 20px; }
  .auth-brand h1 { font-size: 20px; }
}

@media (max-width: 820px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { padding: 26px; }
  .auth-brand h1 { font-size: 22px; }
  .auth-points { display: none; }
  .auth-panel { padding: 26px; }
}

/* 设置页开关 */
.check-row {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 0 8px;
  font-size: 13px; color: var(--text-soft);
  cursor: pointer;
}
.check-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

/* ============================================================ 周报卡片 */
.report-card { padding: 0; overflow: hidden; }
.report-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 22px 14px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(16, 185, 129, 0.06));
  border-bottom: 1px solid var(--border);
}
.report-head h3 { margin: 0; font-size: 16px; letter-spacing: 0.3px; }
.report-meta {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: 8px; font-size: 11.5px; color: var(--text-soft);
}
.report-stamp {
  flex: none;
  padding: 4px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  color: var(--accent);
}
.md-body { padding: 8px 22px 6px; font-size: 13.5px; line-height: 1.9; color: var(--text-soft); }
.md-body h2 {
  margin: 18px 0 8px; padding-left: 10px;
  border-left: 3px solid var(--accent);
  font-size: 14.5px; color: var(--text);
}
.md-body h3 {
  margin: 16px 0 6px; padding-left: 9px;
  border-left: 3px solid var(--accent);
  font-size: 13.5px; color: var(--text);
}
.md-body h4 { margin: 14px 0 4px; font-size: 13px; color: var(--text); }
.md-body p { margin: 6px 0; }
.md-body ul, .md-body ol { margin: 6px 0; padding-left: 20px; }
.md-body li { margin: 4px 0; }
.md-body li::marker { color: var(--accent); }
.md-body strong { color: var(--text); font-weight: 600; }
.md-body code { padding: 1px 5px; border-radius: 4px; background: var(--surface-3); font-size: 12px; }
.report-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 22px 6px;
  border-top: 1px dashed var(--border);
}
.report-foot p { margin: 0; font-size: 12px; }
.report-note { margin: 6px 0 0; padding: 0 22px 16px; font-size: 12px; }
.pill.ok { background: rgba(16, 185, 129, 0.14); color: var(--ok); border-color: rgba(16, 185, 129, 0.35); }

/* 周报：成员产出 */
.member-output {
  display: grid;
  grid-template-columns: 96px minmax(60px, 1fr) 64px;
  align-items: center;
  gap: 14px;
  padding: 12px 2px;
}
.member-output + .member-output { border-top: 1px solid var(--border); }
.mo-main strong { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.mo-main span { font-size: 11.5px; color: var(--muted); }
.mo-bar {
  height: 6px; border-radius: 99px; overflow: hidden;
  background: var(--surface-3);
}
.mo-bar i {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), #22c55e);
  transition: width 0.4s ease;
}
.mo-value { text-align: right; white-space: nowrap; }
.mo-value b {
  font-size: 19px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.mo-value span { margin-left: 3px; font-size: 11px; color: var(--muted); }

/* ============================================================ 趋势图 / 个人统计 */
.trend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.trend-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px 8px;
  background: var(--surface-2);
}
.trend-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-bottom: 8px; font-size: 12.5px; color: var(--muted);
}
.trend-head b { font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-box { position: relative; width: 100%; height: 128px; margin-top: 4px; }
.chart-box .chart { width: 100%; height: 100%; }
.chart-empty {
  display: grid; place-items: center;
  min-height: 128px; font-size: 12px; color: var(--muted);
  border: 1px dashed var(--border); border-radius: 9px; margin-top: 4px;
}

.my-stats { margin-bottom: 16px; }
.my-stats-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px; align-items: end;
}
.my-stats-body .mini-kpi-row { margin-bottom: 0; }
@media (max-width: 900px) {
  .my-stats-body { grid-template-columns: minmax(0, 1fr); }
}
.mini-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px; margin-bottom: 12px;
}
.mini-kpi-block {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.mini-kpi-block span { font-size: 11.5px; color: var(--muted); }
.mini-kpi-block strong { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; }
.mini-kpi-block em { font-size: 11px; color: var(--muted); font-style: normal; }
.trend-inline .chart-box { height: 112px; margin-top: 6px; }
.export-period { height: 32px; padding: 0 8px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }

/* ============================================================ 看板增强 */
.seg {
  display: inline-flex; padding: 2px; gap: 2px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2);
}
.seg button {
  border: 0; background: transparent; color: var(--muted);
  padding: 4px 10px; border-radius: 7px; font-size: 12px; cursor: pointer;
}
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12); }

.board-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.wip {
  margin-left: 4px; font-size: 11px; padding: 1px 6px; border-radius: 99px;
  background: var(--surface-3); color: var(--muted); font-variant-numeric: tabular-nums;
}
.wip.over { background: rgba(239, 68, 68, 0.16); color: #ef4444; font-weight: 600; }
.kanban-col.wip-over { border-color: rgba(239, 68, 68, 0.45); }
.kanban-col.wip-over header { color: #ef4444; }

.swimlane { margin-bottom: 16px; }
.swimlane-head {
  display: flex; align-items: baseline; gap: 8px;
  padding: 4px 2px 8px; font-size: 12.5px; color: var(--muted);
}
.swimlane-head strong { font-size: 13px; color: var(--text); }
.ms-chip-progress {
  font-size: 10.5px; padding: 0 5px; border-radius: 99px;
  background: var(--surface-3); color: var(--muted);
}

/* ============================================================ 甘特图 */
.gantt-card { overflow: hidden; }
.gantt { position: relative; }
.gantt-scale {
  position: relative; height: 22px; margin-left: 220px;
  border-bottom: 1px solid var(--border);
}
.gantt-tick {
  position: absolute; top: 4px; height: 14px;
  border-left: 1px dashed var(--border);
}
.gantt-tick em {
  position: absolute; left: 3px; top: -2px;
  font-style: normal; font-size: 10.5px; color: var(--muted);
}
.gantt-today-line {
  position: absolute; top: 0; bottom: -1000px; width: 2px;
  background: rgba(239, 68, 68, 0.55); z-index: 1;
}
.gantt-rows { position: relative; }
.gantt-grid-layer { position: absolute; top: 0; bottom: 0; left: 220px; right: 0; pointer-events: none; }
.gantt-grid-layer span { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--border); opacity: 0.75; }
.gantt-row {
  display: grid; grid-template-columns: 220px minmax(0, 1fr);
  align-items: center; padding: 5px 0;
  border-bottom: 1px dashed var(--border);
}
.gantt-row:last-child { border-bottom: 0; }
.gantt-label { display: flex; align-items: center; gap: 7px; padding-right: 12px; min-width: 0; }
.gantt-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-owner { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; }
.gantt-track { position: relative; height: 22px; }
.gantt-bar {
  position: absolute; top: 6px; height: 10px; border-radius: 5px;
  opacity: 0.9; min-width: 4px;
}
.gantt-bar.done { opacity: 0.42; }
.gantt-due {
  position: absolute; top: 3px; transform: translateX(4px);
  font-size: 10.5px; color: var(--muted); white-space: nowrap;
}
.gantt-ms {
  position: absolute; top: 4px; width: 11px; height: 11px;
  background: var(--accent); transform: rotate(45deg); border-radius: 2px;
}
.gantt-row.milestone .gantt-name { color: var(--accent); font-weight: 550; }
.gantt-row[data-task] { cursor: pointer; }
.gantt-row[data-task]:hover { background: var(--surface-hover); }

/* ============================================================ 日历 */
.cal-head {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding-bottom: 12px;
}
.cal-week {
  display: grid; grid-template-columns: repeat(7, 1fr);
  font-size: 11.5px; color: var(--muted); text-align: center;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  border-left: 1px solid var(--border); border-top: 1px solid var(--border);
}
.cal-cell {
  min-height: 88px; padding: 6px;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 3px;
  background: var(--surface);
}
.cal-cell.blank { background: var(--surface-2); }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--accent-soft); }
.cal-date { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-cell.today .cal-date { color: var(--accent); font-weight: 700; }
.cal-task {
  font-size: 11px; line-height: 1.35; padding: 2px 5px;
  border-left: 2px solid var(--accent); border-radius: 4px;
  background: var(--surface-2); cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-task.s-done { opacity: 0.55; text-decoration: line-through; }
.cal-task:hover { background: var(--surface-hover); }
.cal-ms { font-size: 10.5px; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-more { font-size: 10.5px; color: var(--muted); }

@media (max-width: 720px) {
  .gantt-row { grid-template-columns: 130px minmax(0, 1fr); }
  .gantt-scale { margin-left: 130px; }
  .gantt-grid-layer { left: 130px; }
  .cal-cell { min-height: 68px; }
}

/* ============================================================ 设置页分区 */
.settings-block { margin-bottom: 30px; }
.settings-block:last-child { margin-bottom: 0; }
.settings-head { margin-bottom: 12px; }
.settings-head h2 { font-size: 16px; font-weight: 650; letter-spacing: 0.2px; }
.settings-head p { margin-top: 4px; font-size: 12.5px; }
.member-actions.mcp-actions .btn { flex: 0 0 auto; }
.tool-details summary {
  display: flex; align-items: baseline; gap: 8px;
  cursor: pointer; list-style: none; padding: 2px 0;
}
.tool-details summary::-webkit-details-marker { display: none; }
.tool-details summary h3 { font-size: 13px; font-weight: 600; }
.tool-details summary::after {
  content: '展开'; margin-left: auto; font-size: 12px; color: var(--muted);
}
.tool-details[open] summary::after { content: '收起'; }
.tool-details[open] summary { margin-bottom: 12px; }
.settings-note { font-size: 12.5px; margin-top: -14px; margin-bottom: 24px; }

/* ============================================================ 回收站 / 分页 */
.trash-list { display: flex; flex-direction: column; }
.trash-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 2px; border-bottom: 1px dashed var(--border);
}
.trash-row:last-child { border-bottom: 0; }
.trash-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.trash-main strong {
  font-size: 13px; font-weight: 550;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.trash-main span { font-size: 11.5px; color: var(--muted); }
.btn.danger { color: #ef4444; border-color: rgba(239, 68, 68, 0.4); }
.btn.danger:hover { background: rgba(239, 68, 68, 0.1); }
.load-more { display: flex; justify-content: center; padding: 18px 0; }

/* ============================================================ 客户（按客户组织项目） */
.side-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.side-group-head {
  display: flex; align-items: center; gap: 7px;
  width: 100%; padding: 6px 8px;
  border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--muted);
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.3px;
  text-align: left; cursor: pointer;
}
.side-group-head:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.side-group-head.active { background: var(--accent-soft); border-color: var(--accent-border); color: var(--text); }
.side-group-head:disabled { cursor: default; }
.sg-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-count { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-group .side-project { padding-left: 20px; }

.customer-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px;
}
.customer-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface-2); cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.customer-card:hover { border-color: var(--accent-border); background: var(--surface-hover); transform: translateY(-1px); }
.cc-head { display: flex; align-items: flex-start; gap: 10px; }
.cc-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cc-title strong {
  font-size: 14.5px; font-weight: 650;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cc-title span {
  font-size: 11.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.cc-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--muted); }
.cc-pct { font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }

.customer-project-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px;
}
.customer-project {
  display: flex; flex-direction: column; gap: 9px;
  padding: 15px 16px; border: 1px solid var(--border); border-radius: 13px;
  background: var(--surface-2); cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.customer-project:hover { border-color: var(--accent-border); background: var(--surface-hover); transform: translateY(-1px); }
.cp-head { display: flex; align-items: center; gap: 8px; }
.cp-head strong {
  flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cp-head .pill { flex: none; }
.cp-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 11.5px; color: var(--muted); }
.cp-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--muted); }

.customer-hero { display: flex; gap: 24px; padding: 22px 24px; }
.hero-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.customer-pill {
  cursor: pointer;
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--text);
}
.customer-pill:hover { background: var(--surface-hover); }
.pill.muted { color: var(--muted); border-color: var(--border); background: transparent; }

@media (max-width: 900px) {
  .customer-grid,
  .customer-project-grid { grid-template-columns: 1fr; }
  .customer-hero { flex-direction: column; gap: 16px; }
  .hero-actions { margin-left: 0; flex-wrap: wrap; }
}
