/* ── SGE Form & Finalizar Styles ─────────────────────────────────────────── */

:root {
    --sge-primary:  #1d6fac;
    --sge-success:  #1a8a4a;
    --sge-error:    #dc2626;
    --sge-wa:       #25d366;
    --sge-gray-100: #f5f7fa;
    --sge-gray-200: #e5e7eb;
    --sge-gray-500: #6b7280;
    --sge-radius:   8px;
}

/* ── Formulario de recepción ──────────────────────────────────────────────── */

.sge-form-wrapper {
    max-width: 680px;
    margin: 0 auto;
}

.sge-form {
    background: #fff;
    border: 1px solid var(--sge-gray-200);
    border-radius: var(--sge-radius);
    overflow: hidden;
}

.sge-section {
    padding: 20px 24px;
    border-bottom: 1px solid var(--sge-gray-200);
}
.sge-section:last-child { border-bottom: none; }

.sge-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--sge-gray-500);
    margin: 0 0 14px;
}

.sge-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 520px) { .sge-row { grid-template-columns: 1fr; } }

.sge-field { display: flex; flex-direction: column; gap: 5px; }
.sge-full  { margin-top: 14px; }

.sge-field label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}
.sge-field .req { color: var(--sge-error); }

.sge-field input,
.sge-field textarea,
.sge-field select {
    padding: 9px 12px;
    border: 1px solid var(--sge-gray-200);
    border-radius: 6px;
    font-size: 14px;
    color: #111;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
    font-family: inherit;
}
.sge-field input:focus,
.sge-field textarea:focus {
    outline: none;
    border-color: var(--sge-primary);
    box-shadow: 0 0 0 3px rgba(29,111,172,.12);
}
.sge-field input.is-invalid { border-color: var(--sge-error); }
.sge-field textarea { resize: vertical; }

/* Autocomplete cuerda */
.sge-autocomplete-wrap {
    position: relative;
}

.sge-ac-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--sge-primary);
    border-top: none;
    border-radius: 0 0 6px 6px;
    list-style: none;
    margin: 0;
    padding: 0;
    z-index: 200;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

.sge-ac-item {
    padding: 9px 12px;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--sge-gray-100);
}
.sge-ac-item:last-child { border-bottom: none; }
.sge-ac-item:hover { background: var(--sge-gray-100); color: var(--sge-primary); }

.sge-otra-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--sge-gray-500);
    margin-top: 5px;
    cursor: pointer;
    user-select: none;
}
.sge-otra-label input[type="checkbox"] {
    width: auto;
    padding: 0;
    border: none;
    box-shadow: none;
    cursor: pointer;
}

/* Switchers */
.sge-switchers {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 14px;
}

.sge-switch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--sge-gray-100);
    cursor: pointer;
    user-select: none;
}
.sge-switch-item:last-child { border-bottom: none; }

.sge-switch-label {
    font-size: 14px;
    color: #374151;
}

.sge-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}
.sge-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.sge-switch-slider {
    position: absolute;
    inset: 0;
    background: var(--sge-gray-200);
    border-radius: 24px;
    transition: background .2s;
    cursor: pointer;
}
.sge-switch-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.sge-switch input:checked + .sge-switch-slider {
    background: var(--sge-primary);
}
.sge-switch input:checked + .sge-switch-slider::before {
    transform: translateX(18px);
}

/* Submit */
.sge-form-footer {
    padding: 16px 24px;
    background: var(--sge-gray-100);
    border-top: 1px solid var(--sge-gray-200);
}

.sge-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 28px;
    background: var(--sge-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
    font-family: inherit;
    min-width: 180px;
}
.sge-submit:hover { background: #155e8e; }
.sge-submit:disabled { opacity: .6; cursor: not-allowed; }
.sge-submit .sge-submit-loading { display: none; }
.sge-submit.is-loading .sge-submit-text { display: none; }
.sge-submit.is-loading .sge-submit-loading { display: inline; }

/* Alerts */
.sge-alert {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
}
.sge-alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* Success */
.sge-success {
    background: #fff;
    border: 1px solid var(--sge-gray-200);
    border-radius: var(--sge-radius);
    padding: 40px 24px;
    text-align: center;
}
.sge-success-check {
    width: 56px; height: 56px;
    background: var(--sge-success);
    color: #fff;
    border-radius: 50%;
    font-size: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}
.sge-success h3 { font-size: 20px; margin: 0 0 6px; }
.sge-success p  { color: var(--sge-gray-500); margin: 0 0 20px; }

.sge-success-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.sge-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    font-family: inherit;
    transition: opacity .15s;
}
.sge-btn:hover { opacity: .85; }
.sge-btn-primary   { background: var(--sge-primary); color: #fff; }
.sge-btn-secondary { background: var(--sge-gray-200); color: #374151; }

/* ── Página Finalizar (escaneo QR) ───────────────────────────────────────── */

.sge-finalizar-main {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 32px 16px;
}

.sge-finalizar-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    padding: 28px 24px;
    width: 100%;
    max-width: 440px;
}

.sge-fin-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--sge-gray-200);
}
.sge-fin-logo { font-size: 36px; display: block; margin-bottom: 6px; }
.sge-fin-header h1 { font-size: 22px; font-weight: 800; margin: 0 0 8px; }

.sge-badge-estado {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.sge-estado-pendiente  { background: #fef3c7; color: #92400e; }
.sge-estado-en_proceso { background: #dbeafe; color: #1e40af; }
.sge-estado-terminado  { background: #d1fae5; color: #065f46; }
.sge-estado-entregado  { background: #f3f4f6; color: #374151; }

/* Datos */
.sge-fin-datos {
    margin-bottom: 20px;
}
.sge-fin-fila {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 7px 0;
    border-bottom: 1px solid var(--sge-gray-100);
}
.sge-fin-fila:last-child { border-bottom: none; }
.sge-fin-fila dt { color: var(--sge-gray-500); font-size: 13px; }
.sge-fin-fila dd { font-weight: 600; font-size: 14px; margin: 0; }
.sge-fin-obs { flex-direction: column; gap: 2px; }
.sge-fin-obs dd { font-style: italic; font-size: 13px; }

/* Actions */
.sge-fin-actions { text-align: center; margin-bottom: 16px; }

.sge-btn-wa {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    background: var(--sge-wa);
    color: #fff;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    transition: background .15s;
    font-family: inherit;
    border: none;
    cursor: pointer;
    margin-bottom: 8px;
}
.sge-btn-wa:hover  { background: #1ebe5d; color: #fff; text-decoration: none; }
.sge-btn-wa.sge-wa-reenviado { background: #059669; }
.sge-btn-wa-secondary {
    background: transparent;
    border: 2px solid var(--sge-wa);
    color: var(--sge-wa);
    font-size: 13px;
    padding: 9px 20px;
    width: auto;
}
.sge-btn-wa-secondary:hover { background: var(--sge-wa); color: #fff; }

.sge-fin-hint { font-size: 11px; color: var(--sge-gray-500); margin: 4px 0 0; }

.sge-fin-terminado,
.sge-fin-entregado {
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
}
.sge-fin-terminado { background: #d1fae5; color: #065f46; }
.sge-fin-entregado { background: #f3f4f6; color: #374151; }

/* Fecha */
.sge-fin-fecha {
    text-align: center;
    font-size: 11px;
    color: var(--sge-gray-500);
    border-top: 1px solid var(--sge-gray-200);
    padding-top: 12px;
}

