
:root {
  --primary: #0369a1;
  --primary-dark: #075985;
  --success: #15803d;
  --warning: #a16207;
  --danger: #b91c1c;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #dbe4ee;
  --text: #0f172a;
  --muted: #64748b;
}

.card.stage {
  border: 1px solid var(--border);
  border-left: 7px solid var(--primary);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 14px 36px rgba(15, 23, 42, .08);
}

.stage .card-body {
  padding: 26px;
}

.stage-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.stage-header h2 {
  margin: 10px 0 0;
  font-size: clamp(1.3rem, 2.5vw, 1.85rem);
}

.tag, .status {
  display: inline-flex;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: .83rem;
  font-weight: 850;
}

.tag {
  color: white;
  background: linear-gradient(135deg, #0284c7, #0369a1);
}

.status {
  color: #475569;
  background: #eef2f7;
}

.status.done {
  color: #166534;
  background: #dcfce7;
}

.stage-image {
  display: block;
  width: min(620px, 100%);
  margin: 20px auto;
  border-radius: 16px;
}

.stage-form textarea,
.stage-form input[type=file] {
  width: 100%;
  border: 1px solid #bfccda;
  border-radius: 12px;
  padding: 13px;
  font: inherit;
  background: white;
}

.stage-form textarea {
  resize: vertical;
}

.upload-box {
  margin-top: 18px;
  padding: 18px;
  border: 1px dashed #8ca0b3;
  border-radius: 14px;
  background: #fbfdff;
}

.upload-box small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 16px 0;
  font-weight: 500;
}

.primary-button,
.success-button {
  padding: 12px 18px;
  border: 0;
  border-radius: 11px;
  color: white;
  font-weight: 850;
  cursor: pointer;
}

.primary-button {
  background: linear-gradient(135deg, #0284c7, #0369a1);
}

.success-button {
  background: linear-gradient(135deg, #22c55e, #15803d);
}

.primary-button:disabled,
.success-button:disabled {
  background: #a5b4c2;
  cursor: not-allowed;
}

.loading {
  margin-top: 18px;
  padding: 14px;
  border-radius: 12px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 750;
}

.error-box {
  margin-top: 18px;
  padding: 15px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: #fff1f2;
  color: #b91c1c;
}

.result-shell {
  margin-top: 22px;
  overflow: hidden;
  border: 1px solid #cfe1ef;
  border-radius: 20px;
  background: white;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .08);
}

.result-hero {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 24px;
  align-items: center;
  padding: 25px;
  color: white;
  background: linear-gradient(135deg, #082f49, #0369a1);
}

.score-ring {
  --score: 0;
  position: relative;
  display: grid;
  width: 150px;
  height: 150px;
  place-items: center;
  margin: auto;
  border-radius: 50%;
  background:
    radial-gradient(circle closest-side, #082f49 75%, transparent 76% 99%),
    conic-gradient(#38bdf8 calc(var(--score) * 1%), rgba(255,255,255,.18) 0);
}

.score-ring strong {
  font-size: 1.8rem;
  line-height: 1;
}

.score-ring span {
  display: block;
  margin-top: 5px;
  font-size: .82rem;
  color: rgba(255,255,255,.78);
}

.result-hero h3 {
  margin: 0 0 8px;
  font-size: 1.6rem;
}

.result-hero p {
  margin: 5px 0;
  color: rgba(255,255,255,.86);
}

.result-body {
  padding: 24px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 22px;
}

.kpi-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}

.kpi-card .label {
  color: var(--muted);
  font-size: .79rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.kpi-card .value {
  margin-top: 4px;
  color: var(--text);
  font-size: 1.22rem;
  font-weight: 900;
}

.criteria-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.criteria-summary .metric {
  padding: 14px;
  border-radius: 14px;
  text-align: center;
  font-weight: 800;
}

.metric.full {
  color: #166534;
  background: #dcfce7;
}

.metric.partial {
  color: #92400e;
  background: #ffedd5;
}

.metric.none {
  color: #991b1b;
  background: #fee2e2;
}

.progress-list {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.progress-row {
  display: grid;
  grid-template-columns: minmax(130px, 220px) 1fr 65px;
  gap: 12px;
  align-items: center;
}

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

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #0369a1);
}

.report-section {
  margin-top: 22px;
}

.report-section h4 {
  margin-bottom: 9px;
  color: #0c4a6e;
}

.report-section ul {
  margin-top: 0;
}

.criteria-details {
  margin-top: 22px;
}

.criteria-details summary {
  cursor: pointer;
  color: #075985;
  font-weight: 850;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 14px;
}

.criteria-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.criteria-table th,
.criteria-table td {
  padding: 10px;
  border: 1px solid #dbe4ee;
  text-align: left;
  vertical-align: top;
}

.criteria-table th {
  color: #0c4a6e;
  background: #eef7fd;
}

.score-pill {
  display: inline-flex;
  min-width: 45px;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 900;
}

.score-pill.s0 {
  color: #991b1b;
  background: #fee2e2;
}

.score-pill.s1 {
  color: #92400e;
  background: #ffedd5;
}

.score-pill.s2 {
  color: #166534;
  background: #dcfce7;
}

@media (max-width: 840px) {
  .result-hero {
    grid-template-columns: 1fr;
    text-align: center;
  }

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

  .progress-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}

@media (max-width: 520px) {
  .kpi-grid,
  .criteria-summary {
    grid-template-columns: 1fr;
  }
}
