/* ============================================================
   BOM Insight · 智能器件选型平台 Demo
   Design System & Global Styles
   ============================================================ */

:root {
  /* Brand */
  --brand: #2d5cf6;
  --brand-hover: #1f4bd8;
  --brand-light: #eef3ff;
  --brand-grad: linear-gradient(135deg, #2d5cf6 0%, #1e40c8 100%);
  --cyan: #22d3ee;

  /* Neutral */
  --bg: #f5f7fa;
  --card: #ffffff;
  --ink: #1a2333;
  --ink-2: #4a5568;
  --ink-3: #8a94a6;
  --line: #e6eaf1;
  --line-2: #eef1f6;

  /* Sidebar */
  --side-bg: #0d1530;
  --side-bg-2: #111c40;
  --side-ink: #aab4d4;
  --side-ink-active: #ffffff;

  /* Risk levels */
  --high: #e5484d;   --high-bg: #fdecec;
  --mid: #f59300;    --mid-bg: #fff4e2;
  --low: #b78103;    --low-bg: #fff8dd;
  --todo: #64748b;   --todo-bg: #f1f5f9;
  --ok: #18a058;     --ok-bg: #e7f7ee;
  --info: #2d5cf6;   --info-bg: #eef3ff;

  /* Shape */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, .10);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 1rem; }
::selection { background: rgba(45, 92, 246, .18); }

/* ============ Layout ============ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%);
  color: var(--side-ink);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
}
.side-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.side-logo .logo-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--brand-grad);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(45,92,246,.45);
  flex-shrink: 0;
}
.side-logo .logo-name { color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: .2px; }
.side-logo .logo-sub { font-size: .72rem; color: #7c88ad; margin-top: 1px; }

.side-nav { flex: 1; overflow-y: auto; padding: 14px 12px 20px; }
.side-group { margin-top: 18px; }
.side-group:first-child { margin-top: 4px; }
.side-group-title {
  font-size: .72rem; color: #66719a; letter-spacing: 1.5px;
  padding: 0 10px 8px; font-weight: 600;
}
.side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  color: var(--side-ink); font-size: .92rem;
  margin-bottom: 2px; transition: all .15s ease;
  position: relative;
}
.side-item:hover { background: rgba(255,255,255,.06); color: #dfe6ff; }
.side-item.active {
  background: linear-gradient(90deg, rgba(45,92,246,.32), rgba(45,92,246,.10));
  color: var(--side-ink-active); font-weight: 600;
}
.side-item.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.side-item svg { flex-shrink: 0; opacity: .85; }
.side-item .side-tag {
  margin-left: auto; font-size: .68rem; background: rgba(45,92,246,.35);
  color: #c7d6ff; border-radius: 20px; padding: 1px 7px;
}
.side-foot {
  padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.07);
  font-size: .72rem; color: #66719a; line-height: 1.5;
}
.side-foot .dot-ok { color: #34d399; }

.main { flex: 1; margin-left: 232px; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 60px; background: rgba(255,255,255,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 40;
}
.topbar-title { font-size: 1.05rem; font-weight: 700; }
.topbar-crumb { color: var(--ink-3); font-size: .82rem; margin-top: -2px; }
.topbar-spacer { flex: 1; }
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 20px; padding: 6px 14px; width: 260px;
  color: var(--ink-3);
}
.topbar-search input { border: none; background: none; outline: none; flex: 1; font-size: .85rem; }
.env-badge {
  font-size: .72rem; color: #92600a; background: #fdf3dd;
  border: 1px solid #f5e2b3; padding: 3px 10px; border-radius: 20px; font-weight: 600;
  white-space: nowrap;
}
.topbar-icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-2); position: relative; transition: all .15s;
}
.topbar-icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.topbar-icon-btn .dot {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px;
  background: var(--high); border-radius: 50%; border: 1.5px solid #fff;
}
.topbar-user {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 4px 6px; border-radius: 10px;
}
.topbar-user:hover { background: var(--bg); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand-grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
}
.topbar-user .u-name { font-size: .85rem; font-weight: 600; line-height: 1.25; }
.topbar-user .u-role { font-size: .7rem; color: var(--ink-3); }
.topbar-user { position: relative; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 10px); width: 240px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); z-index: 90; overflow: hidden;
  opacity: 0; pointer-events: none; transform: translateY(-6px);
  transition: all .18s ease;
}
.user-menu.show { opacity: 1; pointer-events: auto; transform: none; }
.um-head {
  display: flex; gap: 11px; align-items: center; padding: 14px 16px;
  background: #f8fafc; border-bottom: 1px solid var(--line-2); font-size: .9rem;
}
.um-item { padding: 10px 16px; font-size: .87rem; cursor: pointer; transition: background .12s; }
.um-item:hover { background: var(--bg); color: var(--brand); }
.um-item.danger { color: var(--high); border-top: 1px solid var(--line-2); }
.um-item.danger:hover { background: var(--high-bg); color: var(--high); }
.um-label { padding: 8px 16px 4px; font-size: .7rem; color: var(--ink-3); letter-spacing: 1px; font-weight: 600; }
.um-role { display: flex; align-items: center; gap: 10px; }
.um-role.cur { background: var(--brand-light); }
.um-role.cur:hover { background: var(--brand-light); color: inherit; }

.content { padding: 26px 28px 60px; flex: 1; }
.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: .2px; }
.page-head .sub { color: var(--ink-3); font-size: .88rem; margin-top: 3px; }
.page-head .head-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }

/* ============ Cards ============ */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow);
}
.card-pad { padding: 20px 22px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 22px 0; margin-bottom: 14px;
}
.card-head h3 { font-size: 1rem; font-weight: 700; }
.card-head .more { margin-left: auto; font-size: .8rem; color: var(--brand); cursor: pointer; }
.card-head .more:hover { text-decoration: underline; }

