:root {
  --primary: #06263d;
  --accent: #007f8d;
  --accent-soft: #eaf6f7;
  --bg: #f2f5f8;
  --card: #ffffff;
  --text: #0b1f33;
  --text-muted: #5e7387;
  --border: #dbe4eb;
  --radius: 16px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.4;
  padding-top: env(safe-area-inset-top);
  padding-bottom: calc(95px + env(safe-area-inset-bottom));
}

.iphone-shell {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px;
}

.iphone-header {
  background: var(--primary);
  color: #fff;
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.iphone-header h1 { font-size: 1.5rem; letter-spacing: 0.5px; }
.iphone-header p { font-size: 0.85rem; color: #9fe0e5; margin-top: 2px; }
.badge-row { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.badge {
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  color: #dbeaf2;
}
.badge.hospital { background: #007f8d; color: #fff; }

/* BARRA DE MODALIDAD (TABS) */
.modality-bar {
  display: flex;
  background: #e2e8f0;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 14px;
  gap: 4px;
}
.mod-tab {
  flex: 1;
  border: none;
  background: none;
  padding: 10px 4px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
}
.mod-tab.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.mobile-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(6, 38, 61, 0.04);
}
.mobile-card h2 { font-size: 1.15rem; color: var(--primary); margin-bottom: 8px; }

.vertical-form { display: flex; flex-direction: column; gap: 12px; }
.vertical-form label span { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.vertical-form input, textarea {
  width: 100%;
  padding: 12px;
  font-size: 16px; /* Evita zoom en iOS */
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fbfcfd;
  font-family: inherit;
}
.vertical-form input:focus, textarea:focus { border-color: var(--accent); outline: none; background: #fff; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* COMPONENTES VOZ */
.voice-box { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.btn-mic {
  width: 100%;
  height: 52px;
  background: #f1f5f9;
  border: 2px solid var(--accent);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
}
.btn-mic.recording {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
  animation: pulse-mic 1.2s infinite;
}
@keyframes pulse-mic {
  0% { transform: scale(1); }
  50% { transform: scale(0.98); }
  100% { transform: scale(1); }
}
.voice-status { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }
textarea { height: 80px; resize: none; margin-top: 4px; }

/* COMPONENTES OCR */
.ocr-box { display: flex; flex-direction: column; gap: 8px; }
.btn-camera-upload {
  width: 100%;
  height: 48px;
  background: var(--accent-soft);
  border: 1.5px dashed var(--accent);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
}
.img-preview {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.card-header-sticky { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.title-wrap small { color: var(--text-muted); font-size: 0.8rem; }
.score-chip {
  background: #fee2e2;
  color: #b91c1c;
  padding: 4px 10px;
  border-radius: 10px;
  text-align: right;
  line-height: 1.1;
  font-weight: 700;
  font-size: 0.95rem;
}
.score-chip.teal { background: var(--accent-soft); color: var(--accent); }
.score-chip b { display: block; font-size: 0.72rem; }
.gauge-bar { height: 6px; background: #e5ebf0; border-radius: 3px; overflow: hidden; margin: 6px 0 4px; }
.gauge-fill { height: 100%; background: #dc2626; transition: width 0.25s ease; }
.gauge-fill.teal { background: var(--accent); }
.status-lbl { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin-bottom: 14px; }

.survey-item { padding: 12px 0; border-bottom: 1px solid #edf2f6; }
.survey-item:last-child { border-bottom: none; }
.survey-item p { font-size: 0.92rem; font-weight: 600; margin-bottom: 8px; }
.touch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.touch-btn {
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  min-height: 48px;
  padding: 6px 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
}
.touch-btn.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 127, 141, 0.3);
}

.notice-box {
  background: #f6fafc;
  border-left: 3px solid var(--accent);
  padding: 10px 12px;
  font-size: 0.78rem;
  color: #3b5064;
  line-height: 1.4;
  border-radius: 0 8px 8px 0;
  margin-bottom: 14px;
}
.touch-check { display: flex; align-items: flex-start; gap: 10px; font-size: 0.85rem; line-height: 1.35; margin-bottom: 14px; }
.touch-check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); }

.sig-tools { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sig-label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.btn-clear { background: none; border: none; color: #dc2626; font-size: 0.8rem; font-weight: 600; padding: 4px 6px; }
.canvas-holder { position: relative; width: 100%; height: 150px; border: 1.5px dashed #9cb4c9; border-radius: 12px; background: #ffffff; overflow: hidden; }
#sig-pad { width: 100%; height: 100%; touch-action: none; display: block; }
.canvas-hint { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #9cb4c9; font-size: 0.82rem; pointer-events: none; }

.sticky-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  z-index: 100;
}
.btn-submit {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: block;
  height: 50px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 127, 141, 0.3);
}
.soap-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.btn-print { background: var(--primary); color: #fff; border: none; padding: 6px 12px; border-radius: 8px; font-size: 0.8rem; font-weight: 600; }
.soap-box {
  background: #06263d;
  color: #e6f3fa;
  padding: 14px;
  border-radius: 10px;
  font-family: monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* TURNSTILE ANTI-BOT */
.turnstile-wrap {
  display: flex;
  justify-content: center;
  min-height: 66px;
}
