:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }

/* 登录 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a, #2563eb 55%, #38bdf8);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 20px;
  padding: 36px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .25);
}
.login-card h1 { margin: 0 0 6px; font-size: 24px; }
.login-card p.sub { margin: 0 0 28px; color: var(--muted); }
.login-card label { display: block; margin: 16px 0 6px; font-weight: 600; }
.login-card input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 10px; outline: none;
}
.login-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.login-card button {
  width: 100%; margin-top: 24px; padding: 12px; border: 0; border-radius: 10px;
  background: var(--primary); color: #fff; font-weight: 700; font-size: 15px;
}
.login-card button:hover { background: var(--primary-dark); }
.demo-tip {
  margin-top: 20px; padding: 12px; border-radius: 10px; background: #eff6ff;
  color: #1e40af; font-size: 12px; line-height: 1.8;
}

/* 布局 */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; flex-shrink: 0; background: #0f172a; color: #cbd5e1;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.logo {
  padding: 22px 20px; font-size: 18px; font-weight: 800; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.logo span { color: #60a5fa; }
.nav { padding: 12px; flex: 1; overflow-y: auto; }
.nav-group { margin: 8px 0 4px; padding: 0 10px; font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: .08em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px;
  border: 0; background: transparent; color: #cbd5e1; border-radius: 9px; text-align: left;
  margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; opacity: .9; }
.sidebar-foot { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #64748b; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .title { font-size: 16px; font-weight: 700; }
.topbar .right { display: flex; align-items: center; gap: 14px; }
.badge-role { padding: 4px 10px; border-radius: 999px; background: #eff6ff; color: var(--primary); font-size: 12px; font-weight: 600; }
.user-chip { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 13px; }
.content { padding: 24px; flex: 1; }

/* 通用 */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 12px; }
.page-head h2 { margin: 0; font-size: 20px; }
.page-head .desc { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  padding: 8px 14px; border: 1px solid var(--border); background: #fff; color: var(--text);
  border-radius: 9px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }

.stat { padding: 18px 20px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 800; margin: 8px 0 4px; }
.stat .hint { font-size: 12px; color: var(--muted); }
.stat .icon { float: right; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: #eff6ff; color: var(--primary); font-size: 18px; }
.stat.warn .icon { background: #fef3c7; color: var(--warning); }
.stat.green .icon { background: #dcfce7; color: var(--success); }

.section-title { font-weight: 700; margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-size: 12px; font-weight: 600; background: #f8fafc; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fafc; }
td .sub { color: var(--muted); font-size: 12px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.amber { background: #fef3c7; color: #92400e; }
.badge.blue { background: #dbeafe; color: #1e40af; }
.badge.gray { background: #f1f5f9; color: #475569; }

/* 进度条 */
.progress-line { height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.progress-line > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.progress-line.ok > i { background: var(--success); }
.progress-line.warn > i { background: var(--warning); }
.stages { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.stage { flex: 1; min-width: 80px; text-align: center; padding: 10px 6px; border-radius: 10px; background: #f8fafc; color: var(--muted); font-size: 12px; }
.stage.done { background: #dcfce7; color: #166534; }
.stage.current { background: #dbeafe; color: #1e40af; font-weight: 700; }

/* 时间线 */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 20px 6px; }
.tl-item::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary); }
.tl-meta { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.tl-title { font-weight: 700; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.thumbs img { width: 96px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; }

/* 筛选栏 */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters select, .filters input {
  padding: 8px 11px; border: 1px solid var(--border); border-radius: 9px; background: #fff; outline: none;
}
.filters select:focus, .filters input:focus { border-color: var(--primary); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); display: none;
  align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 620px; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(15,23,42,.3);
}
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close { border: 0; background: transparent; font-size: 22px; color: var(--muted); line-height: 1; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-item.full { grid-column: 1 / -1; }
.form-item label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.form-item input, .form-item select, .form-item textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; outline: none; background: #fff;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-item textarea { min-height: 80px; resize: vertical; }
.file-list { margin-top: 8px; font-size: 12px; color: var(--muted); }

/* 提示 */
.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 10px;
  z-index: 200; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.link-like { border: 0; background: transparent; color: var(--primary); padding: 0; font-weight: 600; }
.owner-note { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; }

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .logo { padding: 14px 16px; }
  .nav { display: flex; overflow-x: auto; padding: 8px; gap: 6px; }
  .nav-group, .sidebar-foot { display: none; }
  .nav-item { width: auto; white-space: nowrap; margin: 0; }
  .topbar { padding: 10px 16px; height: auto; flex-wrap: wrap; gap: 8px; }
  .topbar .title { width: 100%; }
  .topbar .right { width: 100%; justify-content: space-between; gap: 8px; }
  .topbar .badge-role, #userName { display: none; }
  #projectSelect { max-width: 62%; }
  .content { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-item.full { grid-column: auto; }
  .stat .value { font-size: 22px; }
}
