:root {
  --navy: #143c86;
  --navy-900: #0b234f;
  --blue: #1f5fc4;
  --cyan: #18a9e0;
  --teal: #129fc2;
  --sky: #e7f6fd;
  --soft: #f3f8fc;
  --ink: #0f1e3a;
  --muted: #56667f;
  --line: #dce7f2;
  --danger: #d23a3a;
  --ok: #1a9e5c;
  --warn: #e08a00;
  --white: #fff;
  --radius: 18px;
  --shadow: 0 14px 40px -18px rgba(11, 35, 79, .35);
  --font-head: "Montserrat", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); color: var(--ink); line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100vh;
  background: linear-gradient(180deg, var(--navy-900) 0, var(--navy) 260px, var(--soft) 260px); }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea { font: inherit; color: inherit; }
h1, legend { font-family: var(--font-head); color: var(--navy); line-height: 1.2; }
.rp-hidden { display: none !important; }
.rp-wrap { width: min(680px, 100% - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)); margin-inline: auto; }

/* Header */
.rp-header { color: var(--white); padding-top: env(safe-area-inset-top, 0px); }
.rp-header__inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.rp-brand { display: flex; align-items: center; gap: .65rem; color: var(--white); text-decoration: none; }
.rp-brand img { border-radius: 50%; background: var(--white); }
.rp-brand span { font-family: var(--font-head); font-weight: 800; font-size: 1.05rem; }
.rp-brand small { display: block; font-size: .7rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); }
.rp-back { color: rgba(255, 255, 255, .85); text-decoration: none; font-weight: 600; font-size: .9rem; }
.rp-back:hover { color: var(--cyan); }

.rp-main { padding: 8px 0 40px; }

/* Tabs */
.rp-tabs { display: flex; gap: 6px; padding: 5px; background: rgba(255, 255, 255, .1); border-radius: 999px; margin-bottom: 16px; }
.rp-tab { flex: 1; padding: .7rem 1rem; border-radius: 999px; color: rgba(255, 255, 255, .85); font-family: var(--font-head); font-weight: 700; font-size: .9rem; }
.rp-tab.is-active { background: var(--white); color: var(--navy); }

/* Card */
.rp-card { background: var(--white); border-radius: 24px; box-shadow: var(--shadow); padding: 28px; }
@media (max-width: 520px) { .rp-card { padding: 20px 16px; border-radius: 20px; } }

/* Progress */
.rp-progress { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 26px; }
.rp-progress li { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .75rem; font-weight: 600; color: var(--muted); text-align: center; position: relative; }
.rp-progress li::before { content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.rp-progress li:first-child::before { display: none; }
.rp-progress span { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--white); border: 2px solid var(--line); font-family: var(--font-head); font-weight: 800; }
.rp-progress li.is-active { color: var(--navy); }
.rp-progress li.is-active span { border-color: var(--cyan); background: var(--cyan); color: var(--white); }
.rp-progress li.is-done span { border-color: var(--navy); background: var(--navy); color: var(--white); }
.rp-progress li.is-done::before, .rp-progress li.is-active::before { background: var(--cyan); }

/* Steps */
.rp-step { border: 0; display: none; }
.rp-step.is-active { display: block; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } }
.rp-step legend { font-size: 1.45rem; font-weight: 800; margin-bottom: .3rem; }
.rp-step legend small { font-size: .9rem; color: var(--muted); font-weight: 600; }
.rp-help { color: var(--muted); font-size: .95rem; margin-bottom: 1.1rem; }
.rp-note { margin-top: 1rem; padding: .8rem 1rem; background: var(--sky); border-radius: 12px; font-size: .9rem; color: var(--navy); }
.rp-error { color: var(--danger); font-weight: 600; font-size: .9rem; margin-top: .8rem; min-height: 1.2em; }
.rp-error:empty { margin: 0; min-height: 0; }

