:root {
  font-family: Inter, "Microsoft YaHei", sans-serif;
  color: #1b2b43;
  background: #f5f7fb;
  font-size: 14px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid #dce3ed;
  background: white;
  padding: 9px 15px;
  border-radius: 7px;
  color: #263b57;
}
button:hover {
  background: #edf3fc;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.primary {
  background: #245bd7;
  color: white;
  border: 0;
}
.primary:hover {
  background: #1848b5;
}
.quiet {
  border: 0;
  background: transparent;
  color: #64748b;
}
h1 {
  font-size: 26px;
  margin: 8px 0;
}
h2 {
  font-size: 18px;
}
p {
  line-height: 1.7;
}
.muted,
small {
  color: #718096;
}
.error {
  color: #c53442;
  white-space: pre-wrap;
}
.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
}
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at top left, #e4edff, transparent 60%), #f5f7fb;
}
.login-card {
  width: min(420px, 92vw);
  background: white;
  border: 1px solid #e1e7ef;
  border-radius: 16px;
  padding: 38px;
  box-shadow: 0 18px 70px #152f5c0b;
}
.login-card .brand {
  color: #245bd7;
  margin-bottom: 30px;
}
.login-card button {
  width: 100%;
  margin-top: 10px;
}
label {
  display: block;
  color: #52637b;
  margin: 15px 0;
  font-size: 13px;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  border: 1px solid #d6deea;
  border-radius: 6px;
  padding: 10px;
  margin-top: 7px;
  background: white;
  color: #192c46;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #bdcffb;
  border-color: #658cde;
}
textarea {
  min-height: 95px;
  resize: vertical;
}
.password-field {
  display: block;
  position: relative;
  margin-top: 7px;
}
.password-field input {
  margin-top: 0;
  padding-right: 46px;
}
.password-field .password-toggle {
  position: absolute;
  right: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 34px;
  padding: 7px;
  margin: 0;
  border: 0;
  background: transparent;
  color: #64748b;
}
.password-toggle:hover {
  color: #245bd7;
}
.password-toggle:focus-visible {
  outline: 2px solid #bdcffb;
}
.password-toggle svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
aside {
  position: fixed;
  inset: 0 auto 0 0;
  width: 220px;
  background: #11233e;
  color: white;
  padding: 30px 19px;
}
.role {
  font-size: 12px;
  color: #9db4d7;
  margin: 16px 0 28px;
}
nav button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  color: #afbed5;
  background: none;
  margin: 6px 0;
  padding: 12px 16px;
}
nav button.active,
nav button:hover {
  background: #23436c;
  color: white;
}
.aside-footer {
  position: absolute;
  bottom: 28px;
  color: #8aa0bf;
  font-size: 12px;
  line-height: 1.8;
}
main {
  margin-left: 220px;
  padding: 30px 38px;
  max-width: 1700px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}
