:root {
  --bg: #eaf5ff;
  --panel: rgba(255, 255, 255, 0.74);
  --panel-strong: rgba(247, 252, 255, 0.94);
  --line: #cde3f6;
  --blue: #1677e8;
  --blue-deep: #0b58bd;
  --cyan: #24b8d7;
  --gold: #ffb84d;
  --green: #43c982;
  --red: #e95c6a;
  --text: #102033;
  --muted: #6d7f93;
  --shadow: 0 18px 48px rgba(28, 96, 158, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1120px;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    linear-gradient(120deg, rgba(255,255,255,0.65), rgba(211,235,255,0.35) 32%, rgba(250,253,255,0.8)),
    radial-gradient(circle at 48% 8%, rgba(67, 168, 255, 0.14), transparent 34%),
    var(--bg);
}

button,
select,
input {
  font: inherit;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  padding: 14px;
  gap: 14px;
}

.sidebar {
  width: 216px;
  padding: 18px 12px;
  border: 1px solid rgba(186, 218, 245, 0.78);
  background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(226,243,255,0.72));
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 0 6px 14px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: white;
  font-weight: 700;
  background: linear-gradient(145deg, #49a8ff, #0e64d6);
  box-shadow: inset 0 0 18px rgba(255,255,255,0.42), 0 8px 18px rgba(22,119,232,0.28);
}

.brand strong,
.brand span {
  display: block;
}

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

.nav-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  border: 1px solid transparent;
  background: transparent;
  color: #31506e;
  cursor: pointer;
}

.nav-item span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--blue);
  border: 1px solid #cde3f6;
  background: rgba(255,255,255,0.62);
}

.nav-item.active {
  color: var(--blue-deep);
  border-color: #b8d8f4;
  background: linear-gradient(90deg, rgba(216,238,255,0.92), rgba(255,255,255,0.46));
  box-shadow: inset 3px 0 0 var(--blue);
}

.sidebar-card {
  margin-top: 28px;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.58);
}

.sidebar-card span,
.sidebar-card strong,
.sidebar-card small {
  display: block;
  line-height: 1.8;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  padding: 14px 22px;
  border: 1px solid rgba(190, 221, 247, 0.8);
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(228,244,255,0.75));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar::before,
.topbar::after {
  content: "";
  position: absolute;
  top: 0;
  width: 220px;
  height: 34px;
  border-top: 3px solid #68b7ff;
}

.topbar::before {
  left: 28%;
  transform: skewX(32deg);
}

.topbar::after {
  right: 8%;
  transform: skewX(-32deg);
}

.eyebrow {
  margin: 0 0 4px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
  text-align: center;
}

h2 {
  position: relative;
  padding-left: 11px;
  font-size: 16px;
}

h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 3px;
  height: 14px;
  background: var(--blue);
}

