:root {
  --bg: #f5f7fb;
  --panel: #fff;
  --ink: #172033;
  --sub: #667085;
  --line: #e4e8f0;
  --brand: #2563eb;
  --brand-soft: #eaf1ff;
  --green: #0f9f8a;
  --green-soft: #e8f7f4;
  --orange: #b87512;
  --orange-soft: #fff3dc;
  --red: #d14b4b;
  --red-soft: #ffeded;
  --purple: #7257c8;
  --purple-soft: #f0edff;
  --shadow: 0 10px 28px rgba(31, 42, 68, .08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
textarea { min-height: 112px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
label { display: grid; gap: 6px; color: var(--sub); font-size: 12px; }
.field-hint { color: var(--sub); font-size: 12px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 23px; }
h2 { margin-bottom: 0; font-size: 16px; }
h3 { margin-bottom: 8px; font-size: 14px; }
p { color: var(--sub); }
.login {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(120deg, rgba(37,99,235,.12), transparent 35%), linear-gradient(240deg, rgba(15,159,138,.12), transparent 40%), var(--bg);
}
.hidden, .login.hidden { display: none !important; }
.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.demo-login {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.demo-login strong {
  font-size: 12px;
  color: var(--sub);
}
body.locked .app { display: none; }
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
aside {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px;
  background: #111827;
  color: #cbd5e1;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 18px;
  border-bottom: 1px solid #263244;
  margin-bottom: 14px;
}
.brand b {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #0f9f8a, #2563eb);
}
.brand strong { display: block; color: #fff; }
.brand span, .userbox span { display: block; color: #94a3b8; font-size: 12px; }
.nav { display: grid; gap: 6px; }
.nav button {
  width: 100%;
  min-height: 38px;
  padding: 9px 11px;
  border-radius: 8px;
  text-align: left;
  color: #cbd5e1;
  background: transparent;
}
.nav button.active { background: #253144; color: #fff; }
.nav button.hidden { display: none; }
.userbox {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid #303b4b;
  border-radius: 8px;
  background: #1f2937;
}
.userbox strong { color: #fff; }
main { min-width: 0; padding: 20px 24px 36px; }
.topbar, .panel-head, .actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar { margin-bottom: 16px; }
.actions { justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
.btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--ink);
  background: #e9eef6;
  white-space: nowrap;
}
.btn.primary { color: #fff; background: var(--brand); }
.btn.dark { width: 100%; margin-top: 10px; color: #fff; background: #253144; border: 1px solid #39475a; }
.btn:disabled { opacity: .52; cursor: not-allowed; }
.view { display: none; }
.view.active { display: block; }
.panel, .metric, .box, .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.panel { min-width: 0; padding: 15px; }
.metrics, .charts {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.charts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { padding: 14px; }
.metric span { color: var(--sub); font-size: 12px; }
.metric strong { display: block; margin-top: 5px; font-size: 25px; }
.metric small { display: block; margin-top: 4px; color: var(--green); }
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(330px, .8fr);
  gap: 14px;
  align-items: start;
}
.filters { display: grid; grid-template-columns: minmax(220px, 1fr) 132px 132px; gap: 9px; margin: 13px 0 11px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; min-width: 920px; border-collapse: collapse; background: #fff; }
th, td { padding: 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--sub); background: #f9fbfe; font-size: 12px; }
tr:hover td { background: #fbfdff; }
.link { padding: 0; color: var(--brand); background: transparent; text-align: left; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}
.p0 { background: var(--red-soft); color: var(--red); }
.p1 { background: var(--orange-soft); color: var(--orange); }
.p2 { background: var(--brand-soft); color: var(--brand); }
.p3 { background: #edf2f7; color: #475569; }
.s-new { background: var(--purple-soft); color: var(--purple); }
.s-ai { background: var(--brand-soft); color: var(--brand); }
.s-pm { background: var(--orange-soft); color: var(--orange); }
.s-dev { background: var(--green-soft); color: var(--green); }
.s-done { background: #eef7ea; color: #487d2c; }
.detail { display: grid; gap: 11px; }
.box { padding: 12px; box-shadow: none; }
.box.ai { border-color: #cde9e4; background: #f4fffc; }
.meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.meta div { padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.meta span { display: block; color: var(--sub); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { padding: 5px 8px; border-radius: 999px; background: #eef2f7; color: #41506a; font-size: 12px; }
.chip.missing { background: var(--red-soft); color: var(--red); }
.attachments { display: grid; gap: 8px; }
.attachment {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  text-decoration: none;
}
.attachment span { color: var(--sub); font-size: 12px; white-space: nowrap; }
.attachment:hover { border-color: #b9c8df; background: #fff; }
.progress { height: 8px; margin: 9px 0; overflow: hidden; border-radius: 999px; background: #e8edf5; }
.progress i { display: block; height: 100%; background: var(--green); }
.ai-progress-row { display: grid; grid-template-columns: minmax(80px, 1fr) 38px; gap: 8px; align-items: center; margin: 8px 0; color: var(--sub); font-size: 12px; }
.progress.ai-progress { height: 7px; margin: 0; background: #dfe8f8; }
.progress.ai-progress i { background: var(--brand); transition: width .25s ease; }
.progress.ai-progress.working i {
  background: repeating-linear-gradient(45deg, var(--brand) 0 10px, #5b8df5 10px 20px);
  animation: aiProgressMove 1.1s linear infinite;
}
.progress.ai-progress.failed i { background: var(--red); }
@keyframes aiProgressMove {
  from { background-position: 0 0; }
  to { background-position: 28px 0; }
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.full { grid-column: 1 / -1; }
.cards { display: grid; gap: 10px; }
.list-card {
  display: grid;
  grid-template-columns: 94px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.chart-card { padding: 14px; box-shadow: none; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 76px 1fr 36px; gap: 8px; align-items: center; color: var(--sub); font-size: 12px; }
.bar { height: 9px; overflow: hidden; border-radius: 999px; background: #eef2f7; }
.bar i { display: block; height: 100%; background: var(--brand); }
.analytics-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  align-items: start;
}
.analytics-main, .analytics-side { display: grid; gap: 12px; }
.score-pill {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 32px;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
  font-weight: 700;
}
.insight-list { display: grid; gap: 8px; margin: 10px 0; }
.insight-list p {
  margin: 0;
  padding: 9px;
  border-radius: 8px;
  color: var(--ink);
  background: #f8fafc;
}
.quality {
  display: grid;
  gap: 4px;
  padding: 11px;
  margin: 10px 0;
  border-radius: 8px;
  background: var(--brand-soft);
}
.quality strong { font-size: 25px; }
.quality span { color: var(--sub); }
.mini-card {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.mini-card span { color: var(--sub); font-size: 12px; }
.board { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; }
.lane { min-height: 390px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #eef3f8; }
.lane h3 { display: flex; justify-content: space-between; }
.card { padding: 11px; margin-bottom: 9px; box-shadow: none; }
.codex-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; }
pre {
  margin: 0;
  max-height: 440px;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  color: #dbeafe;
  background: #0f172a;
  white-space: pre-wrap;
  word-break: break-word;
}
.empty { padding: 24px; text-align: center; color: var(--sub); border: 1px dashed var(--line); border-radius: 8px; background: #fbfdff; }
.modal { position: fixed; inset: 0; z-index: 40; display: none; place-items: center; padding: 18px; background: rgba(10,18,32,.45); }
.modal.active { display: grid; }
.modal-card { width: min(850px, 100%); max-height: 92vh; overflow: auto; padding: 17px; border-radius: 8px; background: #fff; box-shadow: 0 28px 80px rgba(0,0,0,.28); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 60; padding: 10px 13px; color: #fff; border-radius: 8px; background: #111827; opacity: 0; transform: translateY(18px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 1180px) {
  .metrics, .charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .codex-layout, .analytics-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  aside { position: static; height: auto; }
  .nav, .metrics, .charts, .form-grid, .meta, .filters { grid-template-columns: 1fr; }
  main { padding: 16px; }
  .topbar, .panel-head, .list-card { display: grid; }
}
