:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #697386;
  --line: #dce3ef;
  --primary: #155eef;
  --primary-soft: #e8f0ff;
  --green: #17803d;
  --green-soft: #def7e7;
  --amber: #ad6800;
  --amber-soft: #fff2cc;
  --red: #b42318;
  --red-soft: #ffe4e1;
  --shadow: 0 18px 45px rgba(26, 34, 51, 0.10);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #eef4ff 0, rgba(238, 244, 255, 0) 260px), var(--bg);
}
button, input, select, textarea { font: inherit; }
button { border: 1px solid transparent; cursor: pointer; }
.app { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 18px; background: #101828; color: white; overflow: auto; }
.brand { display: grid; gap: 4px; margin-bottom: 24px; }
.brand strong { font-size: 20px; }
.brand span, .nav-title { color: #bac6d8; font-size: 12px; }
.nav-title { margin: 18px 0 8px; color: #95a3b8; }
.filter-group { display: grid; gap: 8px; }
.filter-btn { width: 100%; display: flex; justify-content: space-between; align-items: center; min-height: 36px; padding: 0 11px; border-radius: 7px; color: #d8e2f0; background: transparent; text-align: left; }
.filter-btn.active, .filter-btn:hover { background: rgba(255, 255, 255, .10); color: white; }
.filter-count { min-width: 24px; height: 22px; display: grid; place-items: center; border-radius: 999px; background: rgba(255, 255, 255, .12); font-size: 12px; }
.main { min-width: 0; padding: 24px; }
.topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: start; margin-bottom: 18px; }
h1 { margin: 0; font-size: 25px; line-height: 1.2; }
.subtitle { margin: 8px 0 0; color: var(--muted); line-height: 1.55; max-width: 860px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.primary-btn, .ghost-btn, .danger-btn { min-height: 38px; border-radius: 7px; padding: 0 13px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.primary-btn { color: white; background: var(--primary); box-shadow: 0 10px 18px rgba(21, 94, 239, .22); }
.ghost-btn { background: var(--panel); border-color: var(--line); color: var(--ink); }
.danger-btn { color: var(--red); background: var(--red-soft); border-color: #ffc7c2; }
.toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) auto auto auto; gap: 10px; margin-bottom: 16px; }
.search, .select { height: 40px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink); padding: 0 12px; min-width: 0; }
.tabs { display: flex; padding: 3px; background: #e7edf6; border-radius: 8px; gap: 3px; }
.tab { min-width: 76px; min-height: 34px; border-radius: 6px; color: #475569; background: transparent; }
.tab.active { color: var(--ink); background: white; box-shadow: 0 2px 8px rgba(15, 23, 42, .08); }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 13px 14px; box-shadow: 0 1px 0 rgba(15, 23, 42, .03); }
.metric label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.metric strong { font-size: 24px; line-height: 1; }
.progress-line, .bar { height: 8px; border-radius: 999px; background: #e3e9f2; overflow: hidden; }
.progress-line { margin-top: 12px; }
.progress-line span, .bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #155eef, #16a34a); }
.notice { margin: -4px 0 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #334155; }
.notice.error { color: var(--red); background: var(--red-soft); border-color: #ffc7c2; }
.surface { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.table-wrap { overflow: auto; max-height: calc(100vh - 280px); }
table { width: 100%; min-width: 1240px; border-collapse: separate; border-spacing: 0; }
th { position: sticky; top: 0; z-index: 2; height: 42px; padding: 0 12px; background: #1e3a8a; color: white; font-size: 13px; text-align: left; border-bottom: 1px solid #19327a; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13px; }
tr:hover td { background: #f8fbff; }
.id-cell { font-variant-numeric: tabular-nums; color: #475569; white-space: nowrap; }
.name-cell { font-weight: 700; max-width: 230px; }
.desc-cell { color: #475569; max-width: 420px; line-height: 1.45; }
.chip { display: inline-flex; align-items: center; justify-content: center; min-height: 24px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.p0 { color: var(--red); background: var(--red-soft); }
.p1 { color: #0f4aa6; background: var(--primary-soft); }
.p2 { color: var(--amber); background: var(--amber-soft); }
.p3 { color: #475569; background: #eef2f7; }
.done { color: var(--green); background: var(--green-soft); }
.doing { color: #0f4aa6; background: var(--primary-soft); }
.todo { color: #475569; background: #eef2f7; }
.inline-progress { display: grid; grid-template-columns: 74px minmax(100px, 1fr); gap: 8px; align-items: center; min-width: 190px; }
.row-actions { display: flex; gap: 7px; justify-content: flex-end; }
.icon-btn { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 7px; border: 1px solid var(--line); background: white; color: #334155; font-size: 14px; }
.kanban { display: none; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 12px; padding: 12px; min-height: 520px; overflow: auto; }
.kanban.active { display: grid; }
.column { min-width: 260px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.column-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 800; }
.cards { display: grid; gap: 10px; min-height: 420px; }
.card { border: 1px solid var(--line); border-radius: 8px; background: white; padding: 12px; box-shadow: 0 5px 14px rgba(15, 23, 42, .06); cursor: grab; }
.card h3 { margin: 9px 0 8px; font-size: 14px; line-height: 1.35; }
.card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.modal-backdrop { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(15, 23, 42, .50); z-index: 20; }
.modal-backdrop.active { display: flex; }
.modal { width: min(860px, 100%); max-height: calc(100vh - 48px); overflow: auto; background: white; border-radius: 8px; box-shadow: 0 28px 70px rgba(15, 23, 42, .30); }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; background: white; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; }
.form { padding: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #334155; font-size: 12px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 9px 10px; color: var(--ink); background: white; }
.field textarea { min-height: 82px; resize: vertical; line-height: 1.45; }
.range-row { display: grid; grid-template-columns: minmax(0, 1fr) 56px; gap: 10px; align-items: center; }
input[type="range"] { accent-color: var(--primary); }
.modal-foot { display: flex; justify-content: space-between; gap: 10px; padding: 14px 18px 18px; border-top: 1px solid var(--line); }
.empty { padding: 34px; text-align: center; color: var(--muted); }
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar, .topbar { grid-template-columns: 1fr; }
  .actions { justify-content: flex-start; }
  .kanban { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .main { padding: 16px; }
  .metrics, .form { grid-template-columns: 1fr; }
  h1 { font-size: 21px; }
}