.top-actions,
.filter-row,
.module-heading,
.panel-title,
.segmented {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions {
  color: #46627e;
  font-size: 13px;
}

.sync-dot {
  width: 9px;
  height: 9px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(67,201,130,0.14);
}

.primary-btn,
.ghost-btn,
.segmented button {
  min-height: 34px;
  padding: 0 16px;
  border: 1px solid #b9d9f4;
  background: rgba(255,255,255,0.74);
  color: #31506e;
  cursor: pointer;
  line-height: 1.25;
  white-space: normal;
}

.primary-btn {
  border-color: #0f68d8;
  color: white;
  background: linear-gradient(180deg, #3294ff, #0966dc);
  box-shadow: 0 7px 16px rgba(22,119,232,0.2);
}

.ghost-btn {
  min-width: 34px;
  padding: 0 10px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-panel,
.panel,
.module-heading {
  border: 1px solid rgba(190, 221, 247, 0.82);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-panel {
  position: relative;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  min-height: 250px;
  padding: 18px 24px;
  overflow: hidden;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(140, 199, 247, 0.22);
  pointer-events: none;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: center;
  gap: 12px;
  z-index: 1;
}

.metric-card {
  position: relative;
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.62);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.metric-card:hover {
  transform: translateY(-3px);
  border-color: #74bdf6;
  background: rgba(255,255,255,0.86);
  box-shadow: 0 14px 28px rgba(22, 119, 232, 0.18);
}

.metric-card span,
.metric-card strong,
.metric-card small {
  display: block;
}

.metric-card strong {
  margin: 6px 0;
  color: var(--blue-deep);
  font-size: 31px;
}

.metric-card.warn strong {
  color: #d88b18;
}

.metric-card.risk strong {
  color: #d94d60;
}

.shield-stage {
  position: relative;
  min-height: 216px;
}

.shield {
  position: absolute;
  left: 50%;
  top: 52%;
  display: grid;
  place-items: center;
  width: 118px;
  height: 138px;
  color: white;
  font-size: 54px;
  background: linear-gradient(145deg, #75c2ff, #0d69dd 70%);
  clip-path: polygon(50% 0, 94% 18%, 84% 78%, 50% 100%, 16% 78%, 6% 18%);
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 20px 22px rgba(29, 116, 205, 0.25));
}

.orbit {
  position: absolute;
  left: 50%;
  top: 52%;
  border: 1px solid rgba(65, 153, 232, 0.25);
  transform: translate(-50%, -50%);
}

.orbit-a {
  width: 320px;
  height: 170px;
  border-radius: 50%;
}

.orbit-b {
  width: 240px;
  height: 240px;
  border-radius: 50%;
}

.node {
  position: absolute;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  color: #176ac7;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.76);
  box-shadow: 0 12px 22px rgba(29, 116, 205, 0.14);
}

.node-a { left: 16%; top: 28%; }
.node-b { right: 13%; top: 22%; }
.node-c { left: 22%; bottom: 13%; }
.node-d { right: 18%; bottom: 18%; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.panel {
  min-height: 226px;
  padding: 16px;
}

.panel-title {
  justify-content: space-between;
  margin-bottom: 14px;
}

.wide {
  grid-column: span 2;
}

.bar-chart {
  position: relative;
  display: flex;
  align-items: end;
  gap: 14px;
  height: 176px;
  padding: 12px 8px 28px;
  border-left: 1px solid #d8e9f8;
  border-bottom: 1px solid #d8e9f8;
}

.bar {
  position: relative;
  flex: 1;
  min-width: 18px;
  background: linear-gradient(180deg, #55b8ff, #1677e8);
  box-shadow: inset 8px 0 0 rgba(255,255,255,0.25);
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.bar:nth-child(even) {
  background: linear-gradient(180deg, #98daf0, #24b8d7);
}

.bar::before {
  content: attr(data-value);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  min-width: 42px;
  padding: 4px 7px;
  color: #fff;
  font-size: 12px;
  text-align: center;
  background: rgba(12, 86, 181, 0.95);
  box-shadow: 0 8px 18px rgba(22,119,232,0.22);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 3;
}

.bar::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  color: #6d7f93;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  transform: translateX(-50%);
}

.bar:hover {
  filter: brightness(1.08);
  transform: translateY(-4px);
  box-shadow: inset 8px 0 0 rgba(255,255,255,0.3), 0 10px 18px rgba(22,119,232,0.2);
}

.bar:hover::before {
  opacity: 1;
  transform: translate(-50%, 0);
}

.donut-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  height: 160px;
}

.donut {
  width: 134px;
  height: 134px;
  border-radius: 50%;
  background: conic-gradient(var(--blue) 0 32%, var(--cyan) 32% 60%, var(--gold) 60% 84%, var(--green) 84% 100%);
  position: relative;
  transition: transform 0.18s ease, filter 0.18s ease;
}

.donut:hover {
  transform: scale(1.04);
  filter: drop-shadow(0 10px 18px rgba(22,119,232,0.18));
}

.donut::after {
  content: "";
  position: absolute;
  inset: 34px;
  border-radius: 50%;
  background: #f8fcff;
}

.legend {
  display: grid;
  gap: 9px;
  padding: 0;
  margin: 0;
  list-style: none;
  color: #4b6077;
  font-size: 13px;
}

.legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
}

.blue { background: var(--blue); }
.cyan { background: var(--cyan); }
.gold { background: var(--gold); }
.green { background: var(--green); }

canvas {
  width: 100%;
  height: 210px;
}

.horizontal-bars {
  display: grid;
  gap: 18px;
  padding: 18px 8px;
}

.hbar-row {
  position: relative;
  display: grid;
  grid-template-columns: 70px 1fr 42px;
  align-items: center;
  gap: 10px;
  color: #52677d;
  font-size: 13px;
  cursor: pointer;
}

.hbar-track {
  height: 9px;
  background: #e0eef9;
  overflow: hidden;
}

.hbar-fill {
  height: 100%;
  background: linear-gradient(90deg, #55b8ff, #1677e8);
  transition: filter 0.18s ease, transform 0.18s ease;
}

.hbar-row::after {
  content: attr(data-tip);
  position: absolute;
  right: 42px;
  bottom: calc(100% + 7px);
  padding: 4px 8px;
  color: #fff;
  font-size: 12px;
  background: rgba(12, 86, 181, 0.94);
  box-shadow: 0 8px 18px rgba(22,119,232,0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 4;
}

.hbar-row:hover .hbar-fill {
  filter: brightness(1.1);
  transform: scaleX(1.015);
  transform-origin: left center;
}

.hbar-row:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.module-heading {
  justify-content: space-between;
  min-height: 66px;
  margin-bottom: 14px;
  padding: 12px 18px;
}

select,
input[type="search"] {
  height: 34px;
  min-width: 168px;
  padding: 0 12px;
  border: 1px solid #c5dff4;
  background: rgba(255,255,255,0.72);
  color: #344f69;
  outline: none;
}

.table-panel {
  min-height: 600px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  height: 42px;
  padding: 0 12px;
  border-bottom: 1px solid #dbeaf6;
  text-align: left;
  white-space: nowrap;
}

th {
  color: #1d3854;
  background: linear-gradient(180deg, #e8f4ff, #d9ecfb);
  font-weight: 700;
}

tr:hover td {
  background: rgba(213, 236, 255, 0.36);
}

input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--blue);
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 22px;
  padding: 0 8px;
  color: #176ac7;
  border: 1px solid #bcdcf5;
  background: #edf7ff;
}

.tag.high {
  color: #c9394e;
  border-color: #f2c3ca;
  background: #fff0f2;
}

.tag.mid {
  color: #c17a10;
  border-color: #efd6a3;
  background: #fff8e8;
}

.split-layout,
.detect-grid {
  display: grid;
  grid-template-columns: 1.45fr 0.8fr;
  gap: 14px;
}

.detect-workbench {
  display: grid;
  grid-template-columns: minmax(330px, 1fr) minmax(430px, 1.22fr) minmax(320px, 0.98fr);
  gap: 14px;
  align-items: start;
}

.detect-form form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.detect-form label {
  display: grid;
  gap: 6px;
  color: #465f78;
  font-size: 13px;
}

.detect-form input,
.detect-form select {
  width: 100%;
  min-width: 0;
}

.form-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.form-actions button {
  width: 100%;
  min-height: 44px;
  padding: 6px 12px;
  text-align: center;
}

.decision-trace {
  margin-top: 14px;
  padding: 12px;
  min-height: 96px;
  border: 1px solid var(--line);
  background: rgba(239, 248, 255, 0.74);
  color: #405d79;
  line-height: 1.7;
}

.decision-trace p {
  margin: 6px 0 0;
}

.config-panel {
  display: grid;
  align-content: start;
  gap: 15px;
}

.config-panel label {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  color: #465f78;
  font-size: 13px;
}

.config-panel select {
  width: 100%;
}

.baseline-note {
  margin-top: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(239, 248, 255, 0.74);
  color: #46627e;
  line-height: 1.8;
}

.baseline-note p {
  margin: 6px 0 0;
}

.segmented {
  padding: 4px;
  border: 1px solid #c6e0f6;
  background: rgba(255,255,255,0.56);
}

.segmented button {
  border: 0;
  min-width: 86px;
}

.segmented button.active {
  color: white;
  background: var(--blue);
}

.rule-list {
  display: grid;
  gap: 10px;
}

.rule-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 50px;
  align-items: center;
  gap: 9px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid #d2e5f6;
  background: rgba(255,255,255,0.58);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.rule-item:hover {
  border-color: #93c9f4;
  background: rgba(255,255,255,0.82);
  box-shadow: 0 8px 18px rgba(22,119,232,0.1);
}

.rule-code {
  display: grid;
  place-items: center;
  height: 36px;
  color: white;
  font-weight: 700;
  background: var(--blue);
}

.rule-item p {
  margin: 0;
  color: #48637d;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}

.switch {
  position: relative;
  justify-self: end;
  width: 46px;
  height: 24px;
  padding: 0;
  border: 1px solid #b6cde1;
  border-radius: 999px;
  background: linear-gradient(180deg, #e6eef6, #bfcfe0);
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(55, 89, 122, 0.16);
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 6px rgba(46, 80, 113, 0.28);
  transition: transform 0.2s ease;
}

.switch.on {
  border-color: #0f68d8;
  background: linear-gradient(180deg, #42a5ff, #0966dc);
  box-shadow: 0 5px 12px rgba(22,119,232,0.2);
}

.switch.on::after {
  transform: translateX(22px);
}

td {
  max-width: 520px;
  overflow-wrap: anywhere;
  white-space: normal;
}

td:first-child,
td:nth-child(2),
td:last-child,
th {
  white-space: nowrap;
}

#toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  min-width: 220px;
  padding: 12px 16px;
  color: white;
  background: rgba(13, 91, 188, 0.94);
  box-shadow: 0 14px 30px rgba(14, 79, 154, 0.24);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.2s ease;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    width: auto;
    margin-bottom: 12px;
  }

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

  .nav-item {
    justify-content: center;
    font-size: 12px;
  }

  .nav-item span {
    display: none;
  }

  .topbar,
  .module-heading,
  .hero-panel,
  .split-layout,
  .detect-grid,
  .detect-workbench {
    display: block;
  }

  .detect-form form {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .filter-row {
    flex-wrap: wrap;
    margin-top: 12px;
  }

  .dashboard-grid,
  .metric-row {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }

  .shield-stage {
    margin-top: 14px;
  }

  table {
    min-width: 760px;
  }

  .table-panel,
  .panel {
    overflow-x: auto;
  }
}
