/* ============================================================
   ProjectHub 主题样式 —— 科技感 · 浅色蓝紫
   ============================================================ */
:root {
  /* 基础色 */
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8f0;
  --border-soft: #eef2f8;
  --text: #16213a;
  --text-2: #4a5573;
  --text-3: #8a93a8;

  /* 主色 · 科技蓝紫 */
  --primary: #4f46e5;
  --primary-soft: #eef2ff;
  --primary-dark: #4338ca;
  --violet: #a78bfa;
  --violet-soft: #ede8fe;
  --primary-grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #a78bfa 100%);

  /* 状态色 */
  --danger: #4338ca;
  --danger-soft: #eef2ff;
  --warn: #7c3aed;
  --warn-soft: #f5f3ff;
  --ok: #4f46e5;
  --ok-soft: #eef2ff;

  /* 背景光晕 */
  --bg-glow:
    radial-gradient(900px 460px at 88% -6%, rgba(79, 70, 229, .10), transparent 60%),
    radial-gradient(760px 420px at -6% 106%, rgba(139, 92, 246, .12), transparent 60%),
    var(--bg);

  /* 圆角 / 阴影 */
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .07);
  --shadow: 0 2px 4px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .08);
  --shadow-lg: 0 14px 40px rgba(22, 33, 58, .15);
  --shadow-glow: 0 4px 18px rgba(79, 70, 229, .28);

  --font: "Segoe UI", "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
* { -webkit-tap-highlight-color: transparent; }
/* 关键：作者样式里的 display（如 .login-screen{display:flex}）会覆盖浏览器对
   hidden 属性默认的 display:none，导致「隐藏」失效。这条兜底保证 hidden 始终生效。 */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--text);
  background: var(--bg-glow);
  font-size: 14px; line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 13.5px; }
::selection { background: #d9e0fb; color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c7d0de; border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #a8b1c2; }

/* ---------- 布局 ---------- */
body { display: flex; min-height: 100vh; }
.sidebar {
  width: 244px; display: flex; flex-direction: column;
  background: linear-gradient(160deg, #0f1522 0%, #141c2e 55%, #0d121e 100%);
  color: #94a3b8; position: sticky; top: 0; height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, .05);
}
.logo {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 18px; border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.logo-mark {
  width: 40px; height: 40px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--primary-grad);
  border-radius: 12px;
  box-shadow: var(--shadow-glow);
  color: #fff;
}
.logo-svg { display: block; }
.logo-text { display: flex; flex-direction: column; }
.logo-name { color: #fff; font-size: 16px; font-weight: 700; letter-spacing: .2px; }
.logo-sub { color: #64748b; font-size: 11.5px; margin-top: 1px; }

.nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; border-radius: 10px;
  color: #94a3b8; font-size: 13.5px;
  transition: background .18s, color .18s;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #e2e8f0; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, .20) 0%, rgba(139, 92, 246, .10) 60%, transparent 100%);
  color: #c7d2fe;
}
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 3px;
  background: var(--primary-grad);
}
.nav-icon {
  width: 20px; height: 20px; flex-shrink: 0;
  display: grid; place-items: center;
  transition: transform .18s;
}
.nav-icon svg { display: block; }
.nav-item:hover .nav-icon, .nav-item.active .nav-icon { transform: scale(1.08); }

.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .07); }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px;
  background: rgba(255, 255, 255, .05); transition: background .18s;
}
.user-chip:hover { background: rgba(255, 255, 255, .09); }
.user-chip .avatar { border: 2px solid rgba(255, 255, 255, .25); }
.user-name { color: #e2e8f0; font-size: 13px; font-weight: 600; }
.user-role { color: #64748b; font-size: 11px; margin-top: 1px; }

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

/* ---------- 顶部栏 ---------- */
.app-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 22px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; z-index: 30;
}
.header-left { min-width: 0; }
.page-title {
  display: flex; align-items: center; gap: 9px;
  font-size: 20px; font-weight: 700; margin: 0; letter-spacing: .2px;
}
.page-title::before {
  content: ""; display: inline-block;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--primary-grad);
  box-shadow: var(--shadow-glow);
}
.page-sub { color: var(--text-3); font-size: 13px; margin: 2px 0 0; }
.header-right { display: flex; align-items: center; gap: 10px; }