.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}
.header-action {
  border: 0;
  background: transparent;
  color: #52637b;
  padding: 8px 10px;
  white-space: nowrap;
}
.header-action:hover {
  color: #245bd7;
  background: #eaf0fc;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: #8b9ab0;
}
#identity {
  color: #61718a;
  min-width: 0;
  overflow-wrap: anywhere;
}
.notice {
  padding: 12px 18px;
  background: #fff8e9;
  border: 1px solid #f3e5c2;
  color: #856524;
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 13px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.card,
.panel {
  background: white;
  border: 1px solid #e3e9f1;
  border-radius: 10px;
  padding: 23px;
}
.card .value {
  font-size: 30px;
  font-weight: 650;
  margin-top: 16px;
  letter-spacing: -1px;
}
.card .caption {
  font-size: 12px;
  color: #7a8ba2;
  margin-top: 8px;
}
.panel {
  margin-top: 22px;
}
.panel h2 {
  margin-top: 0;
}
.toolbar {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 18px;
}
.toolbar input {
  max-width: 270px;
  margin: 0;
}
.actions {
  display: flex;
  gap: 8px;
}
.table-wrap {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}
th {
  text-align: left;
  color: #7a8ba2;
  font-size: 12px;
  font-weight: 500;
  padding: 13px;
  background: #f8fafc;
}
td {
  padding: 15px 13px;
  border-bottom: 1px solid #edf1f6;
  font-size: 13px;
}
td button {
  padding: 5px 10px;
}
.empty {
  text-align: center;
  padding: 65px;
  color: #8190a5;
}
.badge {
  border-radius: 4px;
  background: #eaf6ef;
  color: #367352;
  padding: 4px 8px;
  font-size: 12px;
}
.badge.off {
  background: #f1f3f6;
  color: #7d8a9a;
}
.chart {
  height: 225px;
  width: 100%;
  display: block;
}
.chart-label {
  display: flex;
  justify-content: space-between;
  color: #8996aa;
  font-size: 12px;
}
.bars {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  height: 180px;
  border-bottom: 1px solid #e3e9f1;
  padding-top: 15px;
}
.bar {
  flex: 1;
  min-width: 2px;
  background: #5c85e9;
  border-radius: 3px 3px 0 0;
  position: relative;
}
.chart-empty {
  height: 180px;
  display: grid;
  place-items: center;
  color: #8996aa;
  border-bottom: 1px solid #edf1f6;
}
dialog {
  border: 1px solid #e1e7ef;
  border-radius: 12px;
  width: min(560px, 94vw);
  padding: 24px;
  max-height: 90vh;
  color: #21334f;
}
dialog::backdrop {
  background: #11233e66;
}
.dialog-head,
.dialog-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dialog-head h2 {
  margin: 0;
}
.dialog-actions {
  justify-content: flex-end;
  margin-top: 20px;
}
#toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: #1c3556;
  color: white;
  padding: 14px 22px;
  border-radius: 8px;
  box-shadow: 0 6px 24px #0002;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f4f7fb;
  padding: 16px;
  border-radius: 8px;
  line-height: 1.8;
}
code {
  font-family: Consolas, monospace;
}
a {
  color: #245bd7;
}
.doc p {
  max-width: 850px;
}
.doc .risk-standard-doc {
  margin: 28px 0;
  padding: 22px;
  border: 1px solid #dce3ed;
  border-left: 4px solid #245bd7;
  border-radius: 8px;
  background: #f8faff;
}
.doc .risk-standard-doc > h2:first-child {
  margin-top: 0;
}
.hint {
  font-size: 12px;
  line-height: 1.8;
  color: #7a8ba2;
}
@media (max-width: 900px) {
  aside {
    width: 165px;
    padding: 24px 12px;
  }
  main {
    margin-left: 165px;
    padding: 22px 18px;
  }
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
  header {
    align-items: flex-start;
  }
  .brand {
    font-size: 17px;
  }
}
@media (max-width: 600px) {
  aside {
    position: static;
    width: auto;
    padding: 15px;
  }
  .aside-footer,
  .role {
    display: none;
  }
  nav {
    display: flex;
    overflow: auto;
  }
  nav button {
    width: auto;
    white-space: nowrap;
    margin: 3px;
  }
  main {
    margin: 0;
    padding: 16px;
  }
  header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .header-actions {
    justify-content: flex-start;
    gap: 8px;
  }
  .header-actions #identity {
    flex-basis: 100%;
    order: -1;
  }
  h1 {
    font-size: 22px;
  }
  .cards {
    gap: 10px;
  }
  .card {
    padding: 16px;
  }
  .card .value {
    font-size: 25px;
  }
  .toolbar {
    flex-wrap: wrap;
  }
}
[hidden] {
  display: none !important;
}

