:root {
  --bg: #0f1320;
  --bg-soft: #171c2e;
  --panel: #1c2236;
  --panel-2: #232a42;
  --line: #2c3450;
  --ink: #eef1f8;
  --ink-soft: #b6bdd4;
  --muted: #7d87a6;
  --accent: #5b8cff;
  --accent-2: #38d2b0;
  --crit: #ff5d6c;
  --high: #ff9f43;
  --med: #ffd152;
  --low: #4fd08a;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 700px at 80% -10%, #1d2742 0%, var(--bg) 55%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(15, 19, 32, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  font-size: 26px;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 11px;
  color: #0b1020;
}
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase; }
.topnav { display: flex; gap: 10px; }

/* ---------- buttons ---------- */
.ghost-btn, .primary-btn, .add-btn {
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--line);
  transition: all .15s ease;
}
.ghost-btn {
  background: var(--panel-2);
  color: var(--ink-soft);
  padding: 8px 14px;
  font-size: 13px;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--ink); }
.primary-btn {
  background: linear-gradient(135deg, var(--accent), #4a6fe0);
  color: #fff;
  border: none;
  padding: 11px 18px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(91, 140, 255, .35);
}
.primary-btn:hover { filter: brightness(1.08); }

/* ---------- hero ---------- */
.hero { padding: 46px 0 24px; max-width: 820px; }
.hero h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.25; margin: 0 0 14px; }
.hero-lead { color: var(--ink-soft); font-size: 16px; margin: 0; }
.hero-lead b { color: var(--ink); }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 22px;
  align-items: start;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px;
}
.panel-head h2 { font-size: 16px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- input ---------- */
.field span, .mini-field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field input, .proc-meta input {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 9px;
  padding: 10px 12px;
  font: inherit;
}
.proc-meta { margin-bottom: 16px; }

.step-list { display: flex; flex-direction: column; gap: 12px; }
.step-card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 13px;
}
.step-card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; }
.step-index {
  flex: none;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  background: var(--panel-2);
  border-radius: 7px;
  font-size: 12px; font-weight: 700; color: var(--accent);
}
.step-name {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}
.del-step {
  flex: none;
  background: transparent; border: 1px solid var(--line);
  color: var(--muted); border-radius: 8px;
  width: 30px; height: 30px; cursor: pointer; font-size: 13px;
}
.del-step:hover { color: var(--crit); border-color: var(--crit); }

.step-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.mini-field input, .mini-field select {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 8px;
  font: inherit;
  font-size: 13px;
}
.mini-field.check-field {
  display: flex; align-items: center; gap: 6px;
  align-self: end; padding-bottom: 8px;
}
.mini-field.check-field span { margin: 0; font-size: 12px; color: var(--ink-soft); }
.mini-field.check-field input { width: auto; }

.add-btn {
  margin-top: 14px;
  width: 100%;
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--accent);
  padding: 11px;
  font-weight: 600;
}
.add-btn:hover { border-color: var(--accent); background: rgba(91,140,255,.07); }

.legend { margin-top: 14px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.kpi {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 14px 12px;
  text-align: center;
}
.kpi-num { font-size: 24px; font-weight: 800; color: var(--accent-2); }
.kpi-label { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* ---------- results ---------- */
.result-block { margin-bottom: 20px; }
.result-block h3 { font-size: 14px; margin: 0 0 10px; color: var(--ink-soft); }
.empty-tip { color: var(--muted); font-size: 13px; background: var(--bg-soft); border: 1px dashed var(--line); border-radius: 10px; padding: 16px; margin: 0; }

.rank-list { display: flex; flex-direction: column; gap: 9px; }
.rank-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
}
.rank-item.sev-crit { border-left-color: var(--crit); }
.rank-item.sev-high { border-left-color: var(--high); }
.rank-item.sev-med  { border-left-color: var(--med); }
.rank-item.sev-low  { border-left-color: var(--low); }
.rank-score {
  font-size: 20px; font-weight: 800; min-width: 42px; text-align: center;
}
.sev-crit .rank-score { color: var(--crit); }
.sev-high .rank-score { color: var(--high); }
.sev-med  .rank-score { color: var(--med); }
.sev-low  .rank-score { color: var(--low); }
.rank-body { min-width: 0; }
.rank-name { font-weight: 600; font-size: 14px; }
.rank-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.rank-rec { font-size: 12.5px; color: var(--ink-soft); margin-top: 5px; }
.rank-tag {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap;
}
.tag-crit { background: rgba(255,93,108,.15); color: var(--crit); }
.tag-high { background: rgba(255,159,67,.15); color: var(--high); }
.tag-med  { background: rgba(255,209,82,.15); color: var(--med); }
.tag-low  { background: rgba(79,208,138,.15); color: var(--low); }

/* ---------- roadmap ---------- */
.roadmap { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.road-week {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px;
}
.road-week h4 { margin: 0 0 8px; font-size: 13px; color: var(--accent); }
.road-week ul { margin: 0; padding-left: 18px; }
.road-week li { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 6px; }
.road-week .road-empty { color: var(--muted); font-size: 12px; list-style: none; margin-left: -18px; }

.result-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- method ---------- */
.method { padding: 46px 0 20px; }
.method h2 { font-size: 20px; margin: 0 0 18px; }
.method-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.method-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.method-step { font-weight: 700; color: var(--accent-2); margin-bottom: 7px; font-size: 14px; }
.method-card p { margin: 0; font-size: 13px; color: var(--ink-soft); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 26px 0 40px; }
.footer p { margin: 0 0 6px; font-size: 13px; color: var(--ink-soft); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--accent-2); color: #06241d;
  padding: 11px 22px; border-radius: 99px; font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 50;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; }
  .method-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .step-grid { grid-template-columns: repeat(2, 1fr); }
  .kpis { grid-template-columns: 1fr; }
  .roadmap { grid-template-columns: 1fr; }
  .hero { padding: 30px 0 18px; }
  .topnav .ghost-btn { padding: 7px 10px; font-size: 12px; }
}
@media (max-width: 480px) {
  .method-grid { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
}