.search-box {
  position: relative; display: flex; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px 8px 32px;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.search-box:hover { border-color: #cbd5e1; }
.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  background: #fff;
}
.search-ico { position: absolute; left: 10px; color: var(--text-3); font-size: 13px; }
.search-box input {
  border: none; outline: none; background: transparent; padding: 0; width: 210px; color: var(--text);
}
.search-box input::placeholder { color: var(--text-3); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600;
  transition: all .15s; white-space: nowrap;
}
.btn-primary {
  background: var(--primary-grad);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), var(--shadow-sm);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca, #6d28d9);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), var(--shadow);
}
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  color: var(--text-2); border: 1px solid var(--border); background: var(--surface);
}
.btn-ghost:hover {
  border-color: #c3ccd9; color: var(--text);
  background: var(--surface-2);
  box-shadow: var(--shadow-sm); transform: translateY(-1px);
}
.btn-danger { color: var(--danger); border: 1px solid #d9e0fb; background: #f3efff; }
.btn-danger:hover { background: #ede8fe; color: var(--danger); font-weight: 700; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }

/* ---------- 内容区 ---------- */
.content { flex: 1; padding: 20px 22px; overflow-y: auto; min-width: 0; }
#view-root.view-in { animation: viewIn .30s cubic-bezier(.2, .7, .2, 1) both; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; letter-spacing: .3px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  transition: transform .18s, box-shadow .18s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 4px; }
.card-sub { color: var(--text-3); font-size: 12.5px; margin: 0; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex; font-size: 11.5px; font-weight: 600;
  padding: 3px 8px; border-radius: 999px;
  background: #eef1f7; color: #64748b;
  transition: all .15s;
}
.tag--code {
  background: linear-gradient(135deg, var(--violet-soft), #e7e0ff);
  color: #5b4b99;
  border: 1px solid #ddd5f7;
}

/* ---------- 进度条 ---------- */
.progress { height: 8px; border-radius: 999px; background: #e8ecef; overflow: hidden; margin-top: 8px; }
.progress > span {
  display: block; height: 100%; border-radius: 999px;
  background-image: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35) 50%, transparent);
  transition: width .5s ease;
}

/* ---------- 项目网格 ---------- */
.grid { display: grid; gap: 14px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.stack-avatars { display: flex; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; color: #fff; font-weight: 700;
  margin-left: -10px; border: 2px solid var(--surface);
}
.stack-avatars:first-of-type { margin-left: 0; }

/* ---------- 表格 ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left; padding: 11px 14px; font-size: 13px;
  border-bottom: 1px solid var(--border-soft); vertical-align: middle;
}
th {
  background: linear-gradient(180deg, #f8f9fd, #f2f4fa);
  color: var(--text-2); font-weight: 700; font-size: 12px;
  letter-spacing: .4px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9);
}
tbody tr { transition: background .15s; }
tbody tr:nth-child(even) { background: #fafbfe; }
tbody tr:hover { background: #eef3ff; }
td .row-actions { display: flex; gap: 6px; }
.link { color: var(--primary); font-weight: 600; }
.link:hover { text-decoration: underline; }

/* ---------- 筛选下拉 ---------- */
.filter-select {
  appearance: none; -webkit-appearance: none;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238a93a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
  border: 1px solid var(--border); border-radius: 9px;
  padding: 7px 30px 7px 11px;
  font-size: 13px; color: var(--text-2); cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.filter-select:hover { border-color: #c3ccd9; }
.filter-select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft); background-color: #fff;
}
.filter-select option { color: var(--text); }

/* ---------- 看板 ---------- */
.kanban-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.kanban-projects { display: flex; gap: 8px; flex-wrap: wrap; }
.proj-chip {
  padding: 7px 13px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer; transition: all .15s;
}
.proj-chip:hover { border-color: var(--primary); color: var(--primary); box-shadow: var(--shadow-sm); }
.proj-chip.active {
  background: var(--primary-grad);
  border-color: transparent; color: #fff;
  box-shadow: var(--shadow-glow);
}

.board { display: flex; gap: 14px; align-items: stretch; height: calc(100vh - 185px); min-height: 420px; overflow-x: auto; overflow-y: hidden; }
.column {
  --col: #64748b;
  background: #f4f6fc;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 14px; min-width: 230px; flex: 1;
  display: flex; flex-direction: column; height: 100%; max-width: 300px;
  position: relative; overflow: hidden;
  transition: box-shadow .18s, border-color .18s, transform .18s;
}
.column::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--col) 0%, transparent 70%);
}
.column.drag-over {
  box-shadow: inset 0 0 0 3px var(--col);
  border-color: var(--col);
  transform: translateY(1px);
}
.column-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.column-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .12)); }
.count {
  font-size: 11.5px; font-weight: 700; color: var(--text-2);
  background: #fff; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border-soft); box-shadow: var(--shadow-sm);
}
.column-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
/* Kanban WIP 超限：红框脉冲，提示"别同时开太多" */
.column.wip-over {
  border-color: var(--danger);
  animation: wipPulse 1s ease-in-out infinite;
}
.column.wip-over::before {
  background: linear-gradient(90deg, var(--danger) 0%, transparent 70%);
}
.column.wip-over .count {
  color: var(--danger); background: #f3efff; border-color: #d9e0fb;
}
@keyframes wipPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(67, 56, 202, .08), var(--shadow-sm); }
  50% { box-shadow: 0 0 0 3px rgba(67, 56, 202, .20), var(--shadow-sm); }
}

