
:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --line: #d9e2ee;
  --ink: #142033;
  --muted: #657489;
  --brand: #1f6feb;
  --brand-dark: #174ea6;
  --green: #1f8a5b;
  --amber: #b7791f;
  --red: #c2413a;
  --sidebar: #10243e;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  color: #dce8f7;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 8px 18px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  margin-bottom: 14px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #14b8a6);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: white;
}

.brand h1 {
  font-size: 15px;
  line-height: 1.3;
  margin: 0;
}

.brand span {
  display: block;
  color: #9db3cd;
  font-size: 12px;
  margin-top: 2px;
}

.nav-group-title {
  color: #8fa8c4;
  font-size: 12px;
  padding: 14px 8px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 7px;
  color: #dce8f7;
  font-size: 13px;
  min-height: 36px;
}

.nav-link:hover, .nav-link.active {
  background: rgba(255,255,255,.12);
  color: white;
}

.nav-guide-link {
  background: linear-gradient(135deg, rgba(31,111,235,.88), rgba(20,184,166,.76));
  color: #fff;
  font-weight: 700;
}

.nav-guide-link:hover {
  background: linear-gradient(135deg, #2f7df1, #1fbba8);
}

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: #4ade80;
  flex: 0 0 auto;
}

.main {
  min-width: 0;
  padding: 22px 26px 34px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.breadcrumbs {
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 7px;
  cursor: pointer;
  min-height: 36px;
}

.btn.primary {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.hero {
  position: relative;
  min-height: 210px;
  border-radius: 8px;
  overflow: hidden;
  background: #0d2440;
  margin-bottom: 18px;
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .42;
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 28px 30px;
  max-width: 860px;
  color: white;
}

.hero h2 {
  margin: 0 0 12px;
  font-size: 28px;
  line-height: 1.25;
}

.hero p {
  margin: 0;
  max-width: 760px;
  color: #dce9fb;
  line-height: 1.7;
  font-size: 15px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.kpi-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
}

.kpi-foot {
  color: var(--green);
  font-size: 12px;
  margin-top: 8px;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(330px, .8fr);
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.panel h3 {
  margin: 0;
  font-size: 16px;
}

.panel-body { padding: 16px; }

.table-wrap { overflow: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf1f6;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}
th {
  color: #526174;
  background: #f8fafc;
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef6ff;
  color: var(--brand-dark);
  font-size: 12px;
}
.badge.warn { background: #fff7ed; color: var(--amber); }
.badge.danger { background: #fff1f0; color: var(--red); }
.badge.ok { background: #ecfdf5; color: var(--green); }

.image-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.image-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}
.image-tile img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}
.image-tile div {
  padding: 9px 10px;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow {
  display: grid;
  gap: 10px;
}
.flow-step {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.flow-step span {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e8f1ff;
  color: var(--brand);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
}
.flow-step p {
  margin: 0;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
}
.sample-canvas {
  min-height: 430px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  position: relative;
  overflow: hidden;
}
.sample-canvas img {
  width: 100%;
  height: 100%;
  min-height: 430px;
  object-fit: cover;
  opacity: .92;
}
.box {
  position: absolute;
  border: 3px solid #22c55e;
  border-radius: 4px;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, .12);
}
.box-label {
  position: absolute;
  top: -28px;
  left: 0;
  background: #22c55e;
  color: white;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  background: white;
}
.field textarea { min-height: 92px; resize: vertical; }

.analysis-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.analysis-strip div {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
}

.analysis-strip span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.analysis-strip strong {
  font-size: 24px;
}

.domain-bars {
  display: grid;
  gap: 14px;
}

.domain-bar-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

.domain-bar-head span {
  color: var(--muted);
}

.bar-track {
  height: 9px;
  border-radius: 999px;
  background: #edf3fb;
  overflow: hidden;
}

.bar-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #1f6feb, #14b8a6);
}

.warning-list,
.topic-link-list,
.insight-list {
  display: grid;
  gap: 12px;
}

.warning-item,
.topic-link {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  background: #fbfdff;
}

.warning-item p,
.topic-link p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.analysis-logic {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.analysis-logic span {
  color: var(--muted);
}

.insight-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.insight-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid #edf1f6;
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.insight-head span,
.insight-foot {
  color: var(--muted);
  font-size: 12px;
}

.insight-head h3 {
  margin: 5px 0 0;
  font-size: 18px;
}

.insight-section h4 {
  margin: 12px 0 6px;
  font-size: 14px;
}

.insight-section p,
.recommendation p {
  margin: 0;
  color: #2f3d51;
  line-height: 1.7;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.evidence-grid div {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.evidence-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.evidence-grid strong {
  font-size: 13px;
  line-height: 1.5;
}

.metric-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.metric-tags span {
  background: #eef6ff;
  color: var(--brand-dark);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
}

.recommendation {
  border-left: 3px solid var(--brand);
  background: #f8fbff;
  padding: 10px 12px;
  margin-top: 12px;
}

.recommendation strong {
  display: block;
  margin-bottom: 5px;
}

.insight-foot {
  margin-top: 12px;
}

.report-list {
  display: grid;
  gap: 14px;
}

.report-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.report-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid #edf1f6;
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.report-head span {
  color: var(--muted);
  font-size: 12px;
}

.report-head h3 {
  margin: 5px 0 0;
  font-size: 17px;
}

.report-summary {
  margin: 0 0 12px;
  line-height: 1.7;
  color: #2f3d51;
}

.report-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.report-columns h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.report-columns ol,
.report-columns ul {
  margin: 0;
  padding-left: 20px;
  color: #2f3d51;
  line-height: 1.7;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.report-actions button {
  border: 1px solid #c8d7ea;
  background: #f8fbff;
  color: #21466f;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}

.governance-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.governance-tabs span {
  border: 1px solid var(--line);
  background: white;
  color: #38516f;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
}

.governance-tabs span.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.step-list,
.lineage-list {
  display: grid;
  gap: 10px;
}

.step-card,
.lineage-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px;
}

.step-card span,
.lineage-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.step-card strong,
.lineage-card strong {
  display: block;
  line-height: 1.45;
}

.step-card p,
.lineage-card p {
  margin: 7px 0;
  color: #2f3d51;
  line-height: 1.6;
  font-size: 13px;
}

.asset-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.asset-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
}

.asset-card-head,
.asset-title-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.asset-card-head span,
.asset-title-row span {
  color: var(--muted);
  font-size: 12px;
}

.asset-card h3,
.asset-title-row h2 {
  margin: 5px 0 0;
  line-height: 1.35;
}

.asset-card p,
.asset-title-row p {
  color: #2f3d51;
  line-height: 1.7;
  margin: 12px 0 0;
}

.asset-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.asset-meta-grid.wide {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.asset-meta-grid div,
.asset-risk-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
  min-width: 0;
}

.asset-meta-grid span,
.asset-risk-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.asset-meta-grid strong,
.asset-risk-grid strong {
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.asset-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr);
  gap: 16px;
  align-items: start;
}

.asset-risk-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #10243e;
}
.login-box {
  width: min(420px, calc(100vw - 32px));
  background: white;
  border-radius: 8px;
  padding: 28px;
}
.login-box h1 {
  margin: 0 0 10px;
  font-size: 23px;
}
.login-box p {
  margin: 0 0 22px;
  color: var(--muted);
}

.guide-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  border: none;
  background: var(--brand);
  color: white;
  border-radius: 999px;
  padding: 12px 16px;
  box-shadow: 0 14px 30px rgba(31, 111, 235, .28);
  cursor: pointer;
}

.guide-panel {
  position: fixed;
  right: 22px;
  bottom: 76px;
  width: min(420px, calc(100vw - 28px));
  height: min(620px, calc(100vh - 100px));
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .18);
  z-index: 51;
  display: none;
  overflow: hidden;
}

.guide-panel.open { display: grid; grid-template-rows: auto 1fr auto; }

.guide-head {
  padding: 14px 15px;
  background: #10243e;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.guide-head h3 {
  margin: 0;
  font-size: 15px;
}

.guide-head span {
  display: block;
  color: #a9bfd8;
  font-size: 12px;
  margin-top: 3px;
}

.guide-close {
  background: rgba(255,255,255,.12);
  color: white;
  border: 0;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.guide-messages {
  padding: 14px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
}

.guide-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.guide-msg.bot {
  background: white;
  border: 1px solid var(--line);
  align-self: flex-start;
}

.guide-msg.user {
  background: #e8f1ff;
  color: #123b73;
  align-self: flex-end;
}

.guide-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 10px;
  background: #f8fafc;
}

.guide-suggestions button {
  border: 1px solid #c8d7ea;
  background: white;
  color: #21466f;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  cursor: pointer;
}

.guide-input {
  border-top: 1px solid var(--line);
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.guide-input input {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  min-width: 0;
}

.guide-input button {
  border: 0;
  border-radius: 7px;
  padding: 0 13px;
  background: var(--brand);
  color: white;
  cursor: pointer;
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .workbench, .asset-detail-layout { grid-template-columns: 1fr; }
  .asset-meta-grid.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .main { padding: 14px; }
  .kpi-grid, .image-grid, .form-grid, .analysis-strip, .evidence-grid, .report-columns, .asset-card-grid, .asset-meta-grid, .asset-meta-grid.wide, .asset-risk-grid { grid-template-columns: 1fr; }
  .hero h2 { font-size: 22px; }
  .guide-panel { right: 14px; bottom: 70px; }
  .analysis-logic, .warning-item, .topic-link { display: grid; }
}
