:root {
  --green: #097B3E;
  --gold: #D89837;
  --text: #1c2733;
  --text-muted: #5b6b7a;
  --border: #dfe6ec;
  --bg: #f7f9fb;
  --success: #097B3E;
  --danger: #d64545;
  --warning: #b8860b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.wrap {
  max-width: 34rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.page-header {
  background: linear-gradient(135deg, var(--green), #0a5c30);
  color: #fff;
  padding: 2.5rem 0 2rem;
  border-bottom: 3px solid var(--gold);
}

.page-header h1 {
  margin: 0 0 0.4rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.page-header p {
  margin: 0;
  color: #dff2e6;
  font-size: 0.9375rem;
}

main {
  padding: 2rem 0 4rem;
  min-height: calc(100vh - 9.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.verify-card {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-top: 4px solid var(--gold);
  border-radius: 0.5rem;
  padding: 2rem 1.75rem;
  box-shadow: 0 4px 16px rgba(9, 123, 62, 0.08);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.verify-card[hidden] {
  display: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

.field input {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  font-size: 0.9375rem;
}

.field input:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.field-divider {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0.75rem 0;
}

button[type="submit"] {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 0.375rem;
  background: var(--gold);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

button[type="submit"]:hover:not(:disabled) {
  background: #c2872f;
}

button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: default;
}

.result {
  margin-top: 1.5rem;
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 2.25rem 1.75rem;
  text-align: center;
  
}

.result__avatar {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.75rem;
}

.result__icon {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 0.75rem;
}

.result--valid .result__icon {
  color: var(--success);
}

.result--invalid .result__icon,
.result--error .result__icon {
  color: var(--danger);
}

.result h2 {
  margin: 0 0 1.75rem;
  font-size: 1.25rem;
}

.trainee-avatar {
  width: 3.75rem;
  height: 3.75rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--gold));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 700;
}

.cert-block {
  margin-top: 1.5rem;
  padding: 1.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg);
  text-align: left;
}

.cert-block h3 {
  margin: 0 0 1.25rem;
  font-size: 1.0625rem;
}

.cert-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
}

.cert-status--valid {
  background: #e1f3e7;
  color: var(--success);
}

.cert-status--expired {
  background: #fbe4e4;
  color: var(--danger);
}

.cert-status--unknown {
  background: #eaeef1;
  color: var(--text-muted);
}

.check-another {
  display: block;
  width: 100%;
  margin-top: 2rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.check-another:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.result .subtext {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.detail-grid {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: #fff;
  overflow: hidden;
}

.detail-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
}

.detail-row:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.detail-grid dt {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

.detail-grid dd {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.spinner {
  width: 2rem;
  height: 2rem;
  margin: 0 auto 0.75rem;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Narrow phones: the nested card padding + side-by-side detail rows leave
   too little width for a value like "SSO/2026/07/00001" next to its label,
   so it wraps into an ugly narrow column. Reclaim width and stack instead. */
@media (max-width: 400px) {
  .wrap {
    padding: 0 1rem;
  }

  .verify-card,
  .result {
    padding: 1.5rem 1.25rem;
  }

  .cert-block {
    padding: 1.25rem;
  }

  .detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .detail-grid dd {
    text-align: left;
  }
}