/* 任务卡片 · 左侧优先级色条 + 错峰入场 */
.task-card {
  --accent: #94a3b8;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px; padding: 12px;
  cursor: grab; position: relative;
  transition: transform .18s, box-shadow .18s, border-color .18s;
  box-shadow: inset 3px 0 0 var(--accent), var(--shadow-sm);
  animation: rise .35s cubic-bezier(.2, .7, .2, 1) both;
}
.task-card:hover {
  transform: translateY(-2px);
  border-color: #dbe0ec;
  box-shadow: inset 3px 0 0 var(--accent), var(--shadow);
}
.task-card.dragging { opacity: .5; border-style: dashed; }
.task-title { font-size: 13.5px; font-weight: 600; margin-bottom: 6px; word-break: break-all; }
.task-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-due { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 4px; }
.task-due.overdue { color: var(--danger); font-weight: 600; }
.task-assignee { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-2); margin-left: auto; }
.task-actions { display: flex; gap: 4px; margin-top: 8px; }

/* 列底部新建按钮 */
.col-add {
  width: auto; height: auto;
  padding: 6px 12px; border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  transition: all .18s;
}
.col-add:hover {
  border-color: var(--primary); color: var(--primary);
  box-shadow: var(--shadow-glow); transform: translateY(-1px);
}

