:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #eef2ed;
  --ink: #202321;
  --muted: #68706c;
  --line: #d9ded8;
  --green: #167c57;
  --blue: #2b6f9f;
  --amber: #a46a13;
  --red: #b64747;
  --shadow: 0 12px 28px rgba(37, 45, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "Inter",
    "Segoe UI",
    "Microsoft YaHei",
    Arial,
    sans-serif;
}

button,
input {
  font: inherit;
}

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

.sidebar {
  background: #fbfcfa;
  border-right: 1px solid var(--line);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.2;
}

.brand p,
.eyebrow,
.panel-head span,
#tableSubtitle,
.disclaimer {
  color: var(--muted);
  font-size: 13px;
}

.control-panel {
  display: grid;
  gap: 16px;
}

.control-row,
.slider-row {
  display: grid;
  gap: 8px;
}

.control-row label,
.slider-head label {
  font-size: 14px;
  color: #303632;
  font-weight: 650;
}

.field-with-unit {
  display: grid;
  grid-template-columns: 1fr 42px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.field-with-unit input {
  width: 100%;
  border: 0;
  padding: 11px 12px;
  background: transparent;
  outline: 0;
}

.field-with-unit span {
  color: var(--muted);
  text-align: center;
  border-left: 1px solid var(--line);
  height: 100%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
}

.slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

output {
  color: var(--blue);
  font-weight: 750;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--green);
}

.primary-action {
  border: 0;
  background: var(--green);
  color: #fff;
  border-radius: 8px;
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 750;
}

.primary-action:disabled {
  opacity: 0.58;
  cursor: wait;
}

.button-icon {
  font-size: 13px;
}

.workspace {
  min-width: 0;
  padding: 22px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.topbar,
.status-strip,
.panel,
.table-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.topbar {
  min-height: 82px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h2 {
  font-size: 24px;
  margin-top: 3px;
}

.actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  cursor: pointer;
  font-weight: 650;
}

.icon-button:disabled {
  color: #a7ada9;
  cursor: not-allowed;
}

.status-strip {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) repeat(3, minmax(92px, 140px));
  gap: 14px;
  padding: 16px;
  align-items: center;
}

.progress-wrap {
  min-width: 0;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.progress-track {
  height: 10px;
  background: #e8ece8;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green), var(--blue));
  transition: width 0.25s ease;
}

.metric {
  border-left: 1px solid var(--line);
  padding-left: 14px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  font-size: 22px;
  margin-top: 2px;
}

.visual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.55fr);
  gap: 18px;
}

.panel {
  padding: 16px;
  min-width: 0;
}

.panel-head,
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

canvas {
  width: 100%;
  height: 260px;
  display: block;
}

.breakdown {
  display: grid;
  gap: 10px;
}

.break-row {
  display: grid;
  gap: 5px;
}

.break-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.break-track {
  height: 12px;
  background: #edf0ed;
  border-radius: 999px;
  overflow: hidden;
}

.break-fill {
  height: 100%;
  background: var(--blue);
}

.table-section {
  min-width: 0;
  overflow: hidden;
}

.table-toolbar {
  padding: 16px 16px 0;
}

.filter-input {
  width: min(280px, 44vw);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 38px;
  padding: 0 12px;
  outline: 0;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 520px);
  min-height: 260px;
}

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

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8faf8;
  color: #47504a;
  font-size: 12px;
  cursor: pointer;
}

tbody tr:hover {
  background: #fafbf7;
}

.score-pill,
.label-pill,
.risk-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 750;
}

.score-pill {
  background: #eaf5ef;
  color: var(--green);
}

.label-pill.priority {
  background: #e8f3ee;
  color: var(--green);
}

.label-pill.watch {
  background: #edf4f8;
  color: var(--blue);
}

.label-pill.passive {
  background: #f8f1e8;
  color: var(--amber);
}

.risk-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 280px;
}

.risk-pill {
  background: #f7eceb;
  color: var(--red);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 42px 14px;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .primary-action {
    grid-column: 1 / -1;
  }

  .visual-grid,
  .status-strip {
    grid-template-columns: 1fr;
  }

  .metric {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 10px 0 0;
  }
}

@media (max-width: 680px) {
  .sidebar,
  .workspace {
    padding: 14px;
  }

  .control-panel {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-head,
  .table-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions,
  .filter-input {
    width: 100%;
  }

  .icon-button {
    flex: 1;
  }
}
