:root {
  --bg: #f3f5f2;
  --panel: #fff;
  --ink: #17201b;
  --muted: #768179;
  --line: #dfe5df;
  --green: #1e6044;
  --green-soft: #e2eee6;
  --blue: #386d9d;
  --blue-soft: #e3edf6;
  --orange: #d87545;
  --orange-soft: #faebe3;
  --red: #b75248;
  --shadow: 0 18px 50px rgba(38, 53, 43, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, select { font: inherit; }
button { color: inherit; }

.demo-banner {
  min-height: 42px;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #dbe8df;
  background: #17201a;
  font-size: 12px;
}

.demo-banner span {
  padding: 4px 7px;
  border: 1px solid #4c5c52;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
}

.demo-banner p { margin: 0; }

.demo-banner a {
  color: #fff;
  font-weight: 700;
  text-underline-offset: 3px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: calc(100vh - 42px);
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #eef2ed;
}

.logo-row {
  margin: 0 6px 34px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.logo {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: var(--green);
  font-family: Georgia, serif;
  font-size: 19px;
  font-style: italic;
}

.logo-row strong,
.logo-row small {
  display: block;
}

.logo-row strong {
  font-size: 13px;
  letter-spacing: -.01em;
}

.logo-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 10px;
  color: #5c685f;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  text-align: left;
}

.nav-item span {
  width: 20px;
  color: #839087;
  font-size: 16px;
  text-align: center;
}

.nav-item:hover,
.nav-item.active {
  color: var(--green);
  background: #dfe9df;
  font-weight: 750;
}

.nav-item.active span { color: var(--green); }

.pipeline-card {
  margin-top: 32px;
  padding: 16px 13px 14px;
  border: 1px solid #d9e1d9;
  border-radius: 13px;
  background: rgba(255, 255, 255, .55);
}

.pipeline-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 800;
}

.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3ba46f;
  box-shadow: 0 0 0 4px rgba(59, 164, 111, .12);
}

.pipeline-card ol {
  margin: 15px 0 0;
  padding: 0;
  display: grid;
  gap: 0;
  list-style: none;
}

.pipeline-card li {
  min-height: 34px;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 7px;
  color: #7b867e;
  font-size: 9px;
}

.pipeline-card li i {
  width: 18px;
  height: 18px;
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid #cbd4cc;
  border-radius: 50%;
  font-size: 8px;
  font-style: normal;
}

.pipeline-card li:not(:last-child) i::after {
  content: "";
  width: 1px;
  height: 17px;
  position: absolute;
  top: 18px;
  background: #ccd6ce;
}