/* 图标按钮 */
.icon-btn {
  width: 24px; height: 24px; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 12px; color: var(--text-3);
  background: var(--surface-2); border: 1px solid transparent;
  transition: all .15s;
}
.icon-btn:hover { background: #e8ebf2; color: #334155; border-color: #dbe0ec; transform: translateY(-1px); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.drag-ghost { display: none; }

/* ---------- 统计 ---------- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.stat {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
  transition: transform .18s, box-shadow .18s;
}
.stat::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--stat-c, var(--primary)), transparent);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-ico {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 11px;
  display: grid; place-items: center;
  font-size: 19px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5);
}
.stat-body { flex: 1; min-width: 0; }
.stat-num { font-size: 26px; font-weight: 800; line-height: 1; }
.stat-label { color: var(--text-3); font-size: 12.5px; margin-top: 4px; }
.stat .up { color: var(--ok); font-size: 12px; font-weight: 600; }

/* 条形图 */
.bars { display: flex; flex-direction: column; gap: 13px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr auto; align-items: center; gap: 10px; }
.bar-track { height: 14px; border-radius: 999px; background: #eef1f7; overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 999px;
  background-image: linear-gradient(90deg, transparent, rgba(255, 255, 255, .30) 50%, transparent);
}
.bar-val { font-size: 12.5px; font-weight: 700; color: var(--text-2); }

/* 子项目块 */
.sp-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.sp-item:last-child { border-bottom: none; }
.sp-item .sp-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; word-break: break-all; }
.sp-progress { width: 90px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- 项目卡片 ---------- */
.proj-card { position: relative; overflow: hidden; animation: rise .35s cubic-bezier(.2, .7, .2, 1) both; }
.proj-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--violet));
}
.proj-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; flex-wrap: wrap; }
.proj-name { font-size: 16px; font-weight: 700; margin: 0 0 2px; letter-spacing: .1px; }
.proj-owner { font-size: 12.5px; color: var(--text-3); margin: 0; display: flex; align-items: center; gap: 5px; }

/* ---------- 模态框 ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 16, 30, .45); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; animation: fade .18s;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(10, 16, 30, .28);
  width: min(560px, 92vw); max-height: 85vh;
  display: flex; flex-direction: column;
  animation: pop .18s;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #f9fafd, #fff);
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 9px;
  color: var(--text-3); font-size: 20px;
  display: grid; place-items: center; transition: all .15s;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); transform: rotate(90deg); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--border-soft);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ---------- 表单 ---------- */
