:root {
  --bg: #f6f4ee;
  --card: #ffffff;
  --brand: #2f6f73;
  --sage: #97aeaf;
  --sage-light: #dceeee;
  --text: #1f2d2f;
  --muted: #6b7d80;
  --border: #e3e1d8;
  --danger: #c0392b;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif; line-height: 1.5;
}
.top { background: var(--sage); height: 96px; overflow: hidden; }
.logo { width: 100%; max-width: 560px; height: 100%; object-fit: cover; object-position: center 52%; display: block; margin: 0 auto; }
.card {
  max-width: 640px; margin: -18px auto 0; background: var(--card); border-radius: 24px 24px 0 0;
  padding: 22px 20px 28px; box-shadow: 0 -6px 24px rgba(0,0,0,.06); position: relative;
}
@media (min-width: 680px) { .card { border-radius: 24px; margin: -18px auto 24px; padding: 28px 32px 32px; } }
.progress { height: 6px; background: var(--sage-light); border-radius: 6px; overflow: hidden; }
.bar { height: 100%; width: 25%; background: var(--brand); transition: width .25s; }
.step-label { font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin: 10px 0 4px; font-weight: 600; }
h1 { font-size: 24px; margin: 6px 0 4px; font-weight: 800; }
.lead { color: var(--muted); margin: 0 0 18px; font-size: 15px; }
.field { margin-bottom: 14px; border: 0; padding: 0; }
.field > label, legend { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
legend { padding: 0; }
input[type=text], input:not([type]), input[type=tel], input[type=email], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 13px 14px; font: inherit; font-size: 16px; color: var(--text); background: #fff;
  border: 1.5px solid var(--border); border-radius: 14px; outline: none; appearance: none; -webkit-appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47,111,115,.15); }
.invalid { border-color: var(--danger) !important; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 520px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 12px; }
.hint { display: block; color: var(--muted); font-size: 12px; margin-top: 6px; }
.fixed { padding: 13px 14px; border-radius: 14px; background: var(--sage-light); font-weight: 600; }
.phone { display: flex; gap: 8px; }
.phone select { flex: 0 0 auto; width: 150px; }
.phone input { flex: 1; min-width: 0; letter-spacing: .02em; }
.fixed-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fixed-row .link { padding: 0; font-size: 12px; white-space: nowrap; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Historia clínica */
.group { margin: 20px 0 8px; font-size: 15px; font-weight: 800; color: var(--brand); }
.q { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.q-text { font-size: 14px; flex: 1; }
.yn { display: flex; gap: 6px; flex-shrink: 0; }
.yn input { position: absolute; opacity: 0; pointer-events: none; }
.yn label {
  min-width: 52px; text-align: center; padding: 9px 10px; border: 1.5px solid var(--border); border-radius: 12px;
  font-size: 14px; font-weight: 600; cursor: pointer; user-select: none; color: var(--muted);
}
.yn input:checked + label { background: var(--brand); border-color: var(--brand); color: #fff; }
.yn.err label { border-color: var(--danger); }
.extra { padding: 0 0 12px; }
.extra input { padding: 10px 12px; font-size: 15px; }

/* Legal */
.legal { background: #f4f7f7; border-radius: 16px; padding: 14px 16px; font-size: 13px; color: #3c4d50; margin-bottom: 16px; }
.legal p { margin: 0 0 10px; } .legal p:last-child { margin: 0; }
.legal a { color: var(--brand); font-weight: 600; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 8px 0; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); flex-shrink: 0; }
.check.strong { font-weight: 600; }

/* Firma */
.sign-wrap { position: relative; border: 2px dashed var(--sage); border-radius: 16px; background: #fcfdfd; touch-action: none; }
#firma { width: 100%; height: 200px; display: block; border-radius: 16px; touch-action: none; }
.sign-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #b4c3c4; pointer-events: none; font-weight: 600; }
.link { background: none; border: 0; color: var(--brand); font: inherit; font-size: 13px; font-weight: 600; padding: 10px 0; cursor: pointer; text-decoration: underline; }

/* Botones */
.nav { display: flex; gap: 10px; margin-top: 22px; }
.btn { flex: 1; padding: 15px 18px; border-radius: 16px; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; border: 1.5px solid transparent; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.ghost { background: #fff; color: var(--brand); border-color: var(--border); flex: 0 0 110px; }
.btn[disabled] { opacity: .6; cursor: default; }
.error { background: #fdecea; color: var(--danger); border-radius: 12px; padding: 12px 14px; font-size: 14px; font-weight: 600; margin-top: 16px; }
.ok-icon { width: 72px; height: 72px; border-radius: 24px; background: var(--sage-light); color: var(--brand); font-size: 38px; font-weight: 800; display: flex; align-items: center; justify-content: center; margin: 14px 0 10px; }
.foot { text-align: center; font-size: 12px; color: var(--muted); padding: 12px 0 28px; }
