* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: #f4f6f9;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  color: #1a1a2e;
}

/* ── Header ── */
header {
  background: #e8005a;
  display: flex;
  align-items: center;
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.logo {
  height: 42px;
  object-fit: contain;
}

/* ── Main layout ── */
main {
  display: flex;
  justify-content: center;
  padding: 24px 16px 48px;
}

/* ── Card ── */
.card {
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 680px;
  width: 100%;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.card-header {
  margin-bottom: 24px;
}

.step-badge {
  display: inline-block;
  background: #ffe8f1;
  color: #e8005a;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}

.card-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 14px;
  color: #666;
}

/* ── Precautions grid ── */
.question-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 520px) {
  .question-grid {
    grid-template-columns: 1fr;
  }
}

.question-block {
  background: #f9f9fb;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 16px;
}

.question-text {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
  line-height: 1.4;
}

.radio-group {
  display: flex;
  gap: 10px;
}

.radio-pill {
  flex: 1;
  cursor: pointer;
}

.radio-pill input[type="radio"] {
  display: none;
}

.radio-pill span {
  display: block;
  text-align: center;
  padding: 10px;
  border-radius: 8px;
  border: 2px solid #ddd;
  font-size: 14px;
  font-weight: 600;
  color: #555;
  transition: all 0.15s ease;
  user-select: none;
}

.radio-pill input[type="radio"]:checked + span {
  background: #e8005a;
  border-color: #e8005a;
  color: #fff;
}

.radio-pill:hover span {
  border-color: #e8005a;
  color: #e8005a;
}

.radio-pill input[type="radio"]:checked + span:hover {
  color: #fff;
}

/* ── Footnote ── */
.footnote {
  font-size: 11.5px;
  color: #888;
  line-height: 1.6;
  background: #fafafa;
  border-left: 3px solid #e8005a;
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 24px;
}

/* ── Buttons ── */
.btn-row {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

button {
  background: #e8005a;
  color: #fff;
  border: none;
  padding: 14px 36px;
  font-size: 15px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.3px;
  min-width: 140px;
  transition: background 0.15s, transform 0.1s;
  -webkit-appearance: none;
}

button:active {
  transform: scale(0.97);
}

button:hover:not(:disabled) {
  background: #c0004a;
}

button:disabled {
  background: #ccc;
  color: #888;
  cursor: not-allowed;
  transform: none;
}

.btn-outline {
  background: transparent;
  color: #e8005a;
  border: 2px solid #e8005a;
}

.btn-outline:hover {
  background: #ffe8f1;
}

/* ── Rejected screen ── */
.rejected-icon {
  width: 64px;
  height: 64px;
  background: #ffe8f1;
  color: #e8005a;
  font-size: 28px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.rejected-title {
  font-size: 20px;
  font-weight: 700;
  color: #e8005a;
  text-align: center;
  margin-bottom: 10px;
}

.rejected-reason {
  font-size: 15px;
  color: #555;
  text-align: center;
  margin-bottom: 28px;
  line-height: 1.5;
}

/* ── Patient form ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 520px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .span-2 { grid-column: span 1; }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.span-2 {
  grid-column: span 2;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: #444;
}

.field input,
.field select {
  padding: 13px 14px;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  font-size: 15px;
  color: #1a1a2e;
  background: #fff;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
}

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: #e8005a;
  box-shadow: 0 0 0 3px rgba(232,0,90,0.1);
}

.date-row {
  display: flex;
  gap: 8px;
}

.date-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.date-label {
  font-size: 11px;
  font-weight: 700;
  color: #999;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.date-col select {
  width: 100%;
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}

.readonly-field {
  background: #f5f5f5 !important;
  color: #777 !important;
  cursor: default;
}

/* ── IMC display ── */
.imc-display {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1.5px solid #ddd;
  background: #f9f9fb;
  font-size: 18px;
  font-weight: 700;
  color: #999;
  min-height: 50px;
}

.imc-display.imc-bajo  { border-color: #3b82f6; background: #eff6ff; color: #1d4ed8; }
.imc-display.imc-normal{ border-color: #22c55e; background: #f0fdf4; color: #15803d; }
.imc-display.imc-sobre { border-color: #f59e0b; background: #fffbeb; color: #b45309; }
.imc-display.imc-obeso { border-color: #ef4444; background: #fef2f2; color: #b91c1c; }

.imc-label {
  font-size: 13px;
  font-weight: 600;
}

/* ── Success screen ── */
.success-icon {
  width: 72px;
  height: 72px;
  background: #f0fdf4;
  color: #16a34a;
  font-size: 32px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.success-title {
  font-size: 22px;
  font-weight: 700;
  color: #16a34a;
  text-align: center;
  margin-bottom: 8px;
}

.success-msg {
  font-size: 15px;
  color: #555;
  text-align: center;
  margin-bottom: 28px;
}

/* ── Questionnaire ── */
.q-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.q-block {
  background: #f9f9fb;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 16px;
}

.q-label {
  font-size: 14px;
  font-weight: 600;
  color: #222;
  margin-bottom: 10px;
  line-height: 1.4;
}

.q-label-sm {
  font-size: 13px;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
  display: block;
}

.q-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.unit {
  font-size: 14px;
  color: #555;
  white-space: nowrap;
}

.num-input {
  width: 80px;
  padding: 10px 12px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
}

.num-input:focus {
  outline: none;
  border-color: #e8005a;
  box-shadow: 0 0 0 3px rgba(232,0,90,0.1);
}

.text-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  color: #1a1a2e;
  -webkit-appearance: none;
}

.text-input:focus {
  outline: none;
  border-color: #e8005a;
  box-shadow: 0 0 0 3px rgba(232,0,90,0.1);
}

.q-row-split {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.q-left  { flex: 1; min-width: 160px; }
.q-right { flex: 1; min-width: 160px; }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 420px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

/* Checkboxes */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.check-pill {
  cursor: pointer;
}

.check-pill input[type="checkbox"] {
  display: none;
}

.check-pill span {
  display: block;
  padding: 10px 16px;
  border-radius: 8px;
  border: 2px solid #ddd;
  font-size: 14px;
  font-weight: 600;
  color: #555;
  transition: all 0.15s ease;
  user-select: none;
}

.check-pill input[type="checkbox"]:checked + span {
  background: #e8005a;
  border-color: #e8005a;
  color: #fff;
}

.check-pill:hover span {
  border-color: #e8005a;
  color: #e8005a;
}

.q-select {
  width: 100%;
  padding: 12px 36px 12px 14px;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  font-size: 15px;
  color: #1a1a2e;
  background: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.age-select {
  width: auto;
  min-width: 90px;
}

.q-select:focus {
  outline: none;
  border-color: #e8005a;
  box-shadow: 0 0 0 3px rgba(232,0,90,0.1);
}

.field-warning {
  font-size: 12px;
  color: #c0004a;
  font-weight: 600;
  margin-top: 6px;
  padding: 8px 12px;
  background: #ffe8f1;
  border-radius: 6px;
  line-height: 1.4;
}

.conditional {
  transition: opacity 0.2s ease;
}

.hidden { display: none; }

/* ── Consent waiver ── */
.consent-text {
  max-height: 320px;
  overflow-y: auto;
  background: #f9f9fb;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 13px;
  line-height: 1.65;
  color: #444;
  margin-bottom: 24px;
}

.consent-text p { margin-bottom: 8px; }
.consent-text ul { margin: 4px 0 8px 20px; }
.consent-text li { margin-bottom: 4px; }

.consent-title {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a2e;
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 14px !important;
  line-height: 1.4;
}

.consent-section {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a2e;
  background: #eee;
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 12px !important;
}

.consent-sub {
  font-weight: 700;
  color: #333;
  margin-top: 10px !important;
}

/* ── Signature canvas ── */
#firma-canvas {
  display: block;
  width: 100%;
  height: 150px;
  border: 2px dashed #ccc;
  border-radius: 10px;
  cursor: crosshair;
  background: #fafafa;
  touch-action: none;
}