.pipeline-card li.done i {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.pipeline-card li.current {
  color: var(--ink);
  font-weight: 750;
}

.pipeline-card li.current i {
  color: var(--green);
  border-color: var(--green);
  background: #fff;
}

.safety-card {
  margin-top: auto;
  padding: 14px;
  border-radius: 11px;
  color: #e2ebe4;
  background: #26362c;
}

.safety-card strong { font-size: 9px; }

.safety-card p {
  margin: 6px 0 0;
  color: #adbbb1;
  font-size: 9px;
  line-height: 1.55;
}

main {
  min-width: 0;
  padding: 34px 38px 48px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.breadcrumb {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 9px;
}

.topbar h1 {
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -.035em;
}

.top-actions {
  display: flex;
  align-items: flex-end;
  gap: 9px;
}

.top-actions label span {
  display: block;
  margin: 0 0 5px 2px;
  color: var(--muted);
  font-size: 8px;
}

.top-actions select,
.top-actions button {
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 10px;
}

.top-actions select {
  min-width: 130px;
  padding: 0 11px;
  border: 1px solid var(--line);
  background: #fff;
}

.top-actions button {
  padding: 0 16px;
  border: 0;
  color: #fff;
  background: var(--green);
  font-weight: 750;
}

.metric-grid {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.metric-grid article {
  min-height: 142px;
  position: relative;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
  box-shadow: 0 8px 28px rgba(38, 53, 43, .04);
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.metric-grid strong {
  display: block;
  margin-top: 16px;
  font-family: Georgia, serif;
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -.03em;
}

.metric-grid strong span { font-size: 14px; }

.metric-grid small {
  display: block;
  margin-top: 7px;
  color: #8b958e;
  font-size: 8px;
}

.metric-grid .positive { color: var(--green); }

.metric-icon {
  width: 38px;
  height: 38px;
  position: absolute;
  right: 14px;
  top: 14px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 16px;
  font-style: normal;
}

.content-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(520px, 1.2fr) minmax(350px, .8fr);
  gap: 14px;
  align-items: start;
}

.main-panel,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.main-panel { overflow: hidden; }

.panel-heading,
.detail-heading {
  padding: 22px 24px 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 7px;
  font-weight: 850;
  letter-spacing: .14em;
}

.panel-heading h2,
.detail-heading h2 {
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: 22px;
  font-weight: 500;
}

.filter-group {
  padding: 3px;
  display: flex;
  border-radius: 9px;
  background: #f0f3ef;
}

.filter-group button {
  min-height: 27px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 8px;
}

.filter-group button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 3px 8px rgba(35, 49, 40, .08);
  font-weight: 750;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th {
  padding: 12px 14px;
  color: #909991;
  background: #fafbf9;
  font-size: 8px;
  font-weight: 700;
  text-align: left;
}

th:first-child,
td:first-child { padding-left: 24px; width: 29%; }
th:nth-child(2) { width: 15%; }
th:nth-child(3) { width: 22%; }
th:nth-child(4) { width: 15%; }
th:nth-child(5) { width: 19%; }

tbody tr {
  border-top: 1px solid #edf0ed;
  cursor: pointer;
  transition: background .16s ease;
}

tbody tr:hover,
tbody tr.active { background: #f2f7f3; }

td {
  padding: 16px 14px;
  color: #4f5b53;
  font-size: 9px;
  vertical-align: middle;
}

.case-name strong,
.case-name span {
  display: block;
}

.case-name strong {
  overflow: hidden;
  color: #263129;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-name span {
  margin-top: 4px;
  color: #929b94;
  font-size: 8px;
}

.change-up {
  color: var(--red);
  font-weight: 780;
}

.change-down {
  color: var(--blue);
  font-weight: 780;
}

.confidence {
  display: flex;
  align-items: center;
  gap: 6px;
}

.confidence-bar {
  width: 42px;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ebe7;
}

.confidence-bar i {
  width: var(--w);
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--green);
}

.table-status,
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 7px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 750;
}

.table-status.accepted,
.status-badge.accepted {
  color: var(--green);
  background: var(--green-soft);
}

.table-status.review,
.status-badge.review {
  color: #a14d29;
  background: var(--orange-soft);
}

.detail-panel {
  padding-bottom: 20px;
  overflow: hidden;
}

.detail-heading {
  align-items: center;
}

.detail-heading h2 {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dimension-line {
  margin: 15px 22px 0;
  color: var(--muted);
  font-size: 8px;
}

.dimension-line span {
  display: inline-block;
  margin: 0 5px 6px 0;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbf9;
}

.change-card {
  margin: 15px 22px 0;
  padding: 16px;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  align-items: center;
  border-radius: 12px;
  background: #f5f7f4;
}

.change-card span {
  display: block;
  color: var(--muted);
  font-size: 8px;
}

.change-card strong {
  display: block;
  margin-top: 5px;
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 500;
}

.change-chart {
  height: 52px;
  display: flex;
  align-items: flex-end;
  gap: 5px;
}

.change-chart i {
  flex: 1;
  height: var(--h);
  border-radius: 4px 4px 1px 1px;
  background: #a9c7b4;
}

.change-chart i:last-child { background: var(--green); }

.tabs {
  margin: 20px 22px 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}

.tabs button {
  min-height: 34px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 8px;
}

.tabs button.active {
  color: var(--green);
  border-bottom-color: var(--green);
  font-weight: 800;
}

.tab-panel {
  min-height: 245px;
  padding: 18px 22px 8px;
}

.hidden { display: none !important; }

.factor-list {
  display: grid;
  gap: 13px;
}

.factor-row {
  display: grid;
  grid-template-columns: 64px 1fr 56px;
  gap: 10px;
  align-items: center;
  font-size: 8px;
}

.factor-row > span:first-child { color: #58645c; }

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

.factor-track i {
  width: var(--w);
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--color);
}

.factor-value {
  color: #4f5a52;
  font-weight: 750;
  text-align: right;
}

.closure-note {
  margin-top: 20px;
  padding: 12px 13px;
  border-left: 3px solid var(--green);
  color: #536057;
  background: #f1f6f2;
  font-size: 8px;
  line-height: 1.6;
}

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

.evidence-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.evidence-item strong {
  display: block;
  color: #344038;
  font-size: 9px;
}

.evidence-item p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.55;
}

.explanation-card {
  padding: 17px;
  border: 1px solid #cfded2;
  border-radius: 12px;
  background: #edf5ee;
}

.explanation-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.explanation-label span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: var(--green);
  font-size: 10px;
}

.explanation-label strong { font-size: 9px; }

.explanation-card p {
  margin: 14px 0 0;
  color: #3c4940;
  font-size: 9px;
  line-height: 1.75;
}

.explanation-card small {
  display: block;
  margin-top: 13px;
  color: #7c8980;
  font-size: 7px;
}

.review-actions {
  margin: 8px 22px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.review-actions button {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: var(--green);
  cursor: pointer;
  font-size: 9px;
  font-weight: 750;
}

.review-actions .secondary {
  color: #4f5a52;
  border: 1px solid var(--line);
  background: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 25px;
  z-index: 20;
  max-width: min(90vw, 460px);
  padding: 11px 16px;
  border-radius: 999px;
  color: #fff;
  background: #17201a;
  box-shadow: var(--shadow);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: .22s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .demo-banner { justify-content: space-between; }
  .demo-banner p { display: none; }

  .app { display: block; }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .logo-row { margin-bottom: 0; }
  .sidebar nav,
  .pipeline-card,
  .safety-card { display: none; }

  main { padding: 26px 15px 48px; }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions label,
  .top-actions select,
  .top-actions button {
    flex: 1;
  }

  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-grid article { min-height: 125px; padding: 17px; }
  .metric-grid strong { font-size: 27px; }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-group { width: 100%; }
  .filter-group button { flex: 1; }

  table { min-width: 650px; }

  .detail-heading h2 { max-width: 190px; }
  .change-card { grid-template-columns: 100px 1fr; }
}

@media (max-width: 430px) {
  .metric-grid { grid-template-columns: 1fr; }
  .metric-grid article { min-height: 120px; }
}