.form { display: grid; gap: 14px; }
.field { display: grid; }
.field label {
  font-size: 12.5px; font-weight: 700; color: var(--text-2);
  margin-bottom: 5px; display: flex; align-items: center; gap: 5px;
}
.field label .req::before { content: "*"; color: var(--danger); margin-right: 2px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-2);
  transition: all .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft); background: #fff;
}
.field textarea { resize: vertical; min-height: 64px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- 抽屉 ---------- */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 16, 30, .35); display: flex; justify-content: flex-end;
  z-index: 90; animation: fade .18s;
}
.drawer-backdrop[hidden] { display: none; }
.drawer {
  width: 440px; max-width: 92vw; height: 100%;
  background: var(--surface);
  box-shadow: -8px 0 30px rgba(10, 16, 30, .3);
  animation: slide .2s; display: flex; flex-direction: column;
}
.drawer-head { padding: 16px 20px; border-bottom: 1px solid var(--border-soft); display: flex; justify-content: space-between; align-items: flex-start; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.field-detail { margin-bottom: 14px; }
.field-detail .k { font-size: 12px; color: var(--text-3); font-weight: 700; margin-bottom: 3px; letter-spacing: .3px; }
.field-detail .v { font-size: 13.5px; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-soft);
  font-size: 13.5px; font-weight: 600; color: var(--text);
  animation: slide .25s;
}
.toast-ico {
  width: 24px; height: 24px; flex-shrink: 0;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.toast.ok .toast-ico { background: var(--ok); }
.toast.error .toast-ico { background: var(--danger); }
.toast.warn .toast-ico { background: var(--warn); }

/* ---------- 空状态 ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 40px 20px;
  color: var(--text-3); text-align: center;
  background: rgba(79, 70, 229, .03);
  border: 1px dashed #dbe0ec;
  border-radius: var(--radius-lg);
}
.empty .ico { font-size: 40px; filter: saturate(.9); }
.empty h3 { font-size: 16px; font-weight: 700; color: var(--text-2); margin: 0; }
.empty p { font-size: 13px; margin: 0; }

/* ---------- 焦点 ---------- */
button:focus-visible, a:focus-visible, .proj-chip:focus-visible {
  outline: 3px solid var(--primary-soft);
  outline-offset: 2px;
}

/* ---------- 动画 ---------- */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes slide { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .logo-text, .nav-item span:last-child, .user-name, .user-role { display: none; }
  .app-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .header-right { justify-content: space-between; }
  .search-box input { width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .board { height: calc(100vh - 210px); }
}

/* ============================================================
   Sprint 迭代（Scrum）+ 燃尽图
   ============================================================ */
.sprint-top {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin: 0 0 8px;
}
.sprint-top h3 { font-size: 15px; line-height: 1.3; }
.sprint-dates { font-size: 12px; color: var(--text-3); margin: 0 0 10px; }
.sprint-count { font-size: 12.5px; color: var(--text-2); font-weight: 600; margin-top: 10px; }
.sprint-detail { margin-top: 16px; }
.sprint-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.sprint-head h3 { font-size: 16px; line-height: 1.3; margin-bottom: 0; }
.burndown-wrap {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 10px 4px; margin: 10px 0 14px;
}
.burndown { width: 100%; height: auto; display: block; }
.bb-grid { stroke: #e8ebf2; stroke-width: 1; }
.bb-lab { font-size: 11px; fill: var(--text-3); font-family: inherit; }
.bb-ideal { stroke: #b9c2d6; stroke-width: 2; stroke-dasharray: 7 5; fill: none; }
.bb-actual { stroke: var(--primary); stroke-width: 2.5; fill: none; }
.bb-dot { fill: var(--primary); stroke: #fff; stroke-width: 2.5; }
.bb-title { font-size: 13px; font-weight: 700; fill: var(--text); }
.sprint-tasks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.sprint-task {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-md);
  background: var(--surface-2); border: 1px solid var(--border-soft);
  transition: background .15s, border-color .15s;
}
.sprint-task:hover { background: #f2f5fc; border-color: var(--border); }
.sprint-task.done { opacity: .68; }
.sprint-task-title { font-size: 13.5px; font-weight: 600; flex: 1; white-space: nowrap; }
.sprint-retro { border-top: 1px dashed var(--border); padding-top: 14px; }
.retro-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.retro-head span { font-size: 14px; font-weight: 700; }
.tag--sprint { background: var(--violet-soft); color: #5b4b99; }

/* 尊重系统减少动画设置 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* 迭代规划区：Backlog + Velocity (Scrum) */
.sprint-plan-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; margin-bottom: 14px; }
@media (max-width: 900px) { .sprint-plan-row { grid-template-columns: 1fr; } }
.sprint-backlog .backlog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.backlog-body { display: flex; flex-direction: column; gap: 6px; max-height: 250px; overflow-y: auto; padding-right: 4px; }
.backlog-body::-webkit-scrollbar { width: 6px; }
.backlog-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.backlog-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; border: 1px solid transparent; transition: background .15s; }
.backlog-row:hover { background: var(--surface-2); border-color: var(--border); }
.assign-sprint { margin-left: auto; font: 12px var(--font); color: var(--text-2); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; background: #fff; cursor: pointer; }
.assign-sprint:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.sprint-velocity .vel-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.vel-bar { display: grid; grid-template-columns: 86px 1fr 34px; align-items: center; gap: 8px; font-size: 12.5px; }
.vel-bar-label { font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vel-track { height: 11px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border-soft); overflow: hidden; }
.vel-fill { display: block; height: 100%; border-radius: 5px; background: var(--primary-grad); }
.vel-bar-val { text-align: right; color: var(--text-3); font-weight: 700; }

/* 统计 · 流动指标 (Lean) */
.lean-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.lean-kpi { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; border: 1px solid var(--border); }
.lean-kpi-label { font-size: 12px; color: var(--text-3); font-weight: 600; }
.lean-kpi-val { font-size: 20px; font-weight: 700; color: var(--primary-dark); line-height: 1.1; }
.lean-kpi-val small { font-size: 11px; font-weight: 500; color: var(--text-3); margin-left: 2px; }

/* 统计 · 负荷 / 目标 / CFD / Gantt */
.cfd-card { border-left: 4px solid var(--violet); }
.gantt-card { border-left: 4px solid var(--violet); }
.goal-card { border-left: 4px solid var(--violet); }
.cfd { width: 100%; height: 240px; display: block; margin-top: 10px; }

/* Gantt 甘特图 */
.gantt { margin-top: 10px; }
.gantt-axis { position: relative; height: 24px; border-bottom: 1px solid var(--border); }
.gantt-tick { position: absolute; bottom: 0; font-size: 11px; color: var(--text-3); transform: translateX(-50%); white-space: nowrap; }
.gantt-rows { margin-top: 4px; }
.gantt-row { display: flex; align-items: center; gap: 10px; min-height: 28px; }
.gantt-label { width: 200px; display: flex; align-items: center; gap: 8px; font-size: 12.5px; flex-shrink: 0; }
.gantt-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.gantt-track { flex: 1; position: relative; height: 20px; min-width: 240px; }
.gantt-bar { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; }

/* OKR 目标 */
.goal-list { margin-top: 4px; }
.goal { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.goal:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.goal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.goal-title { font-size: 14px; font-weight: 700; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* CFD 图例 */
.cfd-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.cfd-lg { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); font-weight: 600; }
.cfd-lg i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ============================================================
   认证 —— 启动遮罩 / 登录门禁 / 账号区 / 用户管理
   ============================================================ */

/* 启动中：避免未鉴权时闪出主界面 */
.booting .sidebar,
.booting .main { visibility: hidden; }

/* 未登录：隐藏主界面，只留登录卡片 */
.logged-out .sidebar,
.logged-out .main { display: none; }

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-glow);
  z-index: 60;
  animation: loginFade .28s ease;
}
@keyframes loginFade { from { opacity: 0; } to { opacity: 1; } }

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 26px 26px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.login-brand .logo-mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: var(--primary-grad);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .32);
}
.login-title { font-size: 18px; font-weight: 800; color: var(--text); letter-spacing: .2px; }
.login-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }

.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.login-field input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 14px;
  color: var(--text);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.login-field input:focus {
  outline: none;
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .14);
}

