:root {
  --bg: #f7f9fb;
  --panel: #ffffff;
  --text: #12263a;
  --muted: #556b7f;
  --line: #dfe7ef;
  --brand: #006e5f;
  --brand-dark: #035146;
  --high: #b42318;
  --high-bg: #fef3f2;
  --medium: #b54708;
  --medium-bg: #fffaeb;
  --low: #067647;
  --low-bg: #ecfdf3;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 90% 0%, #d6f9f2 0, rgba(214, 249, 242, 0) 38%),
    linear-gradient(180deg, #eef7ff 0%, #f7f9fb 35%, #f7f9fb 100%);
  min-height: 100vh;
}

.app-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.hero {
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0;
  color: var(--brand);
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

h1 {
  margin: 6px 0 10px;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
}

h2 {
  margin: 0 0 16px;
  font-size: clamp(1.1rem, 2.2vw, 1.4rem);
}

.subtext {
  margin: 0;
  color: var(--muted);
  max-width: 65ch;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 10px 24px rgba(18, 38, 58, 0.08);
}

.card + .card {
  margin-top: 16px;
}

.hidden {
  display: none;
}

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

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

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 0.92rem;
  color: #2a4258;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c6d3e0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 1rem;
  color: var(--text);
  background: #fff;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 110, 95, 0.14);
}

.actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.actions.split {
  justify-content: space-between;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: transform 0.08s ease, opacity 0.2s ease, background-color 0.2s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: var(--brand);
  color: #fff;
}

.btn.primary:hover {
  background: var(--brand-dark);
}

.btn.ghost {
  background: transparent;
  border: 1px solid #9db2c8;
  color: #244157;
}

.note {
  color: var(--muted);
  margin: 0 0 14px;
}

.otp-block {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed #9db2c8;
  border-radius: 10px;
  background: #f8fbff;
}

.otp-actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

.otp-actions .btn {
  width: auto;
}

.otp-status {
  min-height: 22px;
  margin: 8px 0 0;
  font-size: 0.9rem;
  color: #1d5f93;
}

.otp-status.success {
  color: #067647;
}

.otp-status.error {
  color: #b42318;
}

.report-sections {
  display: grid;
  gap: 12px;
}

.report-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fcfeff;
}

.report-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.report-section-title {
  margin: 0;
  font-size: 1rem;
  color: #1d3850;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7fbff;
  padding: 10px;
}

.metric-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}

.metric-value {
  display: block;
  margin-top: 4px;
  font-size: 0.95rem;
}

.metric-value.high {
  color: var(--high);
}

.metric-value.medium {
  color: var(--medium);
}

.metric-value.low {
  color: var(--low);
}

.metric.metric-progress {
  grid-column: 1 / -1;
}

.metric.metric-progress.high {
  background: var(--high-bg);
}

.metric.metric-progress.medium {
  background: var(--medium-bg);
}

.metric.metric-progress.low {
  background: var(--low-bg);
}

.progress-scale {
  position: relative;
  margin-top: 8px;
  height: 12px;
  border-radius: 999px;
  background: #dce4ee;
  overflow: hidden;
}

.progress-scale::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0,
    rgba(255, 255, 255, 0) calc(25% - 1px),
    rgba(255, 255, 255, 0.78) calc(25% - 1px),
    rgba(255, 255, 255, 0.78) 25%
  );
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.progress-fill.high {
  background: linear-gradient(90deg, #f97066 0%, #b42318 100%);
}

.progress-fill.medium {
  background: linear-gradient(90deg, #fdb022 0%, #b54708 100%);
}

.progress-fill.low {
  background: linear-gradient(90deg, #32d583 0%, #067647 100%);
}

.progress-markers {
  margin-top: 5px;
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
}

.risk-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 700;
}

.risk-badge.high {
  color: var(--high);
  background: var(--high-bg);
}

.risk-badge.medium {
  color: var(--medium);
  background: var(--medium-bg);
}

.risk-badge.low {
  color: var(--low);
  background: var(--low-bg);
}

.report-for {
  margin-top: 0;
  color: var(--muted);
}

.summary {
  margin-top: 16px;
  color: #233f55;
  line-height: 1.6;
}

.summary-title {
  margin: 0 0 8px;
  font-size: 1.03rem;
}

.summary-danger {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 4px solid #b54708;
  background: #fff7e6;
}

.summary-emphasis {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 4px solid #005bb8;
  background: #eef6ff;
}

.save-status {
  min-height: 22px;
  font-size: 0.9rem;
  margin-top: 8px;
  color: #0c5f9c;
}

.consultation-btn {
  display: block;
  margin: 10px auto 0;
  width: min(100%, 460px);
  background: #005bb8;
  color: #fff;
  font-size: 1.08rem;
  padding: 14px 16px;
}

.consultation-btn:hover {
  background: #00448b;
}

@media (max-width: 768px) {
  .app-shell {
    padding: 18px 12px 28px;
  }

  .card {
    padding: 14px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .actions,
  .actions.split {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }

  .otp-actions {
    flex-direction: column;
  }

  .otp-actions .btn {
    width: 100%;
  }

  .report-section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .consultation-btn {
    font-size: 1.14rem;
    padding: 16px 14px;
  }
}
