:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8dee8;
  --panel: #ffffff;
  --band: #f4f7fb;
  --blue: #1f5eff;
  --green: #16825d;
  --red: #c24132;
  --amber: #a15c00;
  --teal: #0f766e;
  font-family: Inter, "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--band);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  min-height: 36px;
  padding: 0 14px;
  cursor: pointer;
}

button.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #101828;
  color: #fff;
  padding: 20px 14px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 8px 18px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #2f6fed;
  font-weight: 800;
}

.brand small,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
}

.brand small {
  color: #b8c4d8;
}

.nav-list {
  display: grid;
  gap: 4px;
}

.nav-item {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  text-align: left;
  background: transparent;
  color: #d8dee8;
  border-radius: 6px;
  min-height: 40px;
}

.nav-item.active,
.nav-item:hover {
  background: #253043;
  color: #fff;
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #36445c;
  font-size: 11px;
  font-weight: 700;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: 24px;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.api-field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.api-field input {
  width: min(38vw, 420px);
}

input,
select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 10px;
}

.login-band {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(280px, 1fr);
  gap: 16px;
  align-items: stretch;
}

.login-card,
.panel,
.table-panel,
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.login-card {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.login-card label,
.quick-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.login-card h2,
.panel h2 {
  margin: 0;
  font-size: 18px;
}

.login-visual {
  border-radius: 8px;
  min-height: 360px;
  background:
    linear-gradient(90deg, rgba(20, 31, 48, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(20, 31, 48, 0.08) 1px, transparent 1px),
    #e8eef7;
  background-size: 42px 42px;
  overflow: hidden;
  position: relative;
}

.risk-map {
  position: absolute;
  inset: 32px;
  border: 1px solid #c9d4e4;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
}

.node,
.route {
  position: absolute;
  display: block;
}

.node {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 8px rgba(194, 65, 50, 0.16);
}

.n1 {
  left: 18%;
  top: 26%;
}

.n2 {
  right: 22%;
  top: 42%;
  background: var(--amber);
}

.n3 {
  left: 46%;
  bottom: 24%;
  background: var(--green);
}

.route {
  height: 2px;
  background: #2f6fed;
  transform-origin: left center;
}

.r1 {
  left: 22%;
  top: 30%;
  width: 48%;
  transform: rotate(14deg);
}

.r2 {
  left: 48%;
  top: 58%;
  width: 28%;
  transform: rotate(-24deg);
}

.status-line {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
}

.content-grid {
  display: none;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

.content-grid.active {
  display: grid;
}

.metric {
  grid-column: span 3;
  padding: 14px;
}

.metric strong {
  display: block;
  font-size: 24px;
  margin-top: 8px;
}

.metric span,
.table-panel span {
  color: var(--muted);
  font-size: 12px;
}

.panel {
  grid-column: span 4;
  padding: 16px;
}

.wide {
  grid-column: span 8;
}

.full {
  grid-column: 1 / -1;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.quick-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
}

.table-panel {
  grid-column: 1 / -1;
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  color: #475467;
  background: #f8fafc;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e9f7f1;
  color: var(--green);
  font-size: 12px;
}

.badge.warn {
  background: #fff4df;
  color: var(--amber);
}

.badge.risk {
  background: #ffe8e2;
  color: var(--red);
}

.split-list {
  display: grid;
  gap: 8px;
}

.split-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.prototype-workflow {
  display: grid;
  gap: 12px;
}

.prototype-workflow .toolbar {
  margin-bottom: 0;
}

.prototype-workflow .toolbar span,
.prototype-drawer span {
  color: var(--muted);
  font-size: 12px;
}

.prototype-tabs,
.prototype-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.prototype-filter input,
.prototype-filter select {
  min-width: 150px;
}

.prototype-drawer {
  display: grid;
  gap: 4px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-band,
  .quick-form {
    grid-template-columns: 1fr;
  }

  .metric,
  .panel,
  .wide {
    grid-column: 1 / -1;
  }

  .topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .api-field input {
    width: 100%;
  }
}