.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1200px) { .g-4, .g-5 { grid-template-columns: repeat(2, 1fr); } .g-3 { grid-template-columns: repeat(2, 1fr); } }

/* ============ KPI ============ */
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 18px 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi .k-label { font-size: .82rem; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.kpi .k-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.5px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .k-value small { font-size: .9rem; color: var(--ink-3); font-weight: 500; }
.kpi .k-trend { font-size: .76rem; display: flex; align-items: center; gap: 5px; }
.kpi .k-trend .up { color: var(--ok); } .kpi .k-trend .down { color: var(--high); }
.kpi .k-icon {
  position: absolute; right: 14px; top: 14px; width: 38px; height: 38px;
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
}
.kpi .k-icon.blue { background: var(--info-bg); color: var(--brand); }
.kpi .k-icon.red { background: var(--high-bg); color: var(--high); }
.kpi .k-icon.orange { background: var(--mid-bg); color: var(--mid); }
.kpi .k-icon.green { background: var(--ok-bg); color: var(--ok); }
.kpi .k-icon.gray { background: var(--todo-bg); color: var(--todo); }

/* ============ Badges / Tags ============ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .75rem; font-weight: 600; padding: 2px 9px;
  border-radius: 20px; white-space: nowrap; line-height: 1.6;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.high { color: var(--high); background: var(--high-bg); }
.badge.mid { color: var(--mid); background: var(--mid-bg); }
.badge.low { color: var(--low); background: var(--low-bg); }
.badge.todo { color: var(--todo); background: var(--todo-bg); }
.badge.ok { color: var(--ok); background: var(--ok-bg); }
.badge.info { color: var(--info); background: var(--info-bg); }
.badge.no-dot::before { display: none; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .72rem; padding: 2px 8px; border-radius: 6px;
  background: var(--line-2); color: var(--ink-2); white-space: nowrap;
}
.tag.src { background: #f3efff; color: #6d4fd0; }
.tag.outline { background: #fff; border: 1px solid var(--line); color: var(--ink-3); }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-size: .88rem; font-weight: 600; padding: 8px 16px;
  border-radius: 9px; transition: all .15s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand-grad); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(45,92,246,.3); }
.btn.primary:hover { filter: brightness(1.07); color: #fff; }
.btn.danger { color: var(--high); border-color: #f3c2c4; }
.btn.danger:hover { background: var(--high-bg); border-color: var(--high); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--bg); color: var(--brand); }
.btn.sm { padding: 5px 11px; font-size: .8rem; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; justify-content: center; }

/* ============ Filter chips ============ */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 20px;
  padding: 5px 14px; font-size: .82rem; color: var(--ink-2); font-weight: 500;
  transition: all .15s; display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.chip .n { font-size: .72rem; opacity: .75; font-variant-numeric: tabular-nums; }

/* ============ Tables ============ */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .87rem; }
.tbl th {
  text-align: left; font-size: .76rem; color: var(--ink-3); font-weight: 600;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: #fafbfc; white-space: nowrap; letter-spacing: .3px;
}
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: #f8faff; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl .mpn { font-weight: 700; font-family: var(--mono); font-size: .82rem; }
.tbl .mfr { color: var(--ink-3); font-size: .78rem; }
.tbl .ref { font-family: var(--mono); font-size: .78rem; color: var(--ink-2); }
.tbl-foot { padding: 12px 18px; display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: .8rem; }