.login-msg { min-height: 17px; font-size: 12.5px; font-weight: 600; }
.login-msg--error { color: #b91c1c; }
.login-msg--warn { color: var(--warn); }

.login-btn { height: 42px; font-size: 14.5px; font-weight: 700; }
.login-btn:disabled { opacity: .68; cursor: progress; }

.login-foot {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-3);
  border-top: 1px dashed var(--border);
  padding-top: 12px; margin-top: 2px; line-height: 1.5;
}

/* 侧栏账号区 */
.user-chip { position: relative; }
.user-meta { min-width: 0; flex: 1; }
.user-chip .user-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.icon-btn.sm { width: 24px; height: 24px; font-size: 12px; line-height: 1; }
.user-chip .icon-btn.sm { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .18); color: #e8ebf7; }
.user-chip .icon-btn.sm:hover { background: rgba(255, 255, 255, .22); color: #fff; transform: translateY(-1px); }
.user-chip .icon-btn.sm.danger:hover { background: rgba(129, 140, 248, .3); color: #fff; }

/* 只读角色：轻微视觉提示 */
.readonly-mode .sidebar-foot .user-role { color: #c7d2fe; }

/* 用户管理视图 */
.role-card { margin-bottom: 14px; }
.role-legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 6px; }
.role-item { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.u-name { font-size: 12px; color: var(--text-3); margin-left: 2px; }
.u-time { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.empty-cell { text-align: center; color: var(--text-3); padding: 22px 0; font-size: 13px; }
.tag--me { background: var(--primary-soft); color: var(--primary-dark); margin-left: 6px; }

/* 启动失败提示：宁可显示错误，也不要白屏 */
.boot-error {
  position: fixed; left: 50%; top: 24px; transform: translateX(-50%);
  max-width: 560px; z-index: 90; padding: 12px 16px;
  background: var(--surface); border: 1px solid #fca5a5;
  border-left: 4px solid #b91c1c; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-size: 13px; line-height: 1.7;
  color: var(--text); word-break: break-word;
}
.boot-error b { color: #b91c1c; }
.boot-error span { color: var(--text-3); font-size: 12px; }