:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #13233a;
  --muted: #5b6b80;
  --line: #dfe6ef;
  --primary: #0b6bcb;
  --primary-soft: #e6f0fb;
  --ok: #128c4a;
  --wa: #25d366;
  --error: #c62828;
  --radius: 14px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }

/* Hero */
.hero {
  background: linear-gradient(135deg, #0b6bcb, #0a4d93);
  color: #fff;
  padding: 40px 0 72px;
}
.eyebrow { margin: 0 0 6px; text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; opacity: .85; }
.hero h1 { margin: 0 0 10px; font-size: clamp(1.5rem, 4.5vw, 2.1rem); line-height: 1.2; }
.lead { margin: 0; opacity: .92; max-width: 560px; }

main.wrap { margin-top: -44px; }

/* Steps */
.steps {
  list-style: none; margin: 0 0 16px; padding: 10px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  background: var(--card); border-radius: var(--radius);
  box-shadow: 0 4px 18px rgba(15, 40, 80, .08);
}
.steps li { display: flex; }
.steps button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  font: inherit; font-size: .72rem; color: var(--muted); text-align: center;
  background: none; border: 0; padding: 2px; border-radius: 10px;
}
.steps button:disabled { cursor: default; }
.steps button:not(:disabled) { cursor: pointer; }
.steps button:not(:disabled):hover { background: var(--primary-soft); }
.steps button:not(:disabled):hover span { box-shadow: 0 0 0 3px #b9d4f1; }
.steps span {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 600;
  background: var(--line); color: var(--muted);
}
.steps li.active { color: var(--primary); font-weight: 600; }
.steps li.active span { background: var(--primary); color: #fff; }
.steps li.done span { background: var(--ok); color: #fff; }

/* Card */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px;
  box-shadow: 0 4px 18px rgba(15, 40, 80, .08);
}
h2 { font-size: 1.15rem; margin: 0 0 14px; }
h2 small { font-weight: 500; color: var(--muted); font-size: .85rem; }
h3 { font-size: 1rem; margin: 22px 0 4px; }
.muted { color: var(--muted); font-size: .92rem; margin: 0 0 12px; }
.opt { color: var(--muted); font-weight: 400; }

/* Presentación del médico */
.doctor {
  display: flex; gap: 16px; align-items: center;
  padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line);
}
.doctor img {
  width: 96px; height: 96px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  border: 3px solid var(--primary-soft); background: #0a3a8c;
}
.doctor h2 { margin: 0; }
.doctor-role { margin: 2px 0 8px; color: var(--primary); font-weight: 600; font-size: .92rem; }
.doctor ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: .88rem; }
.doctor li + li { margin-top: 2px; }
@media (max-width: 420px) {
  .doctor { flex-direction: column; text-align: center; }
  .doctor ul { text-align: left; }
}

/* Tipos de consulta */
.types { display: grid; gap: 8px; margin-bottom: 24px; }
.type {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  text-align: left; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line);
  background: #fff; font: inherit; color: var(--text); cursor: pointer;
}
.type:hover { border-color: #9cc3ec; }
.type.selected { border-color: var(--primary); background: var(--primary-soft); }
.type small { display: block; color: var(--muted); font-size: .82rem; }
.type em { font-style: normal; font-weight: 700; color: var(--primary); white-space: nowrap; }

/* Calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font-size: 1.3rem; cursor: pointer; color: var(--text);
}
.icon-btn:disabled { opacity: .35; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-weekdays span { text-align: center; font-size: .75rem; color: var(--muted); font-weight: 600; padding-bottom: 4px; }
.day {
  aspect-ratio: 1; border: 1px solid transparent; border-radius: 10px;
  background: transparent; font: inherit; color: #b3bfcd; cursor: default;
}
.day.available { background: var(--primary-soft); color: var(--primary); font-weight: 600; cursor: pointer; }
.day.available:hover { border-color: var(--primary); }
.day.selected { background: var(--primary); color: #fff; }
.day.today { outline: 2px solid #9cc3ec; outline-offset: -2px; }
.legend { font-size: .78rem; color: var(--muted); margin: 10px 0 0; display: flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 8px; }
.dot:first-child { margin-left: 0; }
.dot.available { background: var(--primary-soft); border: 1px solid var(--primary); }
.dot.off { background: #eef2f6; }

#slots-wrap { margin-top: 24px; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.slot {
  padding: 10px 0; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font: inherit; font-weight: 500; cursor: pointer; color: var(--text);
}
.slot:hover { border-color: var(--primary); }
.slot.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.slot:disabled { text-decoration: line-through; color: #b3bfcd; background: #f6f8fb; cursor: default; }

/* Form */
form label, .panel > label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: 14px; }
input[type=text], input[type=tel], textarea {
  display: block; width: 100%; margin-top: 6px;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; color: var(--text); background: #fff;
}
input:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr; } }

.summary {
  background: var(--primary-soft); color: #0a4d93; border-radius: 10px;
  padding: 10px 12px; font-size: .92rem; margin: 0 0 16px;
}
.error { color: var(--error); font-size: .88rem; margin: 0 0 10px; }

/* Payment */
.amount { font-size: 1.05rem; margin: 0 0 14px; }
.amount strong { font-size: 1.3rem; }
.wallet {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px;
}
.wallet .qr { width: 260px; max-width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 10px; background: #fff; }
.wallet .qr-missing {
  width: 220px; max-width: 100%; aspect-ratio: 1; border-radius: 10px;
  display: grid; place-items: center; padding: 16px;
  background: #f6f8fb; color: var(--muted); font-size: .85rem;
}
.wallet p { margin: 8px 0 0; }

.upload {
  display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  border: 2px dashed #b9cbe0; border-radius: var(--radius); padding: 20px;
  background: #f8fbff; cursor: pointer; text-align: center; color: var(--primary); font-weight: 500;
}
.upload.has-file { border-color: var(--ok); color: var(--ok); background: #f1faf4; }
.upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload img { max-width: 220px; max-height: 260px; border-radius: 8px; }

/* Buttons */
.actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.actions.center { justify-content: center; }
.btn {
  padding: 12px 22px; border-radius: 10px; border: 0; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.btn.primary { background: var(--primary); color: #fff; margin-left: auto; }
.btn.primary:disabled { background: #a9c3de; cursor: default; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.paypal { background: #ffc439; color: #003087; margin-top: 12px; }
.paypal-logo { font-weight: 700; font-size: 1.6rem; font-style: italic; color: #003087; }
.btn.whatsapp { background: var(--wa); color: #073b1d; }
.link { display: block; margin: 18px auto 0; background: none; border: 0; color: var(--primary); font: inherit; cursor: pointer; text-decoration: underline; }

/* Done */
.done { text-align: center; }
.check {
  width: 64px; height: 64px; border-radius: 50%; margin: 4px auto 14px;
  display: grid; place-items: center; font-size: 2rem; color: #fff; background: var(--ok);
}
.notice {
  font-size: 1.05rem; background: #fff8e1; border: 1px solid #ffe08a; color: #6b4e00;
  border-radius: 10px; padding: 12px 14px;
}
.done h3 { margin-top: 24px; }
.details {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; text-align: left;
  background: var(--primary-soft); border-radius: 10px; padding: 14px 16px; margin: 0 0 16px; font-size: .92rem;
}
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* Footer & floating WA */
.foot { text-align: center; color: var(--muted); font-size: .88rem; padding-bottom: 90px; }
.foot a { color: var(--primary); }
.wa-float {
  position: fixed; right: 16px; bottom: 16px; width: 56px; height: 56px; border-radius: 50%;
  background: var(--wa); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
}
