:root {
    --primary: #000b59;
    --primary-light: #1c2a80;
    --accent: #f55400;
    --bg: #f5f7fb;
    --bg-soft: #f0f2fb;
    --text: #222;
    --muted: #6b6b6b;
    --border: #d0d4e0;
    --error: #c0392b;
    --radius: 12px;
    --radius-lg: 18px;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
    background: var(--bg);
    color: var(--text);
}

.page {
    max-width: 960px;
    margin: 0 auto;
    padding: 12px;
}

.card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 20px 18px 90px;
}

@media (min-width: 720px) {
    .card {
        padding: 24px 26px 26px;
    }
}

h1 {
    margin-top: 0;
    color: var(--primary);
    font-size: 1.6rem;
}

.subtitle {
    margin-top: 4px;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 0.95rem;
}

/* HEADER */
.header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 4px;
}

.header img {
    height: 44px;
    width: auto;
}

@media (max-width: 720px) {
    .page {
        padding: 0;
    }

    .card {
        border-radius: 0;
        min-height: 100vh;
    }

    .header {
        gap: 10px;
    }

    h1 {
        font-size: 1.4rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }
}

/* STEPPER */
.stepper {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    position: relative;
    padding: 0 2px;
}

.stepper::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 32px;
    right: 32px;
    height: 2px;
    background: #e0e3ee;
    transform: translateY(-50%);
    z-index: 0;
}

.step {
    position: relative;
    z-index: 1;
    flex: 1;
    text-align: center;
    font-size: 0.7rem;
    color: #9aa0b8;
}

.step-number {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    margin: 0 auto 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0e3ee;
    color: #555;
    font-weight: 600;
    font-size: 0.8rem;
}

.step-label {
    max-width: 110px;
    margin: 0 auto;
    line-height: 1.2;
}

.step.active .step-number {
    background: var(--primary);
    color: #fff;
}

.step.completed .step-number {
    background: var(--accent);
    color: #fff;
}

.step.active {
    color: var(--primary);
    font-weight: 600;
}

@media (max-width: 720px) {
    .stepper {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 4px;
        scrollbar-width: thin;
    }

    .stepper::before {
        display: none;
    }

    .step {
        display: inline-block;
        min-width: 80px;
    }
}

/* FORM */
form {
    margin-top: 4px;
}

.form-step {
    display: none;
}

.form-step.active {
    display: block;
    animation: fadeIn 0.25s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--primary);
    font-size: 1.05rem;
}

.help-text {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 12px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
}

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

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

.field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
}

.field span.required {
    color: var(--accent);
    margin-left: 3px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
select,
textarea {
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease,
        background 0.16s ease;
    background: #fdfdff;
    width: 100%;
    resize: vertical;
    min-height: 42px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 11, 89, 0.18);
    background: #fff;
}

textarea {
    min-height: 70px;
    font-size: 0.9rem;
}

.field-small {
    max-width: 180px;
}

.error-message {
    margin-top: 8px;
    color: var(--error);
    font-size: 0.8rem;
}

.hidden {
    display: none !important;
}

/* BOTONES */
.buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    border-radius: 999px;
    padding: 9px 18px;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s ease, transform 0.05s ease,
        box-shadow 0.15s ease, opacity 0.15s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 11, 89, 0.3);
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #eef0fb;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e3f7;
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

@media (max-width: 720px) {
    .buttons {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        padding: 10px 14px;
        border-top: 1px solid #ddd;
        z-index: 999;
    }

    .card {
        padding-bottom: 90px;
    }

    .btn-primary {
        padding: 11px 22px;
        border-radius: 12px;
        font-size: 1rem;
    }
}

/* CARDS DINÁMICAS (Educación / Exp / Familia) */
.educ-card,
.exp-card,
.fam-card {
    border-radius: 14px;
    padding: 14px 16px;
    margin-top: 12px;
    border: 1px solid #d9dbe8;
}

.educ-card {
    background: #f6f7ff;
    border-color: #d1d5ff;
}

.exp-card {
    background: #fff7f0;
    border-color: #ffd8b3;
}

.fam-card {
    background: #eef7ff;
    border-color: #bcd9ff;
}

.educ-grid,
.exp-grid,
.fam-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 16px;
}

@media (max-width: 720px) {

    .educ-grid,
    .exp-grid,
    .fam-grid {
        grid-template-columns: 1fr;
    }
}

.educ-remove,
.exp-remove,
.fam-remove {
    background: #ffe6e6;
    border: 1px solid #ffbdbd;
    color: #a30000;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    cursor: pointer;
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* REFERENCIAS CARDS */
.ref-card {
    background: #fdfcff;
    border-radius: 14px;
    border: 1px solid #dde1f0;
    padding: 12px 14px;
    margin-top: 14px;
}

.ref-card h4 {
    margin: 0 0 8px;
    font-size: 0.95rem;
    color: var(--primary);
}

/* PREVIEW */
.preview-container {
    margin-top: 8px;
    border-radius: 14px;
    background: var(--bg-soft);
    padding: 10px 10px 4px;
    border: 1px solid #dde0f0;
    max-height: 55vh;
    overflow-y: auto;
}

.preview-section {
    margin-bottom: 8px;
}

.preview-section details {
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e1e4f5;
    padding: 8px 10px;
}

.preview-section summary {
    list-style: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.preview-section summary::-webkit-details-marker {
    display: none;
}

.preview-pill {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f3f4ff;
    font-size: 0.7rem;
    color: var(--muted);
    margin-left: 8px;
}

.preview-content {
    margin-top: 6px;
    font-size: 0.86rem;
    color: #333;
}

.preview-row {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 4px;
    font-size: 0.82rem;
}

.preview-label {
    font-weight: 600;
    color: #555;
}

.preview-value {
    text-align: right;
    color: #222;
}

@media (max-width: 720px) {
    .preview-row {
        flex-direction: column;
        text-align: left;
    }

    .preview-value {
        text-align: left;
    }
}

.field-help {
    font-size: 0.85rem;
    color: #555;
    margin-top: -5px;
    margin-bottom: 8px;
}

.delete-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2200;
}

.delete-modal-backdrop.visible {
    display: flex;
}

.delete-modal-card {
    background: #fff;
    border-radius: 12px;
    padding: 18px;
    max-width: 420px;
    width: calc(100% - 40px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2);
}

.delete-modal-card p {
    margin: 0 0 12px;
    color: #222;
}

.delete-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

.delete-modal-actions .btn {
    min-width: 88px;
}

.signature-wrapper {
    width: 100%;
    max-width: 340px;
    height: 120px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.signature-wrapper canvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.signature-actions {
    margin-top: 6px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}