.mini-cell { display: flex; flex-direction: column; gap: 2px; }
.mini-cell .note { font-size: .72rem; color: var(--ink-3); }

/* Risk dots row (4 dimensions) */
.dim-dots { display: flex; gap: 5px; }
.dim-dot { width: 22px; height: 22px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: .62rem; font-weight: 700; cursor: default; }
.dim-dot.high { background: var(--high-bg); color: var(--high); }
.dim-dot.mid { background: var(--mid-bg); color: var(--mid); }
.dim-dot.low { background: var(--low-bg); color: var(--low); }
.dim-dot.todo { background: var(--todo-bg); color: var(--todo); }
.dim-dot.ok { background: var(--ok-bg); color: var(--ok); }

/* ============ Charts ============ */
.donut-wrap { display: flex; align-items: center; gap: 26px; padding: 6px 4px; }
.donut { width: 168px; height: 168px; border-radius: 50%; position: relative; flex-shrink: 0; }
.donut::after {
  content: ""; position: absolute; inset: 26px; background: #fff; border-radius: 50%;
}
.donut .donut-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; z-index: 2;
}
.donut .donut-center b { font-size: 1.7rem; font-weight: 800; }
.donut .donut-center span { font-size: .72rem; color: var(--ink-3); }
.legend { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.legend .lg-row { display: flex; align-items: center; gap: 9px; font-size: .85rem; }
.legend .lg-row .sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend .lg-row .v { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.legend .lg-row .p { color: var(--ink-3); font-size: .76rem; width: 42px; text-align: right; }

.bars { display: flex; align-items: flex-end; gap: 14px; height: 150px; padding: 10px 6px 0; }
.bars .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.bars .bar {
  width: 100%; max-width: 38px; border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #6a8bff, var(--brand));
  position: relative; transition: height .6s ease; min-height: 4px;
}
.bars .bar:hover { filter: brightness(1.1); }
.bars .bar .bv {
  position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
  font-size: .72rem; font-weight: 700; color: var(--ink-2);
}
.bars .bar.warn { background: linear-gradient(180deg, #ffb45e, var(--mid)); }
.bars .bx { font-size: .72rem; color: var(--ink-3); }

.ring {
  --p: 0; --c: var(--brand);
  width: 58px; height: 58px; border-radius: 50%; flex-shrink: 0;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #e9edf5 0);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.ring::before { content: ""; position: absolute; inset: 6px; background: #fff; border-radius: 50%; }
.ring b { position: relative; z-index: 1; font-size: .92rem; font-weight: 800; }
.ring.sm { width: 46px; height: 46px; }
.ring.sm::before { inset: 5px; }
.ring.sm b { font-size: .78rem; }

.hbar { display: flex; align-items: center; gap: 10px; font-size: .8rem; }
.hbar .hb-label { width: 92px; color: var(--ink-2); flex-shrink: 0; }
.hbar .hb-track { flex: 1; height: 7px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.hbar .hb-fill { height: 100%; border-radius: 4px; background: var(--brand); transition: width .5s ease; }
.hbar .hb-val { width: 40px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ============ Stepper ============ */
.stepper { display: flex; align-items: center; gap: 0; margin-bottom: 26px; }
.step { display: flex; align-items: center; gap: 10px; }
.step .s-dot {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--line); background: #fff; color: var(--ink-3);
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem; font-weight: 700; transition: all .2s; flex-shrink: 0;
}
.step .s-name { font-size: .85rem; color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.step.done .s-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.done .s-name { color: var(--ink); }
.step.on .s-dot { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 0 0 5px rgba(45,92,246,.14); }
.step.on .s-name { color: var(--brand); }
.step-line { flex: 1; height: 2px; background: var(--line); margin: 0 14px; min-width: 30px; }
.step-line.done { background: var(--ok); }

/* ============ Upload ============ */
.dropzone {
  border: 2px dashed #c6d2f5; border-radius: var(--r-lg);
  background: linear-gradient(180deg, #fbfcff, #f6f9ff);
  padding: 44px 30px; text-align: center; cursor: pointer;
  transition: all .2s ease;
}
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-light); }
.dropzone .dz-icon {
  width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 16px;
  background: var(--brand-grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(45,92,246,.3);
}
.dropzone h4 { font-size: 1.05rem; margin-bottom: 5px; }
.dropzone p { color: var(--ink-3); font-size: .83rem; }
.file-row {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 11px 15px; margin-top: 10px; background: #fff;
}
.file-row .f-icon {
  width: 36px; height: 36px; border-radius: 8px; background: #e9f7ee; color: #1a9e50;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.file-row .f-name { font-weight: 600; font-size: .88rem; }
.file-row .f-meta { font-size: .74rem; color: var(--ink-3); }
.file-row .f-status { margin-left: auto; }

.progress { height: 8px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.progress .p-fill {
  height: 100%; width: 0; border-radius: 5px;
  background: linear-gradient(90deg, var(--brand), #6a8bff);
  transition: width .3s ease;
}
.scan-log {
  background: #0d1530; color: #9fe8c0; border-radius: var(--r-md);
  font-family: var(--mono); font-size: .78rem; padding: 18px 20px;
  height: 220px; overflow-y: auto; line-height: 1.9;
}
.scan-log .t { color: #5b679a; margin-right: 8px; }
.scan-log .warn { color: #ffd479; }
.scan-log .err { color: #ff8f93; }
.scan-log .ok-line { color: #6ee7a0; }

/* ============ Match matrix ============ */
.matrix td .m-cell { display: flex; align-items: center; gap: 7px; }
.m-ico { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 800; flex-shrink: 0; }
.m-ico.y { background: var(--ok-bg); color: var(--ok); }
.m-ico.w { background: var(--mid-bg); color: var(--mid); }
.m-ico.n { background: var(--high-bg); color: var(--high); }

.cand-card {
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: #fff; overflow: hidden; transition: all .18s ease; position: relative;
}
.cand-card:hover { box-shadow: var(--shadow-lg); border-color: #cdd9f8; }
.cand-card.best::before {
  content: "推荐"; position: absolute; top: 0; right: 0; z-index: 2;
  background: var(--brand-grad); color: #fff; font-size: .7rem; font-weight: 700;
  padding: 3px 12px; border-radius: 0 0 0 10px; letter-spacing: 1px;
}
.cand-head { display: flex; gap: 14px; padding: 18px 20px 12px; align-items: center; }
.cand-head .c-mpn { font-family: var(--mono); font-weight: 800; font-size: 1rem; }
.cand-head .c-mfr { color: var(--ink-3); font-size: .78rem; }
.cand-body { padding: 0 20px 16px; }
.cand-foot {
  border-top: 1px solid var(--line-2); padding: 12px 20px;
  display: flex; gap: 8px; background: #fafbfc;
}
.diff-list { display: flex; flex-direction: column; gap: 7px; font-size: .82rem; }
.diff-list .d-row { display: flex; gap: 8px; align-items: flex-start; }
.diff-list .d-row .d-ico { margin-top: 2px; flex-shrink: 0; }

.verify-list { display: flex; flex-direction: column; gap: 8px; }
.verify-item {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 10px 13px; font-size: .84rem; background: #fff;
}
.verify-item .v-check {
  width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px;
  color: #fff; cursor: pointer; transition: all .15s;
}
.verify-item.done .v-check { background: var(--ok); border-color: var(--ok); }
.verify-item.done .v-text { color: var(--ink-3); text-decoration: line-through; }

/* ============ Tabs ============ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab {
  border: none; background: none; padding: 10px 16px; font-size: .9rem;
  color: var(--ink-2); font-weight: 600; position: relative; white-space: nowrap;
}
.tab:hover { color: var(--brand); }
.tab.on { color: var(--brand); }
.tab.on::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px;
  height: 3px; border-radius: 3px 3px 0 0; background: var(--brand);
}

/* ============ Modal / Toast ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(13, 21, 48, .45);
  backdrop-filter: blur(3px); z-index: 100;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-mask.show { opacity: 1; pointer-events: auto; }
.modal {
  width: 480px; max-width: calc(100vw - 40px); background: #fff;
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(.98); transition: transform .2s;
  max-height: 85vh; overflow-y: auto;
}
.modal-mask.show .modal { transform: none; }
.modal-head { padding: 18px 22px 0; display: flex; align-items: center; }
.modal-head h3 { font-size: 1.05rem; }
.modal-head .m-close { margin-left: auto; border: none; background: none; color: var(--ink-3); font-size: 1.2rem; }
.modal-body { padding: 14px 22px 20px; }
.modal-foot { padding: 0 22px 20px; display: flex; justify-content: flex-end; gap: 10px; }

#toast-box { position: fixed; top: 76px; right: 26px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 12px 18px; display: flex; gap: 10px;
  align-items: center; font-size: .87rem; font-weight: 500;
  animation: toast-in .25s ease; min-width: 240px;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.toast .t-ico { flex-shrink: 0; }
.toast.ok .t-ico { color: var(--ok); }
.toast.info .t-ico { color: var(--brand); }
.toast.warn .t-ico { color: var(--mid); }

/* ============ Forms ============ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.field .input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 13px;
  font-size: .88rem; outline: none; transition: all .15s; background: #fff; width: 100%;
}
.field .input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(45,92,246,.12);
}
.radio-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.radio-card {
  border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 12px;
  cursor: pointer; transition: all .15s; text-align: center; font-size: .82rem;
}
.radio-card:hover { border-color: #a9bdf7; }
.radio-card.on { border-color: var(--brand); background: var(--brand-light); font-weight: 600; color: var(--brand); }

.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; cursor: pointer; }
.switch input { display: none; }
.switch .sl {
  position: absolute; inset: 0; background: #d4dae6; border-radius: 20px; transition: all .2s;
}
.switch .sl::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; transition: all .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .sl { background: var(--brand); }
.switch input:checked + .sl::after { left: 21px; }

input[type="range"].slider { -webkit-appearance: none; width: 100%; height: 6px; background: var(--line-2); border-radius: 4px; outline: none; }
input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 3px solid var(--brand); cursor: pointer;
  box-shadow: 0 2px 6px rgba(45,92,246,.35);
}

/* ============ Report ============ */
.report-paper {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow); max-width: 900px; margin: 0 auto; padding: 48px 56px;
}
.report-title-band {
  border-bottom: 3px solid var(--brand); padding-bottom: 20px; margin-bottom: 26px;
  display: flex; align-items: flex-end; gap: 16px;
}
.report-title-band h1 { font-size: 1.6rem; }
.rp-section { margin-bottom: 30px; }
.rp-section > h2 {
  font-size: 1.1rem; padding-left: 12px; border-left: 4px solid var(--brand);
  margin-bottom: 14px;
}
.rp-kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.rp-kv .kv { background: #f8fafc; border-radius: 9px; padding: 12px 14px; }
.rp-kv .kv .k { font-size: .74rem; color: var(--ink-3); }
.rp-kv .kv .v { font-size: 1.25rem; font-weight: 800; }

/* ============ Case cards ============ */
.case-card { transition: all .15s ease; }
.case-card:hover { box-shadow: var(--shadow-lg); }
.score-pick { display: flex; gap: 6px; }
.score-btn {
  border: 1.5px solid var(--line); background: #fff; border-radius: 8px;
  padding: 4px 11px; font-size: .8rem; font-weight: 700; color: var(--ink-3);
  transition: all .13s;
}
.score-btn:hover { border-color: var(--brand); color: var(--brand); }
.score-btn.on-0 { background: var(--high); border-color: var(--high); color: #fff; }
.score-btn.on-50 { background: var(--mid); border-color: var(--mid); color: #fff; }
.score-btn.on-80 { background: var(--brand); border-color: var(--brand); color: #fff; }
.score-btn.on-100 { background: var(--ok); border-color: var(--ok); color: #fff; }

/* ============ Phase timeline ============ */
.phase-track { display: flex; gap: 0; }
.phase { flex: 1; position: relative; padding-top: 26px; }
.phase::before {
  content: ""; position: absolute; top: 9px; left: 0; right: 0; height: 3px; background: var(--line);
}
.phase:first-child::before { left: 50%; }
.phase:last-child::before { right: 50%; }
.phase .ph-dot {
  position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  width: 17px; height: 17px; border-radius: 50%; background: #fff;
  border: 3px solid var(--line); z-index: 1;
}
.phase.done::before { background: var(--ok); }
.phase.done .ph-dot { border-color: var(--ok); background: var(--ok); }
.phase.on .ph-dot { border-color: var(--brand); box-shadow: 0 0 0 5px rgba(45,92,246,.15); }
.phase.on::before { background: linear-gradient(90deg, var(--ok), var(--line)); }
.phase .ph-name { text-align: center; font-weight: 700; font-size: .88rem; }
.phase .ph-desc { text-align: center; font-size: .74rem; color: var(--ink-3); padding: 0 8px; }

/* ============ Login ============ */
.login-wrap { display: flex; min-height: 100vh; }
.login-left {
  flex: 1.15; background: linear-gradient(150deg, #0d1530 0%, #14225c 55%, #1c34a8 100%);
  color: #fff; padding: 60px 64px; display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.login-left::after {
  content: ""; position: absolute; right: -140px; bottom: -140px; width: 420px; height: 420px;
  border-radius: 50%; background: radial-gradient(circle, rgba(45,92,246,.4), transparent 65%);
}
.login-left::before {
  content: ""; position: absolute; left: -100px; top: -100px; width: 320px; height: 320px;
  border-radius: 50%; background: radial-gradient(circle, rgba(34,211,238,.22), transparent 65%);
}
.login-right { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; background: #fff; }
.login-box { width: 380px; max-width: 100%; }
.login-feature { display: flex; gap: 14px; align-items: flex-start; margin-top: 26px; position: relative; z-index: 1; }
.login-feature .lf-ico {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16);
  display: flex; align-items: center; justify-content: center;
}
.login-feature b { display: block; font-size: .98rem; margin-bottom: 2px; }
.login-feature span { font-size: .8rem; color: #a9b6e2; }

/* ============ Misc ============ */
.muted { color: var(--ink-3); }
.small { font-size: .78rem; }
.mono { font-family: var(--mono); }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.empty {
  padding: 48px 20px; text-align: center; color: var(--ink-3);
}
.divider { height: 1px; background: var(--line-2); margin: 16px 0; }
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid #f5e2b3; background: #fffaec; color: #8a6108;
  border-radius: var(--r-sm); padding: 11px 15px; font-size: .83rem;
}
.notice.blue { border-color: #c3d4fb; background: #f3f7ff; color: #2a4bb5; }
.notice.red { border-color: #f3c2c4; background: #fef4f4; color: #b3373b; }
.notice.green { border-color: #b9e6cc; background: #f0faf4; color: #157347; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #ccd3e0; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .g-2, .g-3, .g-4, .g-5 { grid-template-columns: 1fr; }
  .content { padding: 18px 16px 50px; }
  .report-paper { padding: 28px 22px; }
}

/* ============ Print ============ */
@media print {
  .sidebar, .topbar, .no-print, #toast-box { display: none !important; }
  .main { margin-left: 0; }
  body { background: #fff; }
  .content { padding: 0; }
  .report-paper { border: none; box-shadow: none; max-width: none; padding: 0; }
  .card { break-inside: avoid; box-shadow: none; }
}