/* Type tiles */
.rp-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 520px) { .rp-types { grid-template-columns: repeat(2, 1fr); } }
.rp-type { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; padding: 14px; border: 2px solid var(--line); border-radius: 14px; text-align: left; font-weight: 600; font-size: .9rem; line-height: 1.25; min-height: 96px; transition: border-color .15s, background .15s, transform .15s; }
.rp-type__icon { font-size: 1.6rem; }
.rp-type:hover { border-color: var(--cyan); }
.rp-type.is-selected { border-color: var(--cyan); background: var(--sky); color: var(--navy); box-shadow: 0 0 0 3px rgba(24, 169, 224, .2); }

/* Fields */
.rp-field { display: block; margin-top: 1.1rem; position: relative; }
.rp-field > span { display: block; font-weight: 700; font-size: .92rem; margin-bottom: .4rem; color: var(--navy); }
.rp-field small { color: var(--muted); font-weight: 500; }
.rp-field input, .rp-field textarea, .rp-lookup input { width: 100%; padding: .85rem 1rem; border: 1.5px solid var(--line); border-radius: 12px; background: var(--soft); font-size: 16px; transition: border-color .15s, background .15s; }
.rp-field input:focus, .rp-field textarea:focus, .rp-lookup input:focus { outline: none; border-color: var(--cyan); background: var(--white); box-shadow: 0 0 0 3px rgba(24, 169, 224, .15); }
.rp-field textarea { resize: vertical; }
.rp-count { position: absolute; right: 10px; bottom: 8px; font-size: .75rem; }
.rp-auto { font-style: normal; font-size: .72rem; font-weight: 700; color: var(--ok); background: #e3f6ec; padding: .15rem .5rem; border-radius: 999px; margin-left: .3rem; }
.rp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rp-chip { padding: .55rem .95rem; border: 1.5px solid var(--line); border-radius: 999px; font-weight: 600; font-size: .88rem; }
.rp-chip.is-selected { background: var(--navy); border-color: var(--navy); color: var(--white); }

/* Map */
.rp-maptools { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.rp-seg { display: inline-flex; background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.rp-seg button { padding: .45rem .9rem; border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.rp-seg button.is-active { background: var(--white); color: var(--navy); box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }
.rp-map { height: 320px; border-radius: 16px; overflow: hidden; border: 1.5px solid var(--line); z-index: 0; }
@media (max-width: 520px) { .rp-map { height: 280px; } }
.rp-locinfo { margin-top: 10px; padding: .8rem 1rem; background: var(--soft); border-radius: 12px; font-size: .88rem; }
.rp-locinfo__empty { color: var(--muted); }
.rp-locinfo strong { color: var(--navy); }
.rp-locinfo small { display: block; color: var(--muted); }
.rp-pin { background: none; border: 0; }
.rp-pin div { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; background: var(--cyan); transform: rotate(-45deg); border: 3px solid var(--white); box-shadow: 0 4px 10px rgba(0, 0, 0, .35); }

/* Photo */
.rp-drop { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 28px 16px; border: 2px dashed var(--cyan); border-radius: 16px; background: var(--sky); cursor: pointer; text-align: center; color: var(--navy); }
.rp-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.rp-drop__icon { font-size: 2rem; }
.rp-drop small { color: var(--muted); }
.rp-drop:focus-within { box-shadow: 0 0 0 3px rgba(24, 169, 224, .3); }
.rp-preview { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1.5px solid var(--line); border-radius: 16px; }
.rp-preview img { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; }
.rp-preview strong { display: block; color: var(--navy); }
.rp-preview small { display: block; color: var(--muted); }
.rp-link { color: var(--danger); font-weight: 600; font-size: .88rem; margin-top: .3rem; text-decoration: underline; }

/* Summary & contact */
.rp-summary { display: grid; gap: 8px; margin: .8rem 0 1.2rem; }
.rp-summary div { display: flex; gap: 12px; padding: .75rem 1rem; background: var(--soft); border-radius: 12px; font-size: .92rem; }
.rp-summary dt { flex: none; width: 92px; color: var(--muted); font-weight: 600; }
.rp-summary dd { color: var(--ink); font-weight: 600; word-break: break-word; }
.rp-summary img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.rp-contact { border: 1.5px solid var(--line); border-radius: 16px; padding: 14px; }
.rp-contact__fields .rp-field:first-child { margin-top: .6rem; }
.rp-check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.rp-check input { flex: none; width: 22px; height: 22px; margin-top: 2px; accent-color: var(--cyan); }
.rp-check strong { display: block; color: var(--navy); }
.rp-check small { color: var(--muted); }
.rp-check--consent { margin-top: 1rem; font-size: .88rem; color: var(--muted); }

/* Nav buttons */
.rp-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.rp-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .9rem 1.4rem; border-radius: 999px; font-family: var(--font-head); font-weight: 700; font-size: .95rem; transition: background .2s, transform .15s, opacity .2s; }
.rp-btn:active { transform: scale(.97); }
.rp-btn--sm { padding: .5rem 1rem; font-size: .85rem; }
.rp-btn--primary { background: var(--navy); color: var(--white); }
.rp-btn--primary:hover { background: var(--blue); }
.rp-btn--cyan { background: var(--cyan); color: var(--white); }
.rp-btn--ghost { background: var(--soft); color: var(--navy); border: 1.5px solid var(--line); }
.rp-btn[disabled] { opacity: .55; cursor: wait; }
.rp-nav .rp-btn--primary { flex: 1; max-width: 260px; margin-left: auto; }
@media (max-width: 520px) {
  .rp-nav { position: sticky; bottom: 0; margin: 20px -16px -20px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-radius: 0 0 20px 20px; }
  .rp-nav .rp-btn--primary { max-width: none; }
}

/* Success */
.rp-success { text-align: center; }
.rp-success__icon { width: 72px; height: 72px; margin: 0 auto 1rem; border-radius: 50%; background: #e3f6ec; color: var(--ok); display: grid; place-items: center; font-size: 2.2rem; font-weight: 900; }
.rp-success h1 { font-size: 1.7rem; margin-bottom: .5rem; }
.rp-success > p { color: var(--muted); }
.rp-folio { display: inline-flex; align-items: center; gap: 12px; margin: 1.2rem 0; padding: .8rem .8rem .8rem 1.2rem; border: 2px dashed var(--cyan); border-radius: 16px; background: var(--sky); }
.rp-folio span { font-family: var(--font-head); font-weight: 900; font-size: clamp(1.1rem, 5.6vw, 1.5rem); color: var(--navy); letter-spacing: .03em; white-space: nowrap; }
.rp-success__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 1.4rem; }

/* Lookup */
.rp-title { font-size: 1.45rem; margin-bottom: .3rem; }
.rp-lookup { display: flex; gap: 10px; }
.rp-lookup input { text-transform: uppercase; font-family: var(--font-head); font-weight: 700; letter-spacing: .04em; }
@media (max-width: 420px) { .rp-lookup { flex-direction: column; } }
.rp-status { margin-top: 1.4rem; }
.rp-status__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 1rem; }
.rp-status__head strong { font-family: var(--font-head); font-size: 1.15rem; color: var(--navy); }
.rp-badge { padding: .3rem .8rem; border-radius: 999px; font-weight: 700; font-size: .82rem; }
.rp-badge--pendiente { background: #fff2dc; color: var(--warn); }
.rp-badge--en_proceso { background: var(--sky); color: var(--blue); }
.rp-badge--solucionado { background: #e3f6ec; color: var(--ok); }
.rp-timeline { list-style: none; display: grid; gap: 0; margin: 1rem 0; }
.rp-timeline li { display: flex; gap: 12px; padding-bottom: 18px; position: relative; color: var(--muted); }
.rp-timeline li::before { content: ""; flex: none; width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--line); background: var(--white); margin-top: 3px; z-index: 1; }
.rp-timeline li::after { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.rp-timeline li:last-child::after { display: none; }
.rp-timeline li.is-done { color: var(--ink); font-weight: 600; }
.rp-timeline li.is-done::before { border-color: var(--cyan); background: var(--cyan); }
.rp-status dl { display: grid; gap: 8px; }
.rp-status dl div { display: flex; gap: 12px; font-size: .92rem; }
.rp-status dt { width: 110px; flex: none; color: var(--muted); }
.rp-status dd { font-weight: 600; }

.rp-proto { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 18px; padding-bottom: env(safe-area-inset-bottom, 0px); }

@media (prefers-reduced-motion: reduce) { .rp-step.is-active { animation: none; } }