aside {
  display: flex;
  flex-direction: column;
}
#nav {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.aside-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.nav-toggle {
  display: none;
}
#nav .nav-group {
  margin: 0 0 5px;
  padding: 0;
  border: 0;
  border-radius: 0;
}
#nav .nav-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 7px;
  color: #b5c5dd;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  list-style: none;
}
.nav-heading::-webkit-details-marker {
  display: none;
}
.nav-heading::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  flex-shrink: 0;
  margin-right: 3px;
}
.nav-group[open] > .nav-heading::after {
  transform: rotate(45deg);
}
#nav .nav-heading:hover {
  background: #1b3456;
  color: white;
}
#nav .has-active > .nav-heading {
  background: #1a3455;
  color: #eef5ff;
}
.nav-items {
  margin: 4px 0 10px 14px;
  padding-left: 10px;
  border-left: 1px solid #30486b;
}
.nav-items button {
  width: 100%;
  margin: 3px 0;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 20px;
}
.nav-items button:hover {
  background: #1e385a;
  color: white;
}
.nav-items button.active {
  background: #245bd7;
  color: white;
  font-weight: 600;
}
#nav .nav-heading:focus-visible,
.nav-items button:focus-visible {
  outline: 2px solid #79b4ff;
  outline-offset: -2px;
}
.aside-footer {
  position: static;
  margin-top: 18px;
  flex-shrink: 0;
}
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  color: #6d7f96;
  margin-bottom: 15px;
}
details {
  border: 1px solid #e3e9f1;
  border-radius: 7px;
  padding: 12px;
  margin: 16px 0;
}
summary {
  cursor: pointer;
  color: #456181;
  font-size: 13px;
}
@media (max-width: 600px) {
  .nav-toggle {
    display: block;
    padding: 7px 12px;
    border-color: #3a5172;
    background: transparent;
    color: #dbe7f8;
  }
  .nav-toggle:hover {
    background: #1b3456;
  }
  aside #nav {
    display: none;
    overflow: visible;
    flex: none;
    margin-top: 12px;
  }
  aside.menu-open #nav {
    display: block;
  }
}

.risk-form {
  display: grid;
  gap: 16px;
  max-width: 640px;
}
.risk-result {
  overflow-wrap: anywhere;
  margin-top: 16px;
}

.trace-raw {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 65vh;
  overflow: auto;
  font-size: 12px;
}

.risk-assessment {
  padding: 22px;
  margin: 18px 0;
  background: #f8fafc;
  border: 1px solid #dce5ee;
  border-radius: 12px;
}
.assessment-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.assessment-heading h2 {
  margin: 0;
  font-size: 20px;
}
.risk-badge {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.risk-R1 {
  background: #fff4cf;
  color: #765100;
}
.risk-R2 {
  background: #ffead4;
  color: #973a09;
}
.risk-R3 {
  background: #ffe1e6;
  color: #a11935;
}
.risk-neutral {
  background: #e8edf4;
  color: #536079;
}
.assessment-description {
  color: #52647a;
  margin: 12px 0;
}
.risk-finding-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.risk-finding {
  padding: 16px;
  border-radius: 9px;
  background: white;
  border-left: 4px solid #c4ceda;
}
.risk-finding h3 {
  font-size: 14px;
  margin: 0 0 12px;
  line-height: 1.6;
}
.finding-R1 {
  border-color: #d4ac31;
}
.finding-R2 {
  border-color: #e98a37;
}
.finding-R3 {
  border-color: #d84460;
}
.risk-finding p {
  font-size: 12px;
  margin-bottom: 0;
}
.risk-notice {
  background: #fff5df;
  color: #795823;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 14px 0;
}
.risk-notice p {
  margin: 5px 0;
  font-size: 13px;
}
.assessment-footnote {
  color: #72829a;
  font-size: 12px;
  margin: 10px 0 0;
}
.assessment-compact {
  min-width: 230px;
}
.assessment-compact .assessment-heading {
  gap: 6px;
}
.trace-dialog {
  width: min(1120px, 96vw);
  max-width: 96vw;
}
.trace-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}
.trace-section {
  background: #f7f9fc;
  border: 1px solid #e1e7ef;
  border-radius: 10px;
  padding: 16px;
  min-width: 0;
}
.trace-section h3 {
  margin: 0 0 16px;
}
.trace-section h4 {
  color: #52647a;
  font-size: 12px;
  margin: 12px 0 5px;
}
.trace-code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.6;
  max-height: 45vh;
  overflow: auto;
  margin: 0;
}
@media (max-width: 700px) {
  .trace-pair {
    grid-template-columns: 1fr;
  }
  .risk-assessment {
    padding: 16px;
  }
  .assessment-heading h2 {
    font-size: 17px;
  }
}